Comment cleanup, semantic types, information hiding.

This commit is contained in:
Eric S. Raymond 2017-07-21 07:38:09 -04:00
parent b27f767cc6
commit a3c159660b
5 changed files with 26 additions and 36 deletions

7
main.c
View file

@ -137,6 +137,7 @@ static bool fallback_handler(struct command_t command)
/* fallback handler for commands not handled by FORTRANish parser */
{
long sv;
turn_t turnlimit;
char buf[DIM(command.raw1) + DIM(command.raw2) + 1];
sprintf(buf, "%s %s", command.raw1, command.raw2);
@ -146,8 +147,8 @@ static bool fallback_handler(struct command_t command)
// autogenerated, so don't charge user time for it.
--game.turns;
return true;
} else if (sscanf(buf, "waste %ld", &sv) == 1) {
game.limit -= sv;
} else if (sscanf(buf, "waste %ld", &turnlimit) == 1) {
game.limit -= turnlimit;
printf("Game limit is now %ld\n", game.limit);
return true;
}
@ -670,7 +671,7 @@ static void playermove( int motion)
/* We arrive here on conditional failure.
* Skip to next non-matching destination */
long te_tmp = travel_entry;
int te_tmp = travel_entry;
do {
if (travel[te_tmp].stop)
BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE