Replace magic MINTRS/MAXTRS with a treasure attribute in YAML.

This commit is contained in:
Eric S. Raymond 2017-06-24 10:42:23 -04:00
parent 25077d0b4e
commit c3a2816821
7 changed files with 43 additions and 107 deletions

8
main.c
View file

@ -289,7 +289,9 @@ static bool spotted_by_pirate(int i)
return true;
int snarfed = 0;
bool movechest = false, robplayer = false;
for (int treasure = MINTRS; treasure <= MAXTRS; treasure++) {
for (int treasure = 1; treasure <= NOBJECTS; treasure++) {
if (!object_descriptions[treasure].is_treasure)
continue;
/* Pirate won't take pyramid from plover room or dark
* room (too easy!). */
if (treasure == PYRAMID && (game.loc == PLAC[PYRAMID] || game.loc == PLAC[EMERALD])) {
@ -323,7 +325,9 @@ static bool spotted_by_pirate(int i)
}
if (robplayer) {
rspeak(PIRATE_POUNCES);
for (int treasure = MINTRS; treasure <= MAXTRS; treasure++) {
for (int treasure = 1; treasure <= NOBJECTS; treasure++) {
if (!object_descriptions[treasure].is_treasure)
continue;
if (!(treasure == PYRAMID && (game.loc == PLAC[PYRAMID] || game.loc == PLAC[EMERALD]))) {
if (AT(treasure) && game.fixed[treasure] == 0)
CARRY(treasure, game.loc);