mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-21 07:31:26 +02:00
fix possible crash when PROT removes spark on disabled elements
This commit is contained in:
@@ -55,11 +55,17 @@ int Element_PROT::update(UPDATE_FUNC_ARGS)
|
|||||||
switch (utype)
|
switch (utype)
|
||||||
{
|
{
|
||||||
case PT_SPRK:
|
case PT_SPRK:
|
||||||
|
{
|
||||||
//remove active sparks
|
//remove active sparks
|
||||||
sim->part_change_type(under>>8, x, y, parts[under>>8].ctype);
|
int sparked = parts[under>>8].ctype;
|
||||||
|
if (sparked >= 0 && sparked < PT_NUM && sim->elements[sparked].Enabled)
|
||||||
|
{
|
||||||
|
sim->part_change_type(under>>8, x, y, sparked);
|
||||||
parts[under>>8].life = 44 + parts[under>>8].life;
|
parts[under>>8].life = 44 + parts[under>>8].life;
|
||||||
parts[under>>8].ctype = 0;
|
parts[under>>8].ctype = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case PT_DEUT:
|
case PT_DEUT:
|
||||||
if ((-((int)sim->pv[y / CELL][x / CELL] - 4) + (parts[under>>8].life / 100)) > rand() % 200)
|
if ((-((int)sim->pv[y / CELL][x / CELL] - 4) + (parts[under>>8].life / 100)) > rand() % 200)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user