Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update unknown fluid and improve the subtype selection #108

Merged
merged 3 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 50 additions & 45 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 All @@ -443,40 +443,42 @@ std::string Item::LiquidID2Name(uint8_t id) {
return "None";
case LIQUID_WATER:
return "Water";
case LIQUID_BLOOD:
return "Blood";
case LIQUID_WINE:
return "Wine";
case LIQUID_BEER:
return "Beer";
case LIQUID_MUD:
return "Mud";
case LIQUID_BLOOD:
return "Blood";
case LIQUID_SLIME:
return "Slime";
case LIQUID_LEMONADE:
return "Lemonade";
case LIQUID_OIL:
return "Oil";
case LIQUID_URINE:
return "Urine";
case LIQUID_MILK:
return "Milk";
case LIQUID_MANAFLUID:
return "Manafluid";
case LIQUID_LIFEFLUID:
return "Lifefluid";
case LIQUID_OIL:
return "Oil";
case LIQUID_URINE:
return "Urine";
case LIQUID_COCONUT_MILK:
return "Coconut Milk";
case LIQUID_WINE:
return "Wine";
case LIQUID_MUD:
return "Mud";
case LIQUID_FRUIT_JUICE:
return "Fruit Juice";
case LIQUID_LEMONADE:
return "Lemonade";
case LIQUID_RUM:
return "Rum";
case LIQUID_INK:
return "Ink";
case LIQUID_TEA:
return "Tea";
case LIQUID_FRUIT_JUICE:
return "Fruit Juice";
case LIQUID_COCONUT_MILK:
return "Coconut Milk";
case LIQUID_MEAD:
return "Mead";
case LIQUID_TEA:
return "Tea";
case LIQUID_INK:
return "Ink";
case LIQUID_CANDY:
return "Candyfluid";
case LIQUID_CHOCOLATE:
return "Chocolate";
default:
Expand All @@ -492,17 +494,26 @@ uint8_t Item::LiquidName2ID(std::string liquid) {
if (liquid == "water") {
return LIQUID_WATER;
}
if (liquid == "blood") {
return LIQUID_BLOOD;
if (liquid == "wine") {
return LIQUID_WINE;
}
if (liquid == "beer") {
return LIQUID_BEER;
}
if (liquid == "mud") {
return LIQUID_MUD;
}
if (liquid == "blood") {
return LIQUID_BLOOD;
}
if (liquid == "slime") {
return LIQUID_SLIME;
}
if (liquid == "lemonade") {
return LIQUID_LEMONADE;
if (liquid == "oil") {
return LIQUID_OIL;
}
if (liquid == "urine") {
return LIQUID_URINE;
}
if (liquid == "milk") {
return LIQUID_MILK;
Expand All @@ -513,40 +524,34 @@ uint8_t Item::LiquidName2ID(std::string liquid) {
if (liquid == "lifefluid") {
return LIQUID_LIFEFLUID;
}
if (liquid == "oil") {
return LIQUID_OIL;
}
if (liquid == "urine") {
return LIQUID_URINE;
}
if (liquid == "coconut milk") {
return LIQUID_COCONUT_MILK;
}
if (liquid == "wine") {
return LIQUID_WINE;
if (liquid == "lemonade") {
return LIQUID_LEMONADE;
}
if (liquid == "mud") {
return LIQUID_MUD;
if (liquid == "rum") {
return LIQUID_RUM;
}
if (liquid == "fruit juice") {
return LIQUID_FRUIT_JUICE;
}
if (liquid == "rum") {
return LIQUID_RUM;
if (liquid == "coconut milk") {
return LIQUID_COCONUT_MILK;
}
if (liquid == "ink") {
return LIQUID_INK;
if (liquid == "mead") {
return LIQUID_MEAD;
}
if (liquid == "tea") {
return LIQUID_TEA;
}
if (liquid == "mead") {
return LIQUID_MEAD;
if (liquid == "ink") {
return LIQUID_INK;
}
if (liquid == "candyfluid") {
return LIQUID_CANDY;
}
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
Loading