comparison arogue7/misc.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 e52a8a7ad4c5
comparison
equal deleted inserted replaced
237:2236ef808bcb 238:e1cd27c5464f
79 extinguish(prayer_recovery); 79 extinguish(prayer_recovery);
80 /* 80 /*
81 * if he becomes a spell caster of some kind, give him a fuse 81 * if he becomes a spell caster of some kind, give him a fuse
82 */ 82 */
83 if (newclass == C_MAGICIAN || newclass == C_RANGER) 83 if (newclass == C_MAGICIAN || newclass == C_RANGER)
84 fuse(spell_recovery, 0, SPELLTIME, AFTER); 84 fuse(spell_recovery, NULL, SPELLTIME, AFTER);
85 if (newclass == C_DRUID || newclass == C_RANGER) 85 if (newclass == C_DRUID || newclass == C_RANGER)
86 fuse(chant_recovery, 0, SPELLTIME, AFTER); 86 fuse(chant_recovery, NULL, SPELLTIME, AFTER);
87 if ((newclass==C_CLERIC || newclass==C_PALADIN) && !cur_misc[HEIL_ANKH]) 87 if ((newclass==C_CLERIC || newclass==C_PALADIN) && !cur_misc[HEIL_ANKH])
88 fuse(prayer_recovery, 0, SPELLTIME, AFTER); 88 fuse(prayer_recovery, NULL, SPELLTIME, AFTER);
89 /* 89 /*
90 * if he's changing from a fighter then may have to change 90 * if he's changing from a fighter then may have to change
91 * his sword since only fighter can use two-handed 91 * his sword since only fighter can use two-handed
92 * and bastard swords 92 * and bastard swords
93 */ 93 */
115 115
116 /* 116 /*
117 * if he becomes a thief then add the trap_look() daemon 117 * if he becomes a thief then add the trap_look() daemon
118 */ 118 */
119 if (newclass == C_THIEF || newclass == C_ASSASIN || newclass == C_MONK) 119 if (newclass == C_THIEF || newclass == C_ASSASIN || newclass == C_MONK)
120 start_daemon(trap_look, 0, AFTER); 120 start_daemon(trap_look, NULL, AFTER);
121 char_type = player.t_ctype = newclass; 121 char_type = player.t_ctype = newclass;
122 save = pstats.s_hpt; 122 save = pstats.s_hpt;
123 max_stats.s_hpt = pstats.s_hpt = 0; 123 max_stats.s_hpt = pstats.s_hpt = 0;
124 max_stats.s_lvl = pstats.s_lvl = 0; 124 max_stats.s_lvl = pstats.s_lvl = 0;
125 max_stats.s_lvladj = pstats.s_lvladj = 0; 125 max_stats.s_lvladj = pstats.s_lvladj = 0;
1023 } 1023 }
1024 obj->o_charges--; 1024 obj->o_charges--;
1025 msg("aaAAACHOOOooo. Cough. Cough. Sneeze. Sneeze."); 1025 msg("aaAAACHOOOooo. Cough. Cough. Sneeze. Sneeze.");
1026 if (!find_slot(dust_appear)) { 1026 if (!find_slot(dust_appear)) {
1027 turn_on(player, ISINVIS); 1027 turn_on(player, ISINVIS);
1028 fuse(dust_appear, 0, DUSTTIME, AFTER); 1028 fuse(dust_appear, NULL, DUSTTIME, AFTER);
1029 PLAYER = IPLAYER; 1029 PLAYER = IPLAYER;
1030 light(&hero); 1030 light(&hero);
1031 } 1031 }
1032 else lengthen(dust_appear, DUSTTIME); 1032 else lengthen(dust_appear, DUSTTIME);
1033 1033
1052 else { 1052 else {
1053 msg("You begin to cough and choke uncontrollably"); 1053 msg("You begin to cough and choke uncontrollably");
1054 if (find_slot(unchoke)) 1054 if (find_slot(unchoke))
1055 lengthen(unchoke, DUSTTIME); 1055 lengthen(unchoke, DUSTTIME);
1056 else 1056 else
1057 fuse(unchoke, 0, DUSTTIME, AFTER); 1057 fuse(unchoke, NULL, DUSTTIME, AFTER);
1058 turn_on(player, ISHUH); 1058 turn_on(player, ISHUH);
1059 turn_on(player, ISBLIND); 1059 turn_on(player, ISBLIND);
1060 light(&hero); 1060 light(&hero);
1061 } 1061 }
1062 1062