Limited cleanup
This commit is contained in:
parent
37373c5277
commit
898348911f
9 changed files with 87 additions and 91 deletions
2
Makefile
2
Makefile
|
@ -74,7 +74,7 @@ newdb.c newdb.h: newdungeon.py adventure.yaml
|
|||
python3 newdungeon.py
|
||||
|
||||
linenoise.o: linenoise/linenoise.h
|
||||
$(CC) -c linenoise/linenoise.c
|
||||
$(CC) $(CCFLAGS) -c linenoise/linenoise.c
|
||||
|
||||
dungeon: dungeon.o common.o
|
||||
$(CC) $(CCFLAGS) -o $@ dungeon.o common.o
|
||||
|
|
|
@ -14,7 +14,7 @@ static int attack(FILE *input, struct command_t *command)
|
|||
{
|
||||
vocab_t verb = command->verb;
|
||||
vocab_t obj = command->obj;
|
||||
int spk = actions[verb].message;
|
||||
long spk = actions[verb].message;
|
||||
if (obj == 0 || obj == INTRANSITIVE) {
|
||||
if (atdwrf(game.loc) > 0)
|
||||
obj = DWARF;
|
||||
|
@ -1183,7 +1183,7 @@ int action(FILE *input, struct command_t *command)
|
|||
case 15: /* RUB */
|
||||
return rub(command->verb, command->obj);
|
||||
case 16: /* TOSS */
|
||||
return throw(input, command);
|
||||
return throw (input, command);
|
||||
case 17: { /* QUIT */
|
||||
rspeak(spk);
|
||||
return GO_CLEAROBJ;
|
||||
|
|
3
cheat.c
3
cheat.c
|
@ -40,8 +40,7 @@ int main(int argc, char *argv[])
|
|||
game.saved = 1;
|
||||
|
||||
fp = fopen("cheat_numdie.adv", WRITE_MODE);
|
||||
if (fp == NULL)
|
||||
{
|
||||
if (fp == NULL) {
|
||||
printf("Can't open file. Exiting.\n");
|
||||
exit(0);
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ static long GETNUM(FILE *source)
|
|||
* scanned). If we're at the end of the line or encounter an illegal
|
||||
* character (not a digit, hyphen, or blank), we return 0. */
|
||||
|
||||
long DIGIT, GETNUM, sign;
|
||||
long GETNUM, sign;
|
||||
|
||||
if (source != NULL) MAPLIN(source);
|
||||
GETNUM = 0;
|
||||
|
@ -215,7 +215,7 @@ static long GETNUM(FILE *source)
|
|||
LNPOSN = LNPOSN + 1;
|
||||
}
|
||||
while (!(LNPOSN > LNLENG || INLINE[LNPOSN] == 0)) {
|
||||
DIGIT = INLINE[LNPOSN] - 64;
|
||||
long DIGIT = INLINE[LNPOSN] - 64;
|
||||
if (DIGIT < 0 || DIGIT > 9) {
|
||||
GETNUM = 0;
|
||||
break;
|
||||
|
|
8
main.c
8
main.c
|
@ -693,7 +693,7 @@ static bool playermove(token_t verb, int motion)
|
|||
* and block him. (standard travel entries check for
|
||||
* game.prop(TROLL)=0.) Special stuff for bear. */
|
||||
if (game.prop[TROLL] == 1) {
|
||||
pspeak(TROLL,look, 1);
|
||||
pspeak(TROLL, look, 1);
|
||||
game.prop[TROLL] = 0;
|
||||
move(TROLL2, 0);
|
||||
move(TROLL2 + NOBJECTS, 0);
|
||||
|
@ -1029,10 +1029,8 @@ L2607:
|
|||
|
||||
/* If a turn threshold has been met, apply penalties and tell
|
||||
* the player about it. */
|
||||
for (int i = 0; i < NTHRESHOLDS; ++i)
|
||||
{
|
||||
if (game.turns == turn_thresholds[i].threshold + 1)
|
||||
{
|
||||
for (int i = 0; i < NTHRESHOLDS; ++i) {
|
||||
if (game.turns == turn_thresholds[i].threshold + 1) {
|
||||
game.trnluz += turn_thresholds[i].point_loss;
|
||||
speak(turn_thresholds[i].message);
|
||||
}
|
||||
|
|
9
misc.c
9
misc.c
|
@ -44,8 +44,7 @@ void packed_to_token(long packed, char token[6])
|
|||
void token_to_packed(char token[6], long* packed)
|
||||
{
|
||||
*packed = 0;
|
||||
for (size_t i = 0; i < 5; ++i)
|
||||
{
|
||||
for (size_t i = 0; i < 5; ++i) {
|
||||
if (token[4 - i] == '\0')
|
||||
continue;
|
||||
char mapped = ascii_to_advent[(int) token[4 - i]];
|
||||
|
@ -266,7 +265,7 @@ char* get_input()
|
|||
}
|
||||
|
||||
if (input == NULL) // Got EOF; return with it.
|
||||
return(input);
|
||||
return (input);
|
||||
else if (input[0] == '#') // Ignore comments.
|
||||
continue;
|
||||
else // We have a 'normal' line; leave the loop.
|
||||
|
@ -303,7 +302,7 @@ bool yes(const char* question, const char* yes_response, const char* no_response
|
|||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
char* firstword = (char*) xmalloc(strlen(reply)+1);
|
||||
char* firstword = (char*) xmalloc(strlen(reply) + 1);
|
||||
sscanf(reply, "%s", firstword);
|
||||
|
||||
for (int i = 0; i < (int)strlen(firstword); ++i)
|
||||
|
@ -538,7 +537,7 @@ long atdwrf(long where)
|
|||
long setbit(long bit)
|
||||
/* Returns 2**bit for use in constructing bit-masks. */
|
||||
{
|
||||
return (1 << bit);
|
||||
return (1L << bit);
|
||||
}
|
||||
|
||||
bool tstbit(long mask, int bit)
|
||||
|
|
|
@ -28,7 +28,7 @@ struct save_t {
|
|||
struct save_t save;
|
||||
|
||||
int savefile(FILE *fp)
|
||||
/* Save game to file. No input or output from user. */
|
||||
/* Save game to file. No input or output from user. */
|
||||
{
|
||||
long i, k;
|
||||
datime(&i, &k);
|
||||
|
@ -38,7 +38,7 @@ int savefile(FILE *fp)
|
|||
save.version = VRSION;
|
||||
memcpy(&save.game, &game, sizeof(struct game_t));
|
||||
IGNORE(fwrite(&save, sizeof(struct save_t), 1, fp));
|
||||
return(0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Suspend and resume */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue