{
if (obj == INTRANSITIVE) {
/* Carry, no object given yet. OK if only one object present. */
- if (game.atloc[game.loc] == NO_OBJECT ||
- game.link[game.atloc[game.loc]] != 0 ||
+ if (game.locs[game.loc].atloc == NO_OBJECT ||
+ game.link[game.locs[game.loc].atloc] != 0 ||
atdwrf(game.loc) > 0)
return GO_UNKNOWN;
- obj = game.atloc[game.loc];
+ obj = game.locs[game.loc].atloc;
}
if (TOTING(obj)) {
turn_t trnluz; // # points lost so far due to turns used
turn_t turns; // counts commands given (ignores yes/no)
char zzword[TOKLEN + 1]; // randomly generated magic word from bird
- int abbrev[NLOCATIONS + 1]; // has location been seen?
- int atloc[NLOCATIONS + 1]; // head of object linked list per location
+ struct {
+ int abbrev; // has location been seen?
+ int atloc; // head of object linked list per location
+ } locs[NLOCATIONS + 1];
struct {
int seen; // true if dwarf has seen him
loc_t loc; // location of dwarves, initially hard-wired in
}
}
- /* Set up the game.atloc and game.link arrays.
+ /* Set up the game.locs atloc and game.link arrays.
* We'll use the DROP subroutine, which prefaces new objects on the
* lists. Since we want things in the other order, we'll run the
* loop backwards. If the object is in two locs, we drop it twice.
game.hintlc[hint] = 0;
return;
case 3: /* maze */
- if (game.atloc[game.loc] == NO_OBJECT &&
- game.atloc[game.oldloc] == NO_OBJECT &&
- game.atloc[game.oldlc2] == NO_OBJECT &&
+ if (game.locs[game.loc].atloc == NO_OBJECT &&
+ game.locs[game.oldloc].atloc == NO_OBJECT &&
+ game.locs[game.oldlc2].atloc == NO_OBJECT &&
game.holdng > 1)
break;
game.hintlc[hint] = 0;
game.hintlc[hint] = 0;
return;
case 7: /* woods */
- if (game.atloc[game.loc] == NO_OBJECT &&
- game.atloc[game.oldloc] == NO_OBJECT &&
- game.atloc[game.oldlc2] == NO_OBJECT)
+ if (game.locs[game.loc].atloc == NO_OBJECT &&
+ game.locs[game.oldloc].atloc == NO_OBJECT &&
+ game.locs[game.oldlc2].atloc == NO_OBJECT)
break;
return;
case 8: /* ogre */
{
const char* msg = locations[game.loc].description.small;
- if (MOD(game.abbrev[game.loc], game.abbnum) == 0 || msg == NO_MESSAGE)
+ if (MOD(game.locs[game.loc].abbrev, game.abbnum) == 0 || msg == NO_MESSAGE)
msg = locations[game.loc].description.big;
if (!FORCED(game.loc) && DARK(game.loc)) {
rspeak(NO_MORE_DETAIL);
++game.detail;
game.wzdark = false;
- game.abbrev[game.loc] = 0;
+ game.locs[game.loc].abbrev = 0;
return;
} else if (motion == CAVE) {
/* Cave. Different messages depending on whether above ground. */
* get full score. */
{
if (!DARK(game.loc)) {
- ++game.abbrev[game.loc];
- for (int i = game.atloc[game.loc]; i != 0; i = game.link[i]) {
+ ++game.locs[game.loc].abbrev;
+ for (int i = game.locs[game.loc].atloc; i != 0; i = game.link[i]) {
obj_t obj = i;
if (obj > NOBJECTS)
obj = obj - NOBJECTS;
/* 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
- * remove objects from game.atloc chains. */
+ * remove objects from game atloc chains. */
{
loc_t from;
if (object != BIRD)
++game.holdng;
}
- if (game.atloc[where] == object) {
- game.atloc[where] = game.link[object];
+ if (game.locs[where].atloc == object) {
+ game.locs[where].atloc = game.link[object];
return;
}
- temp = game.atloc[where];
+ temp = game.locs[where].atloc;
while (game.link[temp] != object) {
temp = game.link[temp];
}
}
void drop(obj_t object, loc_t where)
-/* Place an object at a given loc, prefixing it onto the game.atloc list. Decr
+/* Place an object at a given loc, prefixing it onto the game atloc list. Decr
* game.holdng if the object was being toted. No state change on the object. */
{
if (object > NOBJECTS)
}
if (where == LOC_NOWHERE || where == CARRIED)
return;
- game.link[object] = game.atloc[where];
- game.atloc[where] = object;
+ game.link[object] = game.locs[where].atloc;
+ game.locs[where].atloc = object;
}
int atdwrf(loc_t where)
#endif
FILE *fp = NULL;
- if (game.loc != LOC_START || game.abbrev[LOC_START] != 1) {
+ if (game.loc != LOC_START || game.locs[LOC_START].abbrev != 1) {
rspeak(RESUME_ABANDON);
if (!yes_or_no(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
return GO_CLEAROBJ;
/* Check that values in linked lists for objects in locations are inside bounds */
for (loc_t loc = LOC_NOWHERE; loc <= NLOCATIONS; loc++) {
- if (valgame.atloc[loc] < NO_OBJECT || valgame.atloc[loc] > NOBJECTS * 2) {
+ if (valgame.locs[loc].atloc < NO_OBJECT || valgame.locs[loc].atloc > NOBJECTS * 2) {
return false; // LCOV_EXCL_LINE
}
}