Mercurial > hg > early-roguelike
comparison urogue/daemon.c @ 289:d815c40c3753
UltraRogue: add a sanity check to do_fuses().
The d_id field, which indicates which fuse function to call, is now
checked to make sure it is not out of range. do_daemons() already
checks.
author | John "Elwin" Edwards |
---|---|
date | Fri, 24 Nov 2017 16:22:10 -0500 |
parents | c495a4f288c6 |
children |
comparison
equal
deleted
inserted
replaced
288:b8919055c2fc | 289:d815c40c3753 |
---|---|
280 | 280 |
281 if( (wire->d_type == FUSE) && (wire->d_when == now) ) | 281 if( (wire->d_type == FUSE) && (wire->d_when == now) ) |
282 { | 282 { |
283 if (--wire->d_time <= 0) | 283 if (--wire->d_time <= 0) |
284 { | 284 { |
285 fuse_arg arg; | 285 if (wire->d_id < 0 || wire->d_id >= FUSE_MAX) |
286 | 286 printf("Bad fuse id %d\n", wire->d_id); |
287 arg.varg = wire->d_arg; | 287 else if (fuses[wire->d_id].func == NULL) |
288 printf("No action for fuse %d!\n", wire->d_id); | |
289 else | |
290 { | |
291 fuse_arg arg; | |
292 | |
293 arg.varg = wire->d_arg; | |
294 fuses[wire->d_id].func(&arg); | |
295 } | |
288 wire->d_type = EMPTY; | 296 wire->d_type = EMPTY; |
289 fuses[wire->d_id].func(&arg); | |
290 demoncnt -= 1; | 297 demoncnt -= 1; |
291 } | 298 } |
292 } | 299 } |
293 | 300 |
294 } | 301 } |