projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Various cleanups.
[open-adventure.git]
/
main.c
diff --git
a/main.c
b/main.c
index 5cb4a87a939dafec2ac154d1af3b08d7ed6e3d36..916ff0ac6931decc20f4c1298ca8020fd0588bec 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-13,7
+13,7
@@
* and for the offensive globals. Applying the Structured Program
* Theorem can be hard.
*/
* and for the offensive globals. Applying the Structured Program
* Theorem can be hard.
*/
-#define DEFINE_GLOBALS_FROM_INCLUDES
+
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
@@
-29,9
+29,6
@@
struct game_t game;
struct game_t game;
-long LNLENG, LNPOSN;
-char rawbuf[LINESIZE], INLINE[LINESIZE + 1];
-
FILE *logfp = NULL, *rfp = NULL;
bool oldstyle = false;
bool editline = true;
FILE *logfp = NULL, *rfp = NULL;
bool oldstyle = false;
bool editline = true;
@@
-45,7
+42,7
@@
static void sig_handler(int signo)
if (logfp != NULL)
fflush(logfp);
}
if (logfp != NULL)
fflush(logfp);
}
- exit(
0
);
+ exit(
EXIT_FAILURE
);
}
// LCOV_EXCL_STOP
}
// LCOV_EXCL_STOP
@@
-116,7
+113,7
@@
int main(int argc, char *argv[])
#endif
fprintf(stderr,
" -s suppress command editing\n");
#endif
fprintf(stderr,
" -s suppress command editing\n");
- exit(
-1
);
+ exit(
EXIT_FAILURE
);
break;
}
}
break;
}
}
@@
-521,7
+518,7
@@
static void croak(void)
* him, so we need game.oldlc2, which is the last place he was
* safe.) */
* him, so we need game.oldlc2, which is the last place he was
* safe.) */
-static bool playermove(
token_t verb,
int motion)
+static bool playermove( int motion)
{
int scratchloc, travel_entry = tkey[game.loc];
game.newloc = game.loc;
{
int scratchloc, travel_entry = tkey[game.loc];
game.newloc = game.loc;
@@
-609,8
+606,6
@@
static bool playermove(token_t verb, int motion)
spk = UNSURE_FACING;
if (motion == OUTSIDE || motion == INSIDE)
spk = NO_INOUT_HERE;
spk = UNSURE_FACING;
if (motion == OUTSIDE || motion == INSIDE)
spk = NO_INOUT_HERE;
- if (verb == FIND || verb == INVENTORY)
- spk = NEARBY;
if (motion == XYZZY || motion == PLUGH)
spk = NOTHING_HAPPENS;
if (motion == CRAWL)
if (motion == XYZZY || motion == PLUGH)
spk = NOTHING_HAPPENS;
if (motion == CRAWL)
@@
-997,7
+992,7
@@
static bool do_command()
rspeak(TAME_BEAR);
speak(msg);
if (FORCED(game.loc)) {
rspeak(TAME_BEAR);
speak(msg);
if (FORCED(game.loc)) {
- if (playermove(
command.verb, 1
))
+ if (playermove(
HERE
))
return true;
else
continue; /* back to top of main interpreter loop */
return true;
else
continue; /* back to top of main interpreter loop */
@@
-1131,7
+1126,7
@@
Lookup:
kmod = MOD(defn, 1000);
switch (defn / 1000) {
case 0:
kmod = MOD(defn, 1000);
switch (defn / 1000) {
case 0:
- if (playermove(
command.verb,
kmod))
+ if (playermove(kmod))
return true;
else
continue; /* back to top of main interpreter loop */
return true;
else
continue; /* back to top of main interpreter loop */
@@
-1155,7
+1150,7
@@
Laction:
case GO_TERMINATE:
return true;
case GO_MOVE:
case GO_TERMINATE:
return true;
case GO_MOVE:
- playermove(
command.verb,
NUL);
+ playermove(NUL);
return true;
case GO_TOP:
continue; /* back to top of main interpreter loop */
return true;
case GO_TOP:
continue; /* back to top of main interpreter loop */
@@
-1186,7
+1181,6
@@
Laction:
default:
BUG(ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH); // LCOV_EXCL_LINE
}
default:
BUG(ACTION_RETURNED_PHASE_CODE_BEYOND_END_OF_SWITCH); // LCOV_EXCL_LINE
}
- linenoiseFree(input);
}
}
}
}