TPT: Prevent STKM falling through activated PVOD with a ctype that isn't STKM 637ee194e0

This commit is contained in:
Simon Robertshaw 2012-07-25 18:32:10 +01:00
parent 1e5eba3583
commit b9e16d4bc6

View File

@ -1881,7 +1881,6 @@ void Simulation::init_can_move()
for (t=0;t<PT_NUM;t++) for (t=0;t<PT_NUM;t++)
{ {
// make them eat things // make them eat things
can_move[t][PT_VOID] = 1;
can_move[t][PT_BHOL] = 1; can_move[t][PT_BHOL] = 1;
can_move[t][PT_NBHL] = 1; can_move[t][PT_NBHL] = 1;
can_move[t][PT_STKM] = 0; can_move[t][PT_STKM] = 0;
@ -1891,8 +1890,9 @@ void Simulation::init_can_move()
can_move[t][PT_INVIS] = 3; can_move[t][PT_INVIS] = 3;
//stop CNCT being displaced by other particles //stop CNCT being displaced by other particles
can_move[t][PT_CNCT] = 0; can_move[t][PT_CNCT] = 0;
//Powered void behaviour varies on powered state //void behaviour varies with powered state and ctype
can_move[t][PT_PVOD] = 3; can_move[t][PT_PVOD] = 3;
can_move[t][PT_VOID] = 3;
} }
for (t=0;t<PT_NUM;t++) for (t=0;t<PT_NUM;t++)
{ {
@ -1955,9 +1955,22 @@ int Simulation::eval_move(int pt, int nx, int ny, unsigned *rr)
} }
if ((r&0xFF)==PT_PVOD) if ((r&0xFF)==PT_PVOD)
{ {
if (parts[r>>8].life == 10) result = 1; if (parts[r>>8].life == 10)
{
if(!parts[r>>8].ctype || (parts[r>>8].ctype==pt)!=(parts[r>>8].tmp&1))
result = 1;
else
result = 0;
}
else result = 0; else result = 0;
} }
if ((r&0xFF)==PT_VOID)
{
if(!parts[r>>8].ctype || (parts[r>>8].ctype==pt)!=(parts[r>>8].tmp&1))
result = 1;
else
result = 0;
}
} }
if (bmap[ny/CELL][nx/CELL]) if (bmap[ny/CELL][nx/CELL])
{ {
@ -2084,8 +2097,8 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
} }
if ((r&0xFF)==PT_VOID || (r&0xFF)==PT_PVOD) //this is where void eats particles if ((r&0xFF)==PT_VOID || (r&0xFF)==PT_PVOD) //this is where void eats particles
{ {
if(!parts[r>>8].ctype || (parts[r>>8].ctype==parts[i].type)!=(parts[r>>8].tmp&1)) //void ctype already checked in eval_move
kill_part(i); kill_part(i);
return 0; return 0;
} }
if ((r&0xFF)==PT_BHOL || (r&0xFF)==PT_NBHL) //this is where blackhole eats particles if ((r&0xFF)==PT_BHOL || (r&0xFF)==PT_NBHL) //this is where blackhole eats particles