projects
/
open-adventure.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d3578c9
)
Further infiltrare semantic types.
takebird
author
Eric S. Raymond
<esr@thyrsus.com>
Wed, 5 Jul 2017 20:55:16 +0000
(16:55 -0400)
committer
Eric S. Raymond
<esr@thyrsus.com>
Wed, 5 Jul 2017 20:55:16 +0000
(16:55 -0400)
advent.h
patch
|
blob
|
history
misc.c
patch
|
blob
|
history
diff --git
a/advent.h
b/advent.h
index 470e79ff5879d1a369dd30e308cf6f06a9d29789..34f44157eb575251d93821857c671ef713680a86 100644
(file)
--- a/
advent.h
+++ b/
advent.h
@@
-116,6
+116,8
@@
enum phase_codes {
typedef long token_t; // word token - someday this will be char[TOKLEN+1]
typedef long vocab_t; // index into a vocabulary array */
typedef long token_t; // word token - someday this will be char[TOKLEN+1]
typedef long vocab_t; // index into a vocabulary array */
+typedef long obj_t; // index into the object array */
+typedef long loc_t; // index into the locations array */
struct game_t {
unsigned long lcg_a, lcg_c, lcg_m, lcg_x;
struct game_t {
unsigned long lcg_a, lcg_c, lcg_m, lcg_x;
@@
-167,11
+169,11
@@
struct game_t {
long abbrev[NLOCATIONS + 1];
long atloc[NLOCATIONS + 1];
long dseen[NDWARVES + 1]; // true if dwarf has seen him
long abbrev[NLOCATIONS + 1];
long atloc[NLOCATIONS + 1];
long dseen[NDWARVES + 1]; // true if dwarf has seen him
- lo
ng
dloc[NDWARVES + 1]; // location of dwarves, initially hard-wired in
- lo
ng
odloc[NDWARVES + 1]; // prior loc of each dwarf, initially garbage
- lo
ng
fixed[NOBJECTS + 1];
+ lo
c_t
dloc[NDWARVES + 1]; // location of dwarves, initially hard-wired in
+ lo
c_t
odloc[NDWARVES + 1]; // prior loc of each dwarf, initially garbage
+ lo
c_t
fixed[NOBJECTS + 1];
long link[NOBJECTS * 2 + 1];
long link[NOBJECTS * 2 + 1];
- lo
ng
place[NOBJECTS + 1];
+ lo
c_t
place[NOBJECTS + 1];
long hinted[NHINTS]; // hintlc[i] is how long he's been at LOC with cond bit i
long hintlc[NHINTS]; // hinted[i] is true iff hint i has been used.
long prop[NOBJECTS + 1];
long hinted[NHINTS]; // hintlc[i] is how long he's been at LOC with cond bit i
long hintlc[NHINTS]; // hinted[i] is true iff hint i has been used.
long prop[NOBJECTS + 1];
@@
-222,12
+224,12
@@
extern int get_object_vocab_id(const char*);
extern int get_action_vocab_id(const char*);
extern int get_special_vocab_id(const char*);
extern long get_vocab_id(const char*);
extern int get_action_vocab_id(const char*);
extern int get_special_vocab_id(const char*);
extern long get_vocab_id(const char*);
-extern void juggle(
long
);
-extern void move(
long, long
);
-extern long put(
long
, long, long);
-extern void carry(
long, long
);
-extern void drop(
long, long
);
-extern long atdwrf(lo
ng
);
+extern void juggle(
obj_t
);
+extern void move(
obj_t, loc_t
);
+extern long put(
obj_t
, long, long);
+extern void carry(
obj_t, loc_t
);
+extern void drop(
obj_t, loc_t
);
+extern long atdwrf(lo
c_t
);
extern long setbit(long);
extern bool tstbit(long, int);
extern void make_zzword(char*);
extern long setbit(long);
extern bool tstbit(long, int);
extern void make_zzword(char*);
@@
-242,7
+244,7
@@
extern int resume(void);
extern int restore(FILE *);
extern long initialise(void);
extern int action(struct command_t *command);
extern int restore(FILE *);
extern long initialise(void);
extern int action(struct command_t *command);
-extern void state_change(
long obj, long state
);
+extern void state_change(
obj_t, long
);
void bug(enum bugtype, const char *) __attribute__((__noreturn__));
void bug(enum bugtype, const char *) __attribute__((__noreturn__));
diff --git
a/misc.c
b/misc.c
index c219cfb059ec4b1f38570e208f1c7e498fd7fe45..be2599098d70d5398e12934485ab982299e8b87d 100644
(file)
--- a/
misc.c
+++ b/
misc.c
@@
-535,11
+535,11
@@
long get_vocab_id(const char* word)
return (WORD_NOT_FOUND);
}
return (WORD_NOT_FOUND);
}
-void juggle(
long
object)
+void juggle(
obj_t
object)
/* Juggle an object by picking it up and putting it down again, the purpose
* being to get the object to the front of the chain of things at its loc. */
{
/* Juggle an object by picking it up and putting it down again, the purpose
* being to get the object to the front of the chain of things at its loc. */
{
- lo
ng
i, j;
+ lo
c_t
i, j;
i = game.place[object];
j = game.fixed[object];
i = game.place[object];
j = game.fixed[object];
@@
-547,7
+547,7
@@
void juggle(long object)
move(object + NOBJECTS, j);
}
move(object + NOBJECTS, j);
}
-void move(
long object, long
where)
+void move(
obj_t object, loc_t
where)
/* Place any object anywhere by picking it up and dropping it. May
* already be toting, in which case the carry is a no-op. Mustn't
* pick up objects which are not at any loc, since carry wants to
/* Place any object anywhere by picking it up and dropping it. May
* already be toting, in which case the carry is a no-op. Mustn't
* pick up objects which are not at any loc, since carry wants to
@@
-564,15
+564,15
@@
void move(long object, long where)
drop(object, where);
}
drop(object, where);
}
-long put(
long object, long
where, long pval)
-/*
PUT is the same as MOVE
, except it returns a value used to set up the
+long put(
obj_t object, loc_t
where, long pval)
+/*
put() is the same as move()
, except it returns a value used to set up the
* negated game.prop values for the repository objects. */
{
move(object, where);
* negated game.prop values for the repository objects. */
{
move(object, where);
- return
(-1) - pval;
;
+ return
STASHED(pval)
;
}
}
-void carry(
long object, long
where)
+void carry(
obj_t object, loc_t
where)
/* Start toting an object, removing it from the list of things at its former
* location. Incr holdng unless it was already being toted. If object>NOBJECTS
* (moving "fixed" second loc), don't change game.place or game.holdng. */
/* Start toting an object, removing it from the list of things at its former
* location. Incr holdng unless it was already being toted. If object>NOBJECTS
* (moving "fixed" second loc), don't change game.place or game.holdng. */
@@
-596,7
+596,7
@@
void carry(long object, long where)
game.link[temp] = game.link[object];
}
game.link[temp] = game.link[object];
}
-void drop(
long object, long
where)
+void drop(
obj_t object, loc_t
where)
/* Place an object at a given loc, prefixing it onto the game.atloc list. Decr
* game.holdng if the object was being toted. */
{
/* Place an object at a given loc, prefixing it onto the game.atloc list. Decr
* game.holdng if the object was being toted. */
{
@@
-613,7
+613,7
@@
void drop(long object, long where)
game.atloc[where] = object;
}
game.atloc[where] = object;
}
-long atdwrf(lo
ng
where)
+long atdwrf(lo
c_t
where)
/* Return the index of first dwarf at the given location, zero if no dwarf is
* there (or if dwarves not active yet), -1 if all dwarves are dead. Ignore
* the pirate (6th dwarf). */
/* Return the index of first dwarf at the given location, zero if no dwarf is
* there (or if dwarves not active yet), -1 if all dwarves are dead. Ignore
* the pirate (6th dwarf). */
@@
-690,9
+690,11
@@
void bug(enum bugtype num, const char *error_string)
/* end */
/* end */
-void state_change(
long
obj, long state)
+void state_change(
obj_t
obj, long state)
/* Object must have a change-message list for this to be useful; only some do */
{
game.prop[obj] = state;
pspeak(obj, change, state, true);
/* Object must have a change-message list for this to be useful; only some do */
{
game.prop[obj] = state;
pspeak(obj, change, state, true);
-}
\ No newline at end of file
+}
+
+/* end */