From b2d044ce6aedba8d101f73d3f8f63292c7c03619 Mon Sep 17 00:00:00 2001 From: "kts of kettek (nyaa)" Date: Tue, 13 Aug 2019 16:46:03 -0700 Subject: [PATCH] Fix bad logic for getting ring image --- common/init.c | 1 + common/treasure.c | 6 ++++-- include/global.h | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/init.c b/common/init.c index 96ae9ad..8f0a19c 100644 --- a/common/init.c +++ b/common/init.c @@ -284,6 +284,7 @@ void init_globals(void) { nrofartifacts = 0; nrofallowedstr = 0; ring_arch = NULL; + earring_arch = NULL; amulet_arch = NULL; staff_arch = NULL; undead_name = add_string("undead"); diff --git a/common/treasure.c b/common/treasure.c index 7c1ff75..894d4ae 100644 --- a/common/treasure.c +++ b/common/treasure.c @@ -69,6 +69,8 @@ void init_archetype_pointers(void) { warn_archetypes = 1; if (ring_arch == NULL) ring_arch = find_archetype("ring"); + if (earring_arch == NULL) + earring_arch = find_archetype("earring"); if (amulet_arch == NULL) amulet_arch = find_archetype("amulet"); if (staff_arch == NULL) @@ -1217,14 +1219,14 @@ void fix_generated_item(object *op, object *creator, int difficulty, int max_mag op = NULL; break; } - if (op->arch != ring_arch && op->arch != amulet_arch) + if (op->arch != earring_arch && op->arch != ring_arch && op->arch != amulet_arch) /* It's a special artifact!*/ break; if (!(flags>_ONLY_GOOD) && !(RANDOM()%3)) SET_FLAG(op, FLAG_CURSED); set_ring_bonus(op, QUERY_FLAG(op, FLAG_CURSED) ? -DICE2 : DICE2); - if (op->type != RING || op->type != EARRING) /* Amulets have only one ability */ + if (op->type == AMULET) /* Amulets have only one ability */ break; if (!(RANDOM()%4)) { int d = (RANDOM()%2 || QUERY_FLAG(op, FLAG_CURSED)) ? -DICE2 : DICE2; diff --git a/include/global.h b/include/global.h index 3996e09..01a9c58 100644 --- a/include/global.h +++ b/include/global.h @@ -235,7 +235,7 @@ EXTERN long ob_count; /* * Used in treasure.c */ -EXTERN archetype *ring_arch, *amulet_arch, *staff_arch, *crown_arch; +EXTERN archetype *ring_arch, *earring_arch, *amulet_arch, *staff_arch, *crown_arch; EXTERN const char *undead_name; /* Used in hit_player() in main.c */ EXTERN Animations *animations;