summaryrefslogtreecommitdiff
path: root/src/simulation/Simulation.cpp
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2012-12-06 15:56:24 (GMT)
committer jacob1 <jfu614@gmail.com>2012-12-06 15:56:24 (GMT)
commit2d7ac84c1dca8521f41cf023774b7a90e300b3bf (patch)
tree115eaf6632e3a9821b3374879e1e608091d09f80 /src/simulation/Simulation.cpp
parent4654a2aaa0c7a48583ec3e1b2b3d1c0923afc0cd (diff)
downloadpowder-2d7ac84c1dca8521f41cf023774b7a90e300b3bf.zip
powder-2d7ac84c1dca8521f41cf023774b7a90e300b3bf.tar.gz
give TRON the ability to go through activated SWCH
Diffstat (limited to 'src/simulation/Simulation.cpp')
-rw-r--r--src/simulation/Simulation.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index cfe39ac..1f19a62 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -2071,6 +2071,7 @@ void Simulation::init_can_move()
can_move[PT_ELEC][PT_DEUT] = 1;
can_move[PT_THDR][PT_THDR] = 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;
else result = 0;
}
- if ((r&0xFF)==PT_PVOD)
+ else if ((r&0xFF)==PT_PVOD)
{
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;
}
- 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))
result = 1;
else
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])
{