Moved more globals to instance_globals.

This commit is contained in:
Bart House
2018-11-24 02:13:54 -08:00
parent 471224ea70
commit 40b682ecf6
37 changed files with 987 additions and 869 deletions

View File

@@ -19,27 +19,6 @@
/* add b to long a, convert wraparound to max value */
#define nowrap_add(a, b) (a = ((a + b) < 0 ? LONG_MAX : (a + b)))
/* these probably ought to be generated by makedefs, like LAST_GEM */
#define FIRST_GEM DILITHIUM_CRYSTAL
#define FIRST_AMULET AMULET_OF_ESP
#define LAST_AMULET AMULET_OF_YENDOR
struct valuable_data {
long count;
int typ;
};
static struct valuable_data
gems[LAST_GEM + 1 - FIRST_GEM + 1], /* 1 extra for glass */
amulets[LAST_AMULET + 1 - FIRST_AMULET];
static struct val_list {
struct valuable_data *list;
int size;
} valuables[] = { { gems, sizeof gems / sizeof *gems },
{ amulets, sizeof amulets / sizeof *amulets },
{ 0, 0 } };
#ifndef NO_SIGNAL
STATIC_PTR void FDECL(done_intr, (int));
#if defined(UNIX) || defined(VMS) || defined(__EMX__)
@@ -909,18 +888,18 @@ struct obj *list; /* inventory or container contents */
continue;
} else if (obj->oclass == AMULET_CLASS) {
i = obj->otyp - FIRST_AMULET;
if (!amulets[i].count) {
amulets[i].count = obj->quan;
amulets[i].typ = obj->otyp;
if (!g.amulets[i].count) {
g.amulets[i].count = obj->quan;
g.amulets[i].typ = obj->otyp;
} else
amulets[i].count += obj->quan; /* always adds one */
g.amulets[i].count += obj->quan; /* always adds one */
} else if (obj->oclass == GEM_CLASS && obj->otyp < LUCKSTONE) {
i = min(obj->otyp, LAST_GEM + 1) - FIRST_GEM;
if (!gems[i].count) {
gems[i].count = obj->quan;
gems[i].typ = obj->otyp;
if (!g.gems[i].count) {
g.gems[i].count = obj->quan;
g.gems[i].typ = obj->otyp;
} else
gems[i].count += obj->quan;
g.gems[i].count += obj->quan;
}
return;
}
@@ -1407,14 +1386,14 @@ int how;
register struct val_list *val;
register int i;
for (val = valuables; val->list; val++)
for (val = g.valuables; val->list; val++)
for (i = 0; i < val->size; i++) {
val->list[i].count = 0L;
}
get_valuables(invent);
/* add points for collected valuables */
for (val = valuables; val->list; val++)
for (val = g.valuables; val->list; val++)
for (i = 0; i < val->size; i++)
if (val->list[i].count != 0L) {
tmp = val->list[i].count
@@ -1465,7 +1444,7 @@ int how;
#endif
/* list valuables here */
for (val = valuables; val->list; val++) {
for (val = g.valuables; val->list; val++) {
sort_valuables(val->list, val->size);
for (i = 0; i < val->size && !done_stopprint; i++) {
int typ = val->list[i].typ;