X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=actions.c;h=1031d8ef19ef1915a1ef7b828a17e3e83e35cc61;hb=bea58f268233184eef62a69fb716a519abee43ca;hp=c9bf2396981601d25999920d2dd64877a4afa282;hpb=37117f20e0e3b45901431bea58f74c74e1fa6870;p=open-adventure.git diff --git a/actions.c b/actions.c index c9bf239..1031d8e 100644 --- a/actions.c +++ b/actions.c @@ -3,6 +3,8 @@ #include "advent.h" #include "database.h" +#define VRSION 25 /* bump on save format change */ + /* * Action handlers. Eventually we'll do lookup through a method table * that calls these. Absolutely nothing like the original FORTRAN. @@ -79,23 +81,24 @@ static int attack(FILE *input, long verb, long obj) * fixed), move rug there (not fixed), and move him there, * too. Then do a null motion to get new description. */ RSPEAK(49); - GETIN(input,WD1,WD1X,WD2,WD2X); - if (WD1 != MAKEWD(25) && WD1 != MAKEWD(250519)) return(2607); + GETIN(input,&WD1,&WD1X,&WD2,&WD2X); + if (WD1 != MAKEWD(25) && WD1 != MAKEWD(250519)) + return(2607); PSPEAK(DRAGON,3); game.prop[DRAGON]=1; game.prop[RUG]=0; - K=(PLAC[DRAGON]+FIXD[DRAGON])/2; + int k=(PLAC[DRAGON]+FIXD[DRAGON])/2; MOVE(DRAGON+NOBJECTS,-1); MOVE(RUG+NOBJECTS,0); - MOVE(DRAGON,K); - MOVE(RUG,K); - DROP(BLOOD,K); + MOVE(DRAGON,k); + MOVE(RUG,k); + DROP(BLOOD,k); for (obj=1; obj<=NOBJECTS; obj++) { - if (game.place[obj] == PLAC[DRAGON] || game.place[obj] == FIXD[DRAGON])MOVE(obj,K); - /*etc*/ ; - } /* end loop */ - game.loc=K; - K=NUL; + if (game.place[obj] == PLAC[DRAGON] || game.place[obj] == FIXD[DRAGON]) + MOVE(obj,k); + } + game.loc=k; + K=NUL; /* FIXME: error if removed */ return(8); } @@ -110,7 +113,6 @@ static int bigwords(long foo) if (game.foobar != 0)SPK=151; return(2011); } else { - game.foobar=k; if (k != 4) return(2009); game.foobar=0; @@ -524,7 +526,7 @@ static int find(token_t obj) { if (AT(obj) || (LIQ(0) == obj && AT(BOTTLE)) || - K == LIQLOC(game.loc) || + obj == LIQLOC(game.loc) || (obj == DWARF && ATDWRF(game.loc) > 0)) SPK=94; if (game.closed)SPK=138; @@ -778,6 +780,7 @@ static int suspendresume(FILE *input, bool resume) /* Suspend and resume */ { int kk; + long i; if (!resume) { /* Suspend. Offer to save things in a file, but charging * some points (so can't win by using saved games to retry @@ -808,8 +811,8 @@ static int suspendresume(FILE *input, bool resume) * for I/O. All the SAV* functions can be scrapped. */ - DATIME(&I,&K); - K=I+650*K; + DATIME(&i,&K); + K=i+650*K; SAVWRD(kk,K); K=VRSION; SAVWRD(0,K); @@ -890,8 +893,8 @@ static int throw(FILE *cmdin, long verb, long obj) } if (obj != AXE) return(discard(obj, false)); - I=ATDWRF(game.loc); - if (I <= 0) { + int i=ATDWRF(game.loc); + if (i <= 0) { if (AT(DRAGON) && game.prop[DRAGON] == 0) { SPK=152; return throw_support(SPK); @@ -920,8 +923,8 @@ static int throw(FILE *cmdin, long verb, long obj) SPK=48; return throw_support(SPK); } - game.dseen[I]=false; - game.dloc[I]=0; + game.dseen[i]=false; + game.dloc[i]=0; SPK=47; game.dkill=game.dkill+1; if (game.dkill == 1)SPK=149;