give TRON the ability to go through activated SWCH
This commit is contained in:
parent
4654a2aaa0
commit
2d7ac84c1d
@ -2071,6 +2071,7 @@ void Simulation::init_can_move()
|
|||||||
can_move[PT_ELEC][PT_DEUT] = 1;
|
can_move[PT_ELEC][PT_DEUT] = 1;
|
||||||
can_move[PT_THDR][PT_THDR] = 2;
|
can_move[PT_THDR][PT_THDR] = 2;
|
||||||
can_move[PT_EMBR][PT_EMBR] = 2;
|
can_move[PT_EMBR][PT_EMBR] = 2;
|
||||||
|
can_move[PT_TRON][PT_SWCH] = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2104,7 +2105,7 @@ int Simulation::eval_move(int pt, int nx, int ny, unsigned *rr)
|
|||||||
if (pv[ny/CELL][nx/CELL]>4.0f || pv[ny/CELL][nx/CELL]<-4.0f) result = 2;
|
if (pv[ny/CELL][nx/CELL]>4.0f || pv[ny/CELL][nx/CELL]<-4.0f) result = 2;
|
||||||
else result = 0;
|
else result = 0;
|
||||||
}
|
}
|
||||||
if ((r&0xFF)==PT_PVOD)
|
else if ((r&0xFF)==PT_PVOD)
|
||||||
{
|
{
|
||||||
if (parts[r>>8].life == 10)
|
if (parts[r>>8].life == 10)
|
||||||
{
|
{
|
||||||
@ -2115,13 +2116,20 @@ int Simulation::eval_move(int pt, int nx, int ny, unsigned *rr)
|
|||||||
}
|
}
|
||||||
else result = 0;
|
else result = 0;
|
||||||
}
|
}
|
||||||
if ((r&0xFF)==PT_VOID)
|
else if ((r&0xFF)==PT_VOID)
|
||||||
{
|
{
|
||||||
if(!parts[r>>8].ctype || (parts[r>>8].ctype==pt)!=(parts[r>>8].tmp&1))
|
if(!parts[r>>8].ctype || (parts[r>>8].ctype==pt)!=(parts[r>>8].tmp&1))
|
||||||
result = 1;
|
result = 1;
|
||||||
else
|
else
|
||||||
result = 0;
|
result = 0;
|
||||||
}
|
}
|
||||||
|
else if (pt == PT_TRON && (r&0xFF) == PT_SWCH)
|
||||||
|
{
|
||||||
|
if (parts[r>>8].life >= 10)
|
||||||
|
return 2;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (bmap[ny/CELL][nx/CELL])
|
if (bmap[ny/CELL][nx/CELL])
|
||||||
{
|
{
|
||||||
|
@ -199,13 +199,13 @@ int Element_TRON::trymovetron(Simulation * sim, int x, int y, int dir, int i, in
|
|||||||
rx += tron_rx[dir];
|
rx += tron_rx[dir];
|
||||||
ry += tron_ry[dir];
|
ry += tron_ry[dir];
|
||||||
r = sim->pmap[ry][rx];
|
r = sim->pmap[ry][rx];
|
||||||
if (!r && !sim->bmap[(ry)/CELL][(rx)/CELL] && ry > CELL && rx > CELL && ry < YRES-CELL && rx < XRES-CELL)
|
if ((!r || ((r&0xFF) == PT_SWCH && sim->parts[r>>8].life >= 10)) && !sim->bmap[(ry)/CELL][(rx)/CELL] && ry > CELL && rx > CELL && ry < YRES-CELL && rx < XRES-CELL)
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
for (tx = rx - tron_ry[dir] , ty = ry - tron_rx[dir], j=1; abs(tx-rx) < (len-k) && abs(ty-ry) < (len-k); tx-=tron_ry[dir],ty-=tron_rx[dir],j++)
|
for (tx = rx - tron_ry[dir] , ty = ry - tron_rx[dir], j=1; abs(tx-rx) < (len-k) && abs(ty-ry) < (len-k); tx-=tron_ry[dir],ty-=tron_rx[dir],j++)
|
||||||
{
|
{
|
||||||
r = sim->pmap[ty][tx];
|
r = sim->pmap[ty][tx];
|
||||||
if (!r && !sim->bmap[(ty)/CELL][(tx)/CELL] && ty > CELL && tx > CELL && ty < YRES-CELL && tx < XRES-CELL)
|
if ((!r || ((r&0xFF) == PT_SWCH && sim->parts[r>>8].life >= 10)) && !sim->bmap[(ty)/CELL][(tx)/CELL] && ty > CELL && tx > CELL && ty < YRES-CELL && tx < XRES-CELL)
|
||||||
{
|
{
|
||||||
if (j == (len-k))//there is a safe path, so we can break out
|
if (j == (len-k))//there is a safe path, so we can break out
|
||||||
return len+1;
|
return len+1;
|
||||||
@ -217,7 +217,7 @@ int Element_TRON::trymovetron(Simulation * sim, int x, int y, int dir, int i, in
|
|||||||
for (tx = rx + tron_ry[dir] , ty = ry + tron_rx[dir], j=1; abs(tx-rx) < (len-k) && abs(ty-ry) < (len-k); tx+=tron_ry[dir],ty+=tron_rx[dir],j++)
|
for (tx = rx + tron_ry[dir] , ty = ry + tron_rx[dir], j=1; abs(tx-rx) < (len-k) && abs(ty-ry) < (len-k); tx+=tron_ry[dir],ty+=tron_rx[dir],j++)
|
||||||
{
|
{
|
||||||
r = sim->pmap[ty][tx];
|
r = sim->pmap[ty][tx];
|
||||||
if (!r && !sim->bmap[(ty)/CELL][(tx)/CELL] && ty > CELL && tx > CELL && ty < YRES-CELL && tx < XRES-CELL)
|
if ((!r || ((r&0xFF) == PT_SWCH && sim->parts[r>>8].life >= 10)) && !sim->bmap[(ty)/CELL][(tx)/CELL] && ty > CELL && tx > CELL && ty < YRES-CELL && tx < XRES-CELL)
|
||||||
{
|
{
|
||||||
if (j == (len-k))
|
if (j == (len-k))
|
||||||
return len+1;
|
return len+1;
|
||||||
|
Loading…
Reference in New Issue
Block a user