Skip to content

Commit

Permalink
fix: update fluid and improve unknown selection
Browse files Browse the repository at this point in the history
  • Loading branch information
phacUFPE committed Aug 15, 2024
1 parent 075abd6 commit cf1c860
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
6 changes: 4 additions & 2 deletions source/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -546,7 +548,7 @@ uint8_t Item::LiquidName2ID(std::string liquid) {
if (liquid == "chocolate") {
return LIQUID_CHOCOLATE;
}
return LIQUID_UNKNOWN;
return LIQUID_NONE;
}

// ============================================================================
Expand Down
2 changes: 1 addition & 1 deletion source/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 6 additions & 3 deletions source/old_properties_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
Expand Down

0 comments on commit cf1c860

Please sign in to comment.