From: <gi...@cr...> - 2025-07-17 19:20:15
|
via 3f22ea3c6ad96d816a3d4ae7410ef3f1d9fabc5f (commit) via b23e77fdfe48ef81b6b208c3c3091cec09514759 (commit) via 83b025070fae1e1cf7b1c0dd02bfbbc1c876ff86 (commit) from 2aa8828f32cc0e6f1aafcf435c2fb752a8f2e421 (commit) ----------------------------------------------------------------------- commit 3f22ea3c6ad96d816a3d4ae7410ef3f1d9fabc5f Author: DracoOmega <dra...@gm...> Date: Thu Jul 17 16:47:48 2025 -0230 Don't remap consumables with no default binding upon identifying (coraxio) They would automatically move to 'the first available letter' upon being identified, instead of just staying put. (This only applies to !moonshine using default settings, but players can always edit/remove those defaults.) commit b23e77fdfe48ef81b6b208c3c3091cec09514759 Author: DracoOmega <dra...@gm...> Date: Thu Jul 17 16:45:33 2025 -0230 Don't announce consumable remapping that happens at game start commit 83b025070fae1e1cf7b1c0dd02bfbbc1c876ff86 Author: DracoOmega <dra...@gm...> Date: Thu Jul 17 16:45:12 2025 -0230 Fix new characters never generating with more than one consumable type (Whichever was defined last was what they would end up with.) ----------------------------------------------------------------------- Summary of changes: crawl-ref/source/items.cc | 9 ++++++--- crawl-ref/source/ng-setup.cc | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 4e1a11c330..84e2f42df0 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -2148,7 +2148,7 @@ static bool _merge_wand_charges(const item_def &it, int &inv_slot, bool quiet) } // Returns the preferred letter for a given consumable item. -static int _letter_for_consumable(item_def& item) +static int _letter_for_consumable(item_def& item, bool first_pickup) { // If this is an identified item, first check the consumable_slot option to // see any default assignment and use this. @@ -2177,6 +2177,9 @@ static int _letter_for_consumable(item_def& item) return key; } + if (!first_pickup) + return item.slot; + // If there wasn't any, or this is unidentified, try to pick any available // letter that isn't 'reserved' by the consumable_slot option for this // sub-category of item. @@ -2260,7 +2263,7 @@ static int _assign_inventory_letter(item_def& item) if (inventory_category_for(item) == INVENT_GEAR) return index_to_letter(item.link); else - return _letter_for_consumable(item); + return _letter_for_consumable(item, true); } /** @@ -2283,7 +2286,7 @@ item_def *auto_assign_item_slot(item_def& item, bool quiet) if (inventory_category_for(item) == INVENT_CONSUMABLE) { const short old_slot = item.slot; - item.slot = _letter_for_consumable(item); + item.slot = _letter_for_consumable(item, false); if (item.slot != old_slot && !quiet) mprf_nocap("%c -> %s", old_slot, item.name(DESC_INVENTORY).c_str()); diff --git a/crawl-ref/source/ng-setup.cc b/crawl-ref/source/ng-setup.cc index 5452a0f8b6..80e4c950a1 100644 --- a/crawl-ref/source/ng-setup.cc +++ b/crawl-ref/source/ng-setup.cc @@ -110,7 +110,7 @@ item_def* newgame_make_item(object_class_type base, inventory_category category = inventory_category_for(base); int slot; int start = category == INVENT_CONSUMABLE ? MAX_GEAR : 0; - int end = category == INVENT_GEAR ? MAX_GEAR : 0; + int end = category == INVENT_GEAR ? MAX_GEAR : ENDOFPACK; for (slot = start; slot < end; ++slot) { item_def& item = you.inv[slot]; @@ -601,7 +601,7 @@ static void _setup_generic(const newgame_def& ng, if (!item.props.exists("adjusted")) { item.props["adjusted"] = true; - auto_assign_item_slot(item); + auto_assign_item_slot(item, true); } } -- Dungeon Crawl Stone Soup |