From 8b14519fa5b5aca8fea43bef5b68944d49a927a9 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sun, 6 Apr 2025 18:04:52 -0500 Subject: [PATCH] Fix funny message: can't give to dead pcs because 'no item slot' --- src/game/boe.dlgutil.cpp | 3 +++ src/game/boe.items.cpp | 4 ++++ src/universe/pc.cpp | 2 +- src/universe/pc.hpp | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/game/boe.dlgutil.cpp b/src/game/boe.dlgutil.cpp index ba79fa9e..26c17e17 100644 --- a/src/game/boe.dlgutil.cpp +++ b/src/game/boe.dlgutil.cpp @@ -334,6 +334,9 @@ void handle_sale(int i) { else if(base_item.variety == eItemType::QUEST) ASB("You already completed this."); else ASB("You own too many of this."); break; + // This should not happen: + case eBuyStatus::DEAD: + break; } break; case eShopItemType::ALCHEMY: diff --git a/src/game/boe.items.cpp b/src/game/boe.items.cpp index 9c77230c..bbf0b3c9 100644 --- a/src/game/boe.items.cpp +++ b/src/game/boe.items.cpp @@ -967,6 +967,10 @@ short select_pc(eSelectPC mode, std::string title, eSkill highlight_highest, boo extra_info = "no item slot"; can_pick = false; break; + case eBuyStatus::DEAD: + // Extra info not really needed, and kind of silly to print + can_pick = false; + break; default: break; } diff --git a/src/universe/pc.cpp b/src/universe/pc.cpp index fc273b81..3bd86faa 100644 --- a/src/universe/pc.cpp +++ b/src/universe/pc.cpp @@ -442,7 +442,7 @@ void cPlayer::sort_items() { eBuyStatus cPlayer::give_item(cItem item, int flags) { if(main_status != eMainStatus::ALIVE) - return eBuyStatus::NO_SPACE; + return eBuyStatus::DEAD; bool do_print = flags & GIVE_DO_PRINT; bool allow_overload = flags & GIVE_ALLOW_OVERLOAD; diff --git a/src/universe/pc.hpp b/src/universe/pc.hpp index f6fe7ad5..881ad597 100644 --- a/src/universe/pc.hpp +++ b/src/universe/pc.hpp @@ -29,7 +29,7 @@ namespace legacy { struct pc_record_type; }; static struct no_party_t {} no_party; // This enum is now also used in the context of giving items -enum class eBuyStatus {OK, NO_SPACE, NEED_GOLD, TOO_HEAVY, HAVE_LOTS}; +enum class eBuyStatus {OK, NO_SPACE, NEED_GOLD, TOO_HEAVY, HAVE_LOTS, DEAD}; enum ePartyPreset {PARTY_BLANK, PARTY_DEFAULT, PARTY_DEBUG};