diff options
author | mycroft <mycroft@NetBSD.org> | 1993-04-20 22:00:26 +0000 |
---|---|---|
committer | mycroft <mycroft@NetBSD.org> | 1993-04-20 22:00:26 +0000 |
commit | 10e9633963797cac6bb94bb2950e7a1fcc25c1d3 (patch) | |
tree | 8c6c0902173e113726e24c7515abccdbc208456b /larn | |
parent | 398e51a3c905d11cf31c42e7bd5cce452bcd5534 (diff) | |
download | bsdgames-darwin-10e9633963797cac6bb94bb2950e7a1fcc25c1d3.tar.gz bsdgames-darwin-10e9633963797cac6bb94bb2950e7a1fcc25c1d3.tar.zst bsdgames-darwin-10e9633963797cac6bb94bb2950e7a1fcc25c1d3.zip |
Don't modify string constants.
Diffstat (limited to 'larn')
-rw-r--r-- | larn/data.c | 137 | ||||
-rw-r--r-- | larn/diag.c | 4 | ||||
-rw-r--r-- | larn/header.h | 7 | ||||
-rw-r--r-- | larn/main.c | 4 | ||||
-rw-r--r-- | larn/object.c | 8 | ||||
-rw-r--r-- | larn/scores.c | 4 |
6 files changed, 86 insertions, 78 deletions
diff --git a/larn/data.c b/larn/data.c index a8739bab..d0f19c28 100644 --- a/larn/data.c +++ b/larn/data.c @@ -295,74 +295,81 @@ struct monst monster[] = { /* name array for scrolls */ -char *scrollname[] = { -"\0enchant armor", -"\0enchant weapon", -"\0enlightenment", -"\0blank paper", -"\0create monster", -"\0create artifact", -"\0aggravate monsters", -"\0time warp", -"\0teleportation", -"\0expanded awareness", -"\0haste monsters", -"\0monster healing", -"\0spirit protection", -"\0undead protection", -"\0stealth", -"\0magic mapping", -"\0hold monsters", -"\0gem perfection", -"\0spell extension", -"\0identify", -"\0remove curse", -"\0annihilation", -"\0pulverization", -"\0life protection", -"\0 ", -"\0 ", -"\0 ", -"\0 " +char *scrollname[] = {"","","","","","","","","","","","","","", + "","","","","","","","","","","","","",""}; + +char *scrollhide[] = { +" enchant armor", +" enchant weapon", +" enlightenment", +" blank paper", +" create monster", +" create artifact", +" aggravate monsters", +" time warp", +" teleportation", +" expanded awareness", +" haste monsters", +" monster healing", +" spirit protection", +" undead protection", +" stealth", +" magic mapping", +" hold monsters", +" gem perfection", +" spell extension", +" identify", +" remove curse", +" annihilation", +" pulverization", +" life protection", +" ", +" ", +" ", +" " }; +char *potionname[] = {"","","","","","","","","","","","","","", + "","","","","","","","","","","","","","", + "","","","","","",""}; + /* name array for magic potions */ -char *potionname[] = { -"\0sleep", -"\0healing", -"\0raise level", -"\0increase ability", -"\0wisdom", -"\0strength", -"\0raise charisma", -"\0dizziness", -"\0learning", -"\0gold detection", -"\0monster detection", -"\0forgetfulness", -"\0water", -"\0blindness", -"\0confusion", -"\0heroism", -"\0sturdiness", -"\0giant strength", -"\0fire resistance", -"\0treasure finding", -"\0instant healing", -" cure dianthroritis", -"\0poison", -"\0see invisible", -"\0 ", -"\0 ", -"\0 ", -"\0 ", -"\0 ", -"\0 ", -"\0 ", -"\0 ", -"\0 ", -"\0 ", -"\0 " +char *potionhide[] = { +" sleep", +" healing", +" raise level", +" increase ability", +" wisdom", +" strength", +" raise charisma", +" dizziness", +" learning", +" gold detection", +" monster detection", +" forgetfulness", +" water", +" blindness", +" confusion", +" heroism", +" sturdiness", +" giant strength", +" fire resistance", +" treasure finding", +" instant healing", +" ure dianthroritis", +" poison", +" see invisible", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" " }; diff --git a/larn/diag.c b/larn/diag.c index 4ed557d1..52daf121 100644 --- a/larn/diag.c +++ b/larn/diag.c @@ -213,8 +213,8 @@ restoregame(fname) level = c[CAVELEVEL] = lgetc(); playerx = lgetc(); playery = lgetc(); lrfill((char*)iven,26); lrfill((char*)ivenarg,26*sizeof(short)); - for (k=0; k<MAXSCROLL; k++) scrollname[k][0] = lgetc(); - for (k=0; k<MAXPOTION; k++) potionname[k][0] = lgetc(); + for (k=0; k<MAXSCROLL; k++) scrollname[k] = lgetc() ? scrollhide[k] : ""; + for (k=0; k<MAXPOTION; k++) potionname[k] = lgetc() ? potionhide[k] : ""; lrfill((char*)spelknow,SPNUM); wizard = lgetc(); rmst = lgetc(); /* random monster creation flag */ diff --git a/larn/header.h b/larn/header.h index ed9a8b6f..f616f248 100644 --- a/larn/header.h +++ b/larn/header.h @@ -334,10 +334,11 @@ extern char item[MAXX][MAXY],iven[],know[MAXX][MAXY],larnlevels[],lastmonst[]; extern char level,*levelname[],logfile[],loginname[],logname[],*lpbuf,*lpend; extern char *lpnt,moved[MAXX][MAXY],mitem[MAXX][MAXY],monstlevel[]; extern char monstnamelist[],nch[],ndgg[],nlpts[],nomove,nosignal,nowelcome; -extern char nplt[],nsw[],*objectname[]; -extern char objnamelist[],optsfile[],*potionname[],playerids[],potprob[]; +extern char nplt[],nsw[],*objectname[],objnamelist[],optsfile[]; +extern char *potionhide[],*potionname[],playerids[],potprob[]; extern char predostuff,psname[],restorflag,savefilename[],scorefile[],scprob[]; -extern char screen[MAXX][MAXY],*scrollname[],sex,*spelcode[],*speldescript[]; +extern char screen[MAXX][MAXY],*scrollhide[],*scrollname[],sex,*spelcode[]; +extern char *speldescript[]; extern char spelknow[],*spelname[],*spelmes[],spelweird[MAXMONST+8][SPNUM]; extern char splev[],stealth[MAXX][MAXY],to_lower[],to_upper[],wizard; extern short diroffx[],diroffy[],hitflag,hit2flag,hit3flag,hitp[MAXX][MAXY]; diff --git a/larn/main.c b/larn/main.c index dbe0c89d..c77f72ca 100644 --- a/larn/main.c +++ b/larn/main.c @@ -578,8 +578,8 @@ parse() for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) know[j][i]=1; for (i=0; i<SPNUM; i++) spelknow[i]=1; - for (i=0; i<MAXSCROLL; i++) scrollname[i][0]=' '; - for (i=0; i<MAXPOTION; i++) potionname[i][0]=' '; + for (i=0; i<MAXSCROLL; i++) scrollname[i]=scrollhide[i]; + for (i=0; i<MAXPOTION; i++) potionname[i]=potionhide[i]; } for (i=0; i<MAXSCROLL; i++) if (strlen(scrollname[i])>2) /* no null items */ diff --git a/larn/object.c b/larn/object.c index 9bf7c3c5..cbe7c60b 100644 --- a/larn/object.c +++ b/larn/object.c @@ -391,7 +391,7 @@ quaffpotion(pot) { register int i,j,k; if (pot<0 || pot>=MAXPOTION) return; /* check for within bounds */ - potionname[pot][0] = ' '; + potionname[pot] = potionhide[pot]; switch(pot) { case 9: lprcat("\nYou feel greedy . . ."); nap(2000); @@ -550,7 +550,7 @@ read_scroll(typ) { register int i,j; if (typ<0 || typ>=MAXSCROLL) return; /* be sure we are within bounds */ - scrollname[typ][0] = ' '; + scrollname[typ] = scrollhide[typ]; switch(typ) { case 0: lprcat("\nYour armor glows for a moment"); enchantarmor(); return; @@ -615,8 +615,8 @@ read_scroll(typ) case 19: for (i=0; i<26; i++) /* identify */ { - if (iven[i]==OPOTION) potionname[ivenarg[i]][0] = ' '; - if (iven[i]==OSCROLL) scrollname[ivenarg[i]][0] = ' '; + if (iven[i]==OPOTION) potionname[ivenarg[i]] = potionhide[ivenarg[i]]; + if (iven[i]==OSCROLL) scrollname[ivenarg[i]] = scrollhide[ivenarg[i]]; } break; diff --git a/larn/scores.c b/larn/scores.c index f6cf15c1..7ffa4b77 100644 --- a/larn/scores.c +++ b/larn/scores.c @@ -290,8 +290,8 @@ showallscores() register int i,j; lflush(); lcreat((char*)0); if (readboard()<0) return; c[WEAR] = c[WIELD] = c[SHIELD] = -1; /* not wielding or wearing anything */ - for (i=0; i<MAXPOTION; i++) potionname[i][0]=' '; - for (i=0; i<MAXSCROLL; i++) scrollname[i][0]=' '; + for (i=0; i<MAXPOTION; i++) potionname[i]=potionhide[i]; + for (i=0; i<MAXSCROLL; i++) scrollname[i]=scrollhide[i]; i=winshou(); j=shou(1); if (i+j==0) lprcat(esb); else lprc('\n'); lflush(); |