Mercurial > hg > early-roguelike
comparison arogue7/main.c @ 238:e1cd27c5464f
arogue7, xrogue: improve the handling of the arguments to fuses.
fuse() now expects a pointer as the argument to a fuse function. If
this is one of the functions that takes int, fuse() follows the pointer
and stores that value in the f_list slot, in the integer field of the
argument union. When the fuse goes off, do_fuses() recognizes the
function and passes it the integer field instead of the pointer.
This has the disadvantage of hard-coding the functions that require int
in daemon.c, but since the int is copied into f_list, it no longer has
to be in static or global memory, which simplifies several files.
author | John "Elwin" Edwards |
---|---|
date | Fri, 11 Mar 2016 17:40:00 -0500 |
parents | f9ef86cf22b2 |
children | 3d4252fa2ed3 |
comparison
equal
deleted
inserted
replaced
237:2236ef808bcb | 238:e1cd27c5464f |
---|---|
391 new_level(STARTLEV); /* Draw current level */ | 391 new_level(STARTLEV); /* Draw current level */ |
392 /* | 392 /* |
393 * Start up daemons and fuses | 393 * Start up daemons and fuses |
394 */ | 394 */ |
395 start_daemon(doctor, &player, AFTER); | 395 start_daemon(doctor, &player, AFTER); |
396 fuse(swander, 0, WANDERTIME, AFTER); | 396 fuse(swander, NULL, WANDERTIME, AFTER); |
397 if (player.t_ctype == C_MAGICIAN || player.t_ctype == C_RANGER) | 397 if (player.t_ctype == C_MAGICIAN || player.t_ctype == C_RANGER) |
398 fuse(spell_recovery, 0, SPELLTIME, AFTER); | 398 fuse(spell_recovery, NULL, SPELLTIME, AFTER); |
399 if (player.t_ctype == C_DRUID || player.t_ctype == C_RANGER) | 399 if (player.t_ctype == C_DRUID || player.t_ctype == C_RANGER) |
400 fuse(chant_recovery, 0, SPELLTIME, AFTER); | 400 fuse(chant_recovery, NULL, SPELLTIME, AFTER); |
401 if (player.t_ctype == C_CLERIC || player.t_ctype == C_PALADIN) | 401 if (player.t_ctype == C_CLERIC || player.t_ctype == C_PALADIN) |
402 fuse(prayer_recovery, 0, SPELLTIME, AFTER); | 402 fuse(prayer_recovery, NULL, SPELLTIME, AFTER); |
403 start_daemon(stomach, 0, AFTER); | 403 start_daemon(stomach, NULL, AFTER); |
404 if (player.t_ctype == C_THIEF || | 404 if (player.t_ctype == C_THIEF || |
405 player.t_ctype == C_ASSASIN || | 405 player.t_ctype == C_ASSASIN || |
406 player.t_ctype == C_MONK) | 406 player.t_ctype == C_MONK) |
407 start_daemon(trap_look, 0, AFTER); | 407 start_daemon(trap_look, NULL, AFTER); |
408 | 408 |
409 /* Does this character have any special knowledge? */ | 409 /* Does this character have any special knowledge? */ |
410 switch (player.t_ctype) { | 410 switch (player.t_ctype) { |
411 case C_ASSASIN: | 411 case C_ASSASIN: |
412 /* Assassins automatically recognize poison */ | 412 /* Assassins automatically recognize poison */ |