Make code clearer; add a macro ROOMDESC for the number of times a room
should be visited for the short description only to be used, and don't increment beenthere[position] beyond this value. From OpenBSD.
This commit is contained in:
parent
a28f4d4751
commit
af3dee978f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: battlestar.c,v 1.10 2000/05/08 07:56:01 mycroft Exp $ */
|
||||
/* $NetBSD: battlestar.c,v 1.11 2000/09/08 17:22:01 jsm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
|
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)battlestar.c 8.2 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: battlestar.c,v 1.10 2000/05/08 07:56:01 mycroft Exp $");
|
||||
__RCSID("$NetBSD: battlestar.c,v 1.11 2000/09/08 17:22:01 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -70,12 +70,16 @@ main(argc, argv)
|
|||
open_score_file();
|
||||
setgid(getgid());
|
||||
|
||||
initialize((argc < 2) ? NULL : (strcmp(argv[1], "-r") ? argv[1]
|
||||
: (argv[2] ? argv[2]
|
||||
: DEFAULT_SAVE_FILE)));
|
||||
if (argc < 2)
|
||||
initialize(NULL);
|
||||
else if (strcmp(argv[1], "-r") == 0)
|
||||
initialize((argc > 2) ? argv[2] : DEFAULT_SAVE_FILE);
|
||||
else
|
||||
initialize(argv[1]);
|
||||
start:
|
||||
news();
|
||||
beenthere[position]++;
|
||||
if (beenthere[position] <= ROOMDESC)
|
||||
beenthere[position]++;
|
||||
if (notes[LAUNCHED])
|
||||
crash(); /* decrements fuel & crash */
|
||||
if (matchlight) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: extern.h,v 1.16 2000/07/23 23:57:23 mycroft Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.17 2000/09/08 17:22:02 jsm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
|
@ -206,6 +206,9 @@
|
|||
#define DUG 5
|
||||
#define NUMOFNOTES 6
|
||||
|
||||
/* Number of times room description shown. */
|
||||
#define ROOMDESC 3
|
||||
|
||||
/* fundamental constants */
|
||||
#define NUMOFROOMS 275
|
||||
#define NUMOFWORDS ((NUMOFOBJECTS + BITS - 1) / BITS)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: room.c,v 1.7 1999/02/10 01:36:50 hubertf Exp $ */
|
||||
/* $NetBSD: room.c,v 1.8 2000/09/08 17:22:02 jsm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)room.c 8.2 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: room.c,v 1.7 1999/02/10 01:36:50 hubertf Exp $");
|
||||
__RCSID("$NetBSD: room.c,v 1.8 2000/09/08 17:22:02 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -52,7 +52,7 @@ writedes()
|
|||
int c;
|
||||
|
||||
printf("\n\t%s\n", location[position].name);
|
||||
if (beenthere[position] < 3) {
|
||||
if (beenthere[position] < ROOMDESC) {
|
||||
compass = NORTH;
|
||||
for (p = location[position].desc; (c = *p++) != 0;)
|
||||
if (c != '-' && c != '*' && c != '+')
|
||||
|
|
Loading…
Reference in New Issue