Bite the bullet - size siymbols have to be shared.
Otherwise we end up duplicating magic sizes and tey can drift apart.
This commit is contained in:
parent
7f4cff1188
commit
461575ef4c
5 changed files with 24 additions and 12 deletions
16
Makefile
16
Makefile
|
@ -11,7 +11,7 @@ ifeq ($(UNAME_S),Linux)
|
|||
endif
|
||||
|
||||
OBJS=main.o init.o actions1.o actions2.o score.o misc.o
|
||||
SOURCES=$(OBJS:.o=.c) compile.c advent.h funcs.h adventure.text Makefile control
|
||||
SOURCES=$(OBJS:.o=.c) compile.c advent.h funcs.h sizes.h adventure.text Makefile control
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CCFLAGS) $(DBX) -c $<
|
||||
|
@ -19,19 +19,19 @@ SOURCES=$(OBJS:.o=.c) compile.c advent.h funcs.h adventure.text Makefile control
|
|||
advent: $(OBJS) database.o
|
||||
$(CC) $(CCFLAGS) $(DBX) -o advent $(OBJS) database.o $(LDFLAGS) $(LIBS)
|
||||
|
||||
main.o: advent.h funcs.h database.h
|
||||
main.o: advent.h funcs.h database.h sizes.h
|
||||
|
||||
init.o: advent.h funcs.h database.h
|
||||
init.o: advent.h funcs.h database.h sizes.h
|
||||
|
||||
actions1.o: advent.h funcs.h database.h
|
||||
actions1.o: advent.h funcs.h database.h sizes.h
|
||||
|
||||
actions2.o: advent.h funcs.h database.h
|
||||
actions2.o: advent.h funcs.h database.h sizes.h
|
||||
|
||||
score.o: advent.h database.h
|
||||
score.o: advent.h database.h sizes.h
|
||||
|
||||
misc.o: advent.h database.h
|
||||
misc.o: advent.h database.h sizes.h
|
||||
|
||||
database.o: database.h
|
||||
database.o: database.h sizes.h
|
||||
|
||||
compile: compile.c
|
||||
$(CC) $(CCFLAGS) -o $@ $<
|
||||
|
|
4
advent.h
4
advent.h
|
@ -1,6 +1,8 @@
|
|||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "sizes.h"
|
||||
|
||||
#define LINESIZE 100
|
||||
#define NDWARVES 6
|
||||
#define PIRATE NDWARVES /* must be NDWARVES-1 when zero-origin */
|
||||
|
@ -51,7 +53,7 @@ struct game_t {
|
|||
long turns;
|
||||
long wzdark;
|
||||
long zzword;
|
||||
long abbrev[185+1]; /* FIXME: LOCSIZE in the compiler */
|
||||
long abbrev[LOCSIZ+1];
|
||||
long dseen[NDWARVES+1];
|
||||
long dloc[NDWARVES+1];
|
||||
long odloc[NDWARVES+1];
|
||||
|
|
11
compile.c
11
compile.c
|
@ -1,7 +1,13 @@
|
|||
/*
|
||||
* The dungeon compiler. Turns adventure.text into a set of C initializers
|
||||
* defining (mostly) invariant state. A couple of slots are messed with
|
||||
* at runtime.
|
||||
*/
|
||||
#include "sizes.h"
|
||||
|
||||
#define LINESIZE 100
|
||||
#define RTXSIZ 277
|
||||
#define CLSMAX 12
|
||||
#define LOCSIZ 185
|
||||
#define LINSIZ 12600
|
||||
#define TRNSIZ 5
|
||||
#define TABSIZ 330
|
||||
|
@ -548,10 +554,9 @@ void write_hints(FILE* c_file, FILE* header_file, long matrix[][HINTLEN], long d
|
|||
void write_files(FILE* c_file, FILE* header_file)
|
||||
{
|
||||
// preprocessor defines for the header
|
||||
fprintf(header_file, "#define NOBJECTS %d\n", NOBJECTS);
|
||||
fprintf(header_file, "#include \"sizes.h\"\n");
|
||||
fprintf(header_file, "#define RTXSIZ 277\n");
|
||||
fprintf(header_file, "#define CLSMAX 12\n");
|
||||
fprintf(header_file, "#define LOCSIZ 185\n");
|
||||
fprintf(header_file, "#define LINSIZ %d\n", LINSIZ);
|
||||
fprintf(header_file, "#define TRNSIZ 5\n");
|
||||
fprintf(header_file, "#define TABSIZ 330\n");
|
||||
|
|
1
init.c
1
init.c
|
@ -33,6 +33,7 @@
|
|||
/* Note:
|
||||
* - the object count limit has been abstracted as NOBJECTS
|
||||
* - the random message limit has been abstracted as RTXSIZE
|
||||
* - maximum locations limit has been abstracted as LOCSIZ
|
||||
*/
|
||||
|
||||
/* Description of the database format
|
||||
|
|
4
sizes.h
Normal file
4
sizes.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
/* maximum size limits shared by dungeon compiler and runtime */
|
||||
|
||||
#define LOCSIZ 185
|
||||
#define NOBJECTS 100
|
Loading…
Add table
Add a link
Reference in a new issue