summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFacialTurd <simon@hardwired.org.uk>2010-12-13 12:34:57 (GMT)
committer FacialTurd <simon@hardwired.org.uk>2010-12-13 12:34:57 (GMT)
commit6f928009ed6df44866f2cde68eafa0a283588be8 (patch)
tree7c37be9dfc3f0f9925dc878cc0834841b650a819 /src
parentd20ba9f34231156b1c5636708aff56aef8dbf19d (diff)
downloadpowder-6f928009ed6df44866f2cde68eafa0a283588be8.zip
powder-6f928009ed6df44866f2cde68eafa0a283588be8.tar.gz
Possible crash, fix from cracker64.
Diffstat (limited to 'src')
-rw-r--r--src/main.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 49d1701..e0fce50 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1630,9 +1630,15 @@ int main(int argc, char *argv[])
sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
#else
if(DEBUG_MODE)
- sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
- else
+ {
+ int tctype = parts[cr>>8].ctype;
+ if(tctype>=PT_NUM)
+ tctype = 0;
+ sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
+ //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
+ } else {
sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f);
+ }
#endif
}
else