Mercurial > hg > early-roguelike
comparison arogue7/monsters.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 | 28e22fb35989 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 237:2236ef808bcb | 238:e1cd27c5464f | 
|---|---|
| 647 if (!save(VS_MAGIC, &player, 0)) { | 647 if (!save(VS_MAGIC, &player, 0)) { | 
| 648 if (off(player, ISCLEAR)) { | 648 if (off(player, ISCLEAR)) { | 
| 649 if (find_slot(unconfuse)) | 649 if (find_slot(unconfuse)) | 
| 650 lengthen(unconfuse, HUHDURATION); | 650 lengthen(unconfuse, HUHDURATION); | 
| 651 else { | 651 else { | 
| 652 fuse(unconfuse, 0, HUHDURATION, AFTER); | 652 fuse(unconfuse, NULL, HUHDURATION, AFTER); | 
| 653 msg("%s's gaze has confused you.",prname(mname, TRUE)); | 653 msg("%s's gaze has confused you.",prname(mname, TRUE)); | 
| 654 turn_on(player, ISHUH); | 654 turn_on(player, ISHUH); | 
| 655 } | 655 } | 
| 656 } | 656 } | 
| 657 else msg("You feel dizzy for a moment, but it quickly passes."); | 657 else msg("You feel dizzy for a moment, but it quickly passes."); | 
| 689 if(on(*tp, CANBLIND) && !find_slot(sight)) { | 689 if(on(*tp, CANBLIND) && !find_slot(sight)) { | 
| 690 turn_off(*tp, CANBLIND); | 690 turn_off(*tp, CANBLIND); | 
| 691 if (!save(VS_WAND, &player, 0)) { | 691 if (!save(VS_WAND, &player, 0)) { | 
| 692 msg("The gaze of %s blinds you", prname(mname, FALSE)); | 692 msg("The gaze of %s blinds you", prname(mname, FALSE)); | 
| 693 turn_on(player, ISBLIND); | 693 turn_on(player, ISBLIND); | 
| 694 fuse(sight, 0, rnd(30)+20, AFTER); | 694 fuse(sight, NULL, rnd(30)+20, AFTER); | 
| 695 light(&hero); | 695 light(&hero); | 
| 696 } | 696 } | 
| 697 } | 697 } | 
| 698 | 698 | 
| 699 /* the sight of the ghost can age you! */ | 699 /* the sight of the ghost can age you! */ | 
