Mercurial > hg > early-roguelike
comparison xrogue/fight.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 | e52a8a7ad4c5 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 237:2236ef808bcb | 238:e1cd27c5464f | 
|---|---|
| 964 { | 964 { | 
| 965 register struct thing *tp, *mp; | 965 register struct thing *tp, *mp; | 
| 966 register struct linked_list *pitem, *nexti, *mitem; | 966 register struct linked_list *pitem, *nexti, *mitem; | 
| 967 char *monst; | 967 char *monst; | 
| 968 int adj; /* used for hit point adj. below. */ | 968 int adj; /* used for hit point adj. below. */ | 
| 969 long temp; | |
| 970 | 969 | 
| 971 tp = THINGPTR(item); | 970 tp = THINGPTR(item); | 
| 972 | 971 | 
| 973 if (pr) | 972 if (pr) | 
| 974 { | 973 { | 
| 1027 if (on(*tp, ISUNIQUE)) /* real bad news to kill a diety */ | 1026 if (on(*tp, ISUNIQUE)) /* real bad news to kill a diety */ | 
| 1028 killed_chance += 25; | 1027 killed_chance += 25; | 
| 1029 if (roll(1,100) < killed_chance) { | 1028 if (roll(1,100) < killed_chance) { | 
| 1030 msg("You had a feeling this was going to happen... "); | 1029 msg("You had a feeling this was going to happen... "); | 
| 1031 msg("**POOF** "); | 1030 msg("**POOF** "); | 
| 1032 temp = C_ASSASSIN; /* make him pay */ | 1031 changeclass(C_ASSASSIN); /* make him pay */ | 
| 1033 changeclass(&temp); | |
| 1034 } | 1032 } | 
| 1035 else { | 1033 else { | 
| 1036 switch (rnd(9)) { | 1034 switch (rnd(9)) { | 
| 1037 case 0: | 1035 case 0: | 
| 1038 msg("You become solid and stiff for a while. "); | 1036 msg("You become solid and stiff for a while. "); | 
