comparison xrogue/effects.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 7c1cb43f346e
children
comparison
equal deleted inserted replaced
237:2236ef808bcb 238:e1cd27c5464f
321 if (on(*att, CANCHILL)) { 321 if (on(*att, CANCHILL)) {
322 if (!ISWEARING(R_SUSABILITY) && !save(VS_POISON, def, 0)) { 322 if (!ISWEARING(R_SUSABILITY) && !save(VS_POISON, def, 0)) {
323 msg("You cringe at %s's chilling touch.", 323 msg("You cringe at %s's chilling touch.",
324 prname(attname, FALSE)); 324 prname(attname, FALSE));
325 chg_str(-1); 325 chg_str(-1);
326 if (lost_str++ == 0) 326 if (lost_str++ == 0) {
327 fuse(res_strength, NULL, CHILLTIME, AFTER); 327 int temp_arg = 0;
328 fuse(res_strength, &temp_arg, CHILLTIME, AFTER);
329 }
328 else lengthen(res_strength, CHILLTIME); 330 else lengthen(res_strength, CHILLTIME);
329 } 331 }
330 } 332 }
331 333
332 /* 334 /*
546 msg("You smell an unpleasant odor. Phew!"); 548 msg("You smell an unpleasant odor. Phew!");
547 } 549 }
548 550
549 else { 551 else {
550 int odor_str = -(rnd(6)+1); 552 int odor_str = -(rnd(6)+1);
553 int temp_arg2 = 0;
551 554
552 msg("You are overcome by a foul odor!"); 555 msg("You are overcome by a foul odor!");
553 if (lost_str == 0) { 556 if (lost_str == 0) {
554 chg_str(odor_str); 557 chg_str(odor_str);
555 fuse(res_strength, NULL, SMELLTIME, AFTER); 558 fuse(res_strength, &temp_arg2, SMELLTIME, AFTER);
556 lost_str -= odor_str; 559 lost_str -= odor_str;
557 } 560 }
558 else lengthen(res_strength, SMELLTIME); 561 else lengthen(res_strength, SMELLTIME);
559 } 562 }
560 } 563 }