comparison arogue7/daemons.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
comparison
equal deleted inserted replaced
237:2236ef808bcb 238:e1cd27c5464f
109 */ 109 */
110 110
111 void 111 void
112 swander(void) 112 swander(void)
113 { 113 {
114 start_daemon(rollwand, 0, BEFORE); 114 start_daemon(rollwand, NULL, BEFORE);
115 } 115 }
116 116
117 /* 117 /*
118 * rollwand: 118 * rollwand:
119 * Called to roll to see if a wandering monster starts up 119 * Called to roll to see if a wandering monster starts up
132 ((player.t_ctype != C_THIEF && player.t_ctype != C_ASSASIN) || 132 ((player.t_ctype != C_THIEF && player.t_ctype != C_ASSASIN) ||
133 (rnd(30) >= dex_compute()))) { 133 (rnd(30) >= dex_compute()))) {
134 if (levtype != POSTLEV) 134 if (levtype != POSTLEV)
135 wanderer(); 135 wanderer();
136 kill_daemon(rollwand); 136 kill_daemon(rollwand);
137 fuse(swander, 0, WANDERTIME, BEFORE); 137 fuse(swander, NULL, WANDERTIME, BEFORE);
138 } 138 }
139 between = 0; 139 between = 0;
140 } 140 }
141 } 141 }
142 /* 142 /*
661 int time; 661 int time;
662 662
663 time = SPELLTIME - max(17-pstats.s_intel, 0); 663 time = SPELLTIME - max(17-pstats.s_intel, 0);
664 time = max(time, 5); 664 time = max(time, 5);
665 if (spell_power > 0) spell_power--; 665 if (spell_power > 0) spell_power--;
666 fuse(spell_recovery, 0, time, AFTER); 666 fuse(spell_recovery, NULL, time, AFTER);
667 } 667 }
668 /* 668 /*
669 * give the hero back some prayer points 669 * give the hero back some prayer points
670 */ 670 */
671 void 671 void
674 int time; 674 int time;
675 675
676 time = SPELLTIME - max(17-pstats.s_wisdom, 0); 676 time = SPELLTIME - max(17-pstats.s_wisdom, 0);
677 time = max(time, 5); 677 time = max(time, 5);
678 if (pray_time > 0) pray_time--; 678 if (pray_time > 0) pray_time--;
679 fuse(prayer_recovery, 0, time, AFTER); 679 fuse(prayer_recovery, NULL, time, AFTER);
680 } 680 }
681 /* 681 /*
682 * give the hero back some chant points 682 * give the hero back some chant points
683 */ 683 */
684 void 684 void
687 int time; 687 int time;
688 688
689 time = SPELLTIME - max(17-pstats.s_wisdom, 0); 689 time = SPELLTIME - max(17-pstats.s_wisdom, 0);
690 time = max(time, 5); 690 time = max(time, 5);
691 if (chant_time > 0) chant_time--; 691 if (chant_time > 0) chant_time--;
692 fuse(chant_recovery, 0, time, AFTER); 692 fuse(chant_recovery, NULL, time, AFTER);
693 } 693 }