projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add -s option.
[open-adventure.git]
/
main.c
diff --git
a/main.c
b/main.c
index afba467763931e4e8e2d9a73ddceb7e10d1afa8c..a74aa6b2b44ca76b811910f1ecaca8e029b82bb6 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-5,12
+5,13
@@
* is a result of running the original Fortran IV source through a
* home-brew Fortran-to-C converter.)
*
* is a result of running the original Fortran IV source through a
* home-brew Fortran-to-C converter.)
*
- * Now that the code has been restructured into
idiomatic C, the following
- * is more appropriate:
+ * Now that the code has been restructured into
something much closer
+ *
to idiomatic C, the following
is more appropriate:
*
*
- * ESR apologizes for the remaing gotos (now confined to two functions in this
- * file - they used to be *everywhere*), and the offensive globals. Applying
- * the Structured Program Theorem can be hard.
+ * ESR apologizes for the remaing gotos (now confined to two functions
+ * in this file - there used to be hundreds of them, *everywhere*),
+ * and the offensive globals. Applying the Structured Program Theorem
+ * can be hard.
*/
#include <stdlib.h>
#include <stdio.h>
*/
#include <stdlib.h>
#include <stdio.h>
@@
-43,6
+44,8
@@
long WD1, WD1X, WD2, WD2X;
FILE *logfp;
bool oldstyle = false;
FILE *logfp;
bool oldstyle = false;
+bool editline = true;
+bool prompt = true;
lcg_state lcgstate;
extern void initialise();
lcg_state lcgstate;
extern void initialise();
@@
-77,9
+80,9
@@
int main(int argc, char *argv[])
/* Options. */
/* Options. */
- while ((ch = getopt(argc, argv, "l:o")) != EOF) {
+ while ((ch = getopt(argc, argv, "l:o
s
")) != EOF) {
switch (ch) {
switch (ch) {
-case 'l':
+
case 'l':
logfp = fopen(optarg, "w");
if (logfp == NULL)
fprintf(stderr,
logfp = fopen(optarg, "w");
if (logfp == NULL)
fprintf(stderr,
@@
-89,6
+92,10
@@
case 'l':
break;
case 'o':
oldstyle = true;
break;
case 'o':
oldstyle = true;
+ editline = prompt = false;
+ break;
+ case 's':
+ editline = false;
break;
}
}
break;
}
}
@@
-1068,30
+1075,30
@@
static bool do_command(FILE *cmdin)
Laction:
switch (action(cmdin, part, VERB, obj)) {
Laction:
switch (action(cmdin, part, VERB, obj)) {
- case
2
:
+ case
GO_TERMINATE
:
return true;
return true;
- case
8
:
+ case
GO_MOVE
:
playermove(cmdin, VERB, NUL);
return true;
playermove(cmdin, VERB, NUL);
return true;
- case
2000: continue;
/* back to top of main interpreter loop */
- case
2012
: goto L2012;
- case
2600
: goto L2600;
- case
2607
: goto L2607;
- case
2630
: goto L2630;
- case
2800
:
+ case
GO_TOP: continue;
/* back to top of main interpreter loop */
+ case
GO_CLEAROBJ
: goto L2012;
+ case
GO_CHECKHINT
: goto L2600;
+ case
GO_CHECKFOO
: goto L2607;
+ case
GO_LOOKUP
: goto L2630;
+ case
GO_WORD2
:
/* Get second word for analysis. */
WD1=WD2;
WD1X=WD2X;
WD2=0;
goto L2620;
/* Get second word for analysis. */
WD1=WD2;
WD1X=WD2X;
WD2=0;
goto L2620;
- case
8000
:
+ case
GO_UNKNOWN
:
/* Random intransitive verbs come here. Clear obj just in case
* (see attack()). */
SETPRM(1,WD1,WD1X);
RSPEAK(257);
obj=0;
goto L2600;
/* Random intransitive verbs come here. Clear obj just in case
* (see attack()). */
SETPRM(1,WD1,WD1X);
RSPEAK(257);
obj=0;
goto L2600;
- case
19000
:
+ case
GO_DWARFWAKE
:
/* Oh dear, he's disturbed the dwarves. */
RSPEAK(136);
score(0);
/* Oh dear, he's disturbed the dwarves. */
RSPEAK(136);
score(0);