summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-06-07 18:54:13 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-06-07 18:54:13 (GMT)
commit46d43d3020c01de461a0ba2df0f5bb12b466b71a (patch)
treeb5ad0700396a827db91083e33cb73c5ee49a33c2 /src/elements
parent1d7b77b144369ac36fb561d85f03cb2542550061 (diff)
downloadpowder-46d43d3020c01de461a0ba2df0f5bb12b466b71a.zip
powder-46d43d3020c01de461a0ba2df0f5bb12b466b71a.tar.gz
Unnecessary optimisation
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/ttan.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/elements/ttan.c b/src/elements/ttan.c
index 0fa735a..9023939 100644
--- a/src/elements/ttan.c
+++ b/src/elements/ttan.c
@@ -17,25 +17,21 @@
int update_TTAN(UPDATE_FUNC_ARGS) {
int nx, ny, ttan = 0;
- if(nt<=6)
- {
- for (nx=-1; nx<2; nx++)
+ if(nt<=2)
+ ttan = 2;
+ else if(parts[i].tmp)
+ ttan = 2;
+ else if(nt<=6)
+ for (nx=-1; nx<2; nx++) {
for (ny=-1; ny<2; ny++) {
- if (!nx != !ny) {
+ if ((!nx != !ny) && x+nx>=0 && y+ny>=0 && x+nx<XRES && y+ny<YRES) {
if((pmap[y+ny][x+nx]&0xFF)==PT_TTAN)
- {
ttan++;
- }
}
}
- if(ttan>=2)
- {
- bmap_blockair[y/CELL][x/CELL] = 1;
- bmap_blockairh[y/CELL][x/CELL] = 1;
}
- }
- if(parts[i].tmp)
- {
+
+ if(ttan>=2) {
bmap_blockair[y/CELL][x/CELL] = 1;
bmap_blockairh[y/CELL][x/CELL] = 1;
}