Added oldstyle option.
This commit is contained in:
parent
f89f63c6d1
commit
935d8b8e68
6 changed files with 18 additions and 2 deletions
3
NEWS
3
NEWS
|
@ -2,3 +2,6 @@
|
||||||
|
|
||||||
Repository head::
|
Repository head::
|
||||||
Forward port of Crowther & Woods's 430-point Adventure 2.5.
|
Forward port of Crowther & Woods's 430-point Adventure 2.5.
|
||||||
|
Added -l option for logging.
|
||||||
|
Added command prompt; -o suppresses this.
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@ on which it originally ran limited filenames to 6 characters.
|
||||||
|
|
||||||
-l:: Log commands to specified file.
|
-l:: Log commands to specified file.
|
||||||
|
|
||||||
|
-o:: Old-style. Restores original interface, no prompt.
|
||||||
|
|
||||||
== ENVIRONMENT VARIABLES ==
|
== ENVIRONMENT VARIABLES ==
|
||||||
ADVENTURE::
|
ADVENTURE::
|
||||||
Path to the text database file describing Colossal Cave.
|
Path to the text database file describing Colossal Cave.
|
||||||
|
|
3
init.c
3
init.c
|
@ -173,7 +173,8 @@ static int finish_init(void);
|
||||||
static void quick_io(void);
|
static void quick_io(void);
|
||||||
|
|
||||||
void initialise(void) {
|
void initialise(void) {
|
||||||
printf("Initialising...\n");
|
if (oldstyle)
|
||||||
|
printf("Initialising...\n");
|
||||||
if(!quick_init()){raw_init(); report(); quick_save();}
|
if(!quick_init()){raw_init(); report(); quick_save();}
|
||||||
finish_init();
|
finish_init();
|
||||||
}
|
}
|
||||||
|
|
6
main.c
6
main.c
|
@ -41,6 +41,7 @@ long ABBNUM, ACTSPK[36], AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BO
|
||||||
VOLCAN, VRBSIZ = 35, VRSION = 25, WATER, WD1, WD1X, WD2, WD2X,
|
VOLCAN, VRBSIZ = 35, VRSION = 25, WATER, WD1, WD1X, WD2, WD2X,
|
||||||
WZDARK = false, ZZWORD;
|
WZDARK = false, ZZWORD;
|
||||||
FILE *logfp;
|
FILE *logfp;
|
||||||
|
bool oldstyle = false;
|
||||||
|
|
||||||
extern void initialise();
|
extern void initialise();
|
||||||
extern void score(long);
|
extern void score(long);
|
||||||
|
@ -63,7 +64,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
/* Options. */
|
/* Options. */
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "l:")) != EOF) {
|
while ((ch = getopt(argc, argv, "l:o")) != EOF) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'l':
|
case 'l':
|
||||||
logfp = fopen(optarg, "w+");
|
logfp = fopen(optarg, "w+");
|
||||||
|
@ -72,6 +73,9 @@ int main(int argc, char *argv[]) {
|
||||||
"advent: can't open logfile %s for write\n",
|
"advent: can't open logfile %s for write\n",
|
||||||
optarg);
|
optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'o':
|
||||||
|
oldstyle = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
main.h
3
main.h
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define LINESIZE 100
|
#define LINESIZE 100
|
||||||
|
|
||||||
extern long ABB[], ATAB[], ATLOC[], BLKLIN, DFLAG, DLOC[], FIXED[], HOLDNG,
|
extern long ABB[], ATAB[], ATLOC[], BLKLIN, DFLAG, DLOC[], FIXED[], HOLDNG,
|
||||||
|
@ -5,3 +7,4 @@ extern long ABB[], ATAB[], ATLOC[], BLKLIN, DFLAG, DLOC[], FIXED[], HOLDNG,
|
||||||
PARMS[], PLACE[], PTEXT[], RTEXT[], TABSIZ;
|
PARMS[], PLACE[], PTEXT[], RTEXT[], TABSIZ;
|
||||||
extern signed char INLINE[LINESIZE+1], MAP1[], MAP2[];
|
extern signed char INLINE[LINESIZE+1], MAP1[], MAP2[];
|
||||||
extern FILE *logfp;
|
extern FILE *logfp;
|
||||||
|
extern bool oldstyle;
|
||||||
|
|
3
misc.c
3
misc.c
|
@ -1,3 +1,4 @@
|
||||||
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
@ -884,6 +885,8 @@ long I, VAL;
|
||||||
|
|
||||||
if(MAP2[1] == 0)MPINIT();
|
if(MAP2[1] == 0)MPINIT();
|
||||||
|
|
||||||
|
if (!oldstyle && isatty(0))
|
||||||
|
fputs("> ", stdout);
|
||||||
IGNORE(fgets(INLINE+1,sizeof(INLINE)-1,OPENED));
|
IGNORE(fgets(INLINE+1,sizeof(INLINE)-1,OPENED));
|
||||||
if (feof(OPENED)) {
|
if (feof(OPENED)) {
|
||||||
if (logfp)
|
if (logfp)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue