From cf1c86026957b42599ac186cb4ff76a7d5b2d4bf Mon Sep 17 00:00:00 2001 From: Pedro Henrique Alves Cruz Date: Thu, 15 Aug 2024 06:28:38 -0300 Subject: [PATCH] fix: update fluid and improve unknown selection --- source/item.cpp | 6 ++++-- source/item.h | 2 +- source/old_properties_window.cpp | 9 ++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/source/item.cpp b/source/item.cpp index bd1fc29a..e4fe1e1d 100644 --- a/source/item.cpp +++ b/source/item.cpp @@ -430,7 +430,7 @@ uint8_t Item::liquidSubTypeToSpriteSubType(uint8_t id) { return 8; case LIQUID_CHOCOLATE: return 9; - case LIQUID_UNKNOWN: + case LIQUID_CANDY: return 10; default: return 0; @@ -477,6 +477,8 @@ std::string Item::LiquidID2Name(uint8_t id) { return "Tea"; case LIQUID_MEAD: return "Mead"; + case LIQUID_CANDY: + return "Candyfluid"; case LIQUID_CHOCOLATE: return "Chocolate"; default: @@ -546,7 +548,7 @@ uint8_t Item::LiquidName2ID(std::string liquid) { if (liquid == "chocolate") { return LIQUID_CHOCOLATE; } - return LIQUID_UNKNOWN; + return LIQUID_NONE; } // ============================================================================ diff --git a/source/item.h b/source/item.h index ca0081da..45b34a5f 100644 --- a/source/item.h +++ b/source/item.h @@ -55,7 +55,7 @@ enum SplashType : uint8_t { LIQUID_MEAD = 16, LIQUID_TEA = 17, LIQUID_INK = 18, - LIQUID_UNKNOWN = 19, + LIQUID_CANDY = 19, LIQUID_CHOCOLATE = 20, LIQUID_FIRST = LIQUID_WATER, diff --git a/source/old_properties_window.cpp b/source/old_properties_window.cpp index 84b7baa2..80bf0f68 100644 --- a/source/old_properties_window.cpp +++ b/source/old_properties_window.cpp @@ -165,10 +165,13 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c subsizer->Add(newd wxStaticText(this, wxID_ANY, "Type")); + const auto liquidNoneName = wxstr(Item::LiquidID2Name(LIQUID_NONE)); + const auto liquidNoneUInt = newd uint8_t(LIQUID_NONE); + // Splash types splash_type_field = newd wxChoice(this, wxID_ANY); if (edit_item->isFluidContainer()) { - splash_type_field->Append(wxstr(Item::LiquidID2Name(LIQUID_NONE)), newd uint8_t(LIQUID_NONE)); + splash_type_field->Append(liquidNoneName, liquidNoneUInt); } for (SplashType splashType = LIQUID_FIRST; splashType <= LIQUID_LAST; ++splashType) { @@ -181,9 +184,9 @@ OldPropertiesWindow::OldPropertiesWindow(wxWindow* win_parent, const Map* map, c if (item->getSubtype()) { const std::string &what = Item::LiquidID2Name(item->getSubtype()); if (what == "Unknown") { - splash_type_field->Append(wxstr(Item::LiquidID2Name(LIQUID_UNKNOWN)), newd uint8_t(LIQUID_UNKNOWN)); + splash_type_field->Append(what, liquidNoneUInt); } - splash_type_field->SetStringSelection(wxstr(what)); + splash_type_field->SetStringSelection(what); } else { splash_type_field->SetSelection(0); }