changes for msvc warnings

This commit is contained in:
2026-04-09 13:09:26 -04:00
parent a529d5cdce
commit eeefdcf2d9
2 changed files with 36 additions and 26 deletions

View File

@@ -52,15 +52,15 @@ namespace game::resource::xml
element->QueryIntAttribute("TotalFoodItemsEaten", &totalFoodItemsEaten); element->QueryIntAttribute("TotalFoodItemsEaten", &totalFoodItemsEaten);
} }
auto element = root->FirstChildElement("SkillCheck"); auto skillCheckElement = root->FirstChildElement("SkillCheck");
if (!element) element = root->FirstChildElement("Play"); if (!skillCheckElement) skillCheckElement = root->FirstChildElement("Play");
if (element) if (skillCheckElement)
{ {
element->QueryIntAttribute("TotalPlays", &skillCheck.totalPlays); skillCheckElement->QueryIntAttribute("TotalPlays", &skillCheck.totalPlays);
element->QueryIntAttribute("HighScore", &skillCheck.highScore); skillCheckElement->QueryIntAttribute("HighScore", &skillCheck.highScore);
element->QueryIntAttribute("BestCombo", &skillCheck.bestCombo); skillCheckElement->QueryIntAttribute("BestCombo", &skillCheck.bestCombo);
if (auto child = element->FirstChildElement("Grades")) if (auto child = skillCheckElement->FirstChildElement("Grades"))
{ {
for (auto gradeChild = child->FirstChildElement("Grade"); gradeChild; for (auto gradeChild = child->FirstChildElement("Grade"); gradeChild;
gradeChild = gradeChild->NextSiblingElement("Grade")) gradeChild = gradeChild->NextSiblingElement("Grade"))
@@ -72,14 +72,14 @@ namespace game::resource::xml
} }
} }
if (auto element = root->FirstChildElement("Orbit")) if (auto orbitElement = root->FirstChildElement("Orbit"))
{ {
element->QueryIntAttribute("HighScore", &orbit.highScore); orbitElement->QueryIntAttribute("HighScore", &orbit.highScore);
} }
if (auto element = root->FirstChildElement("Inventory")) if (auto inventoryElement = root->FirstChildElement("Inventory"))
{ {
for (auto child = element->FirstChildElement("Item"); child; child = child->NextSiblingElement("Item")) for (auto child = inventoryElement->FirstChildElement("Item"); child; child = child->NextSiblingElement("Item"))
{ {
int id{}; int id{};
int quantity{}; int quantity{};
@@ -90,9 +90,9 @@ namespace game::resource::xml
} }
} }
if (auto element = root->FirstChildElement("Items")) if (auto itemsElement = root->FirstChildElement("Items"))
{ {
for (auto child = element->FirstChildElement("Item"); child; child = child->NextSiblingElement("Item")) for (auto child = itemsElement->FirstChildElement("Item"); child; child = child->NextSiblingElement("Item"))
{ {
Item item{}; Item item{};
child->QueryIntAttribute("ID", &item.id); child->QueryIntAttribute("ID", &item.id);

View File

@@ -19,17 +19,27 @@ namespace game::state::play
if (ImGui::BeginChild("##Cheats")) if (ImGui::BeginChild("##Cheats"))
{ {
auto stage = character.stage + 1; auto stage = character.stage + 1;
auto caloriesMin = 0.0;
auto maxCapacity = character.max_capacity();
auto capacityMin = character.data.capacityMin;
auto capacityMax = character.data.capacityMax;
auto weightMin = character.data.weight;
auto weightMax = character.data.weightMax;
auto digestionRateMin = character.data.digestionRateMin;
auto digestionRateMax = character.data.digestionRateMax;
auto eatSpeedMin = character.data.eatSpeedMin;
auto eatSpeedMax = character.data.eatSpeedMax;
auto weight_update = [&]() { character.queue_idle_animation(); }; auto weight_update = [&]() { character.queue_idle_animation(); };
WIDGET_FX(ImGui::SliderFloat(strings.get(Strings::CheatsCalories).c_str(), &character.calories, 0, WIDGET_FX(ImGui::SliderScalar(strings.get(Strings::CheatsCalories).c_str(), ImGuiDataType_Double,
character.max_capacity(), "%0.0f kcal")); &character.calories, &caloriesMin, &maxCapacity, "%0.0f kcal"));
WIDGET_FX(ImGui::SliderFloat(strings.get(Strings::CheatsCapacity).c_str(), &character.capacity, WIDGET_FX(ImGui::SliderScalar(strings.get(Strings::CheatsCapacity).c_str(), ImGuiDataType_Double,
character.data.capacityMin, character.data.capacityMax, "%0.0f kcal")); &character.capacity, &capacityMin, &capacityMax, "%0.0f kcal"));
if (WIDGET_FX(ImGui::SliderFloat(strings.get(Strings::CheatsWeight).c_str(), &character.weight, if (WIDGET_FX(ImGui::SliderScalar(strings.get(Strings::CheatsWeight).c_str(), ImGuiDataType_Double,
character.data.weight, character.data.weightMax, &character.weight, &weightMin, &weightMax,
strings.get(Strings::CheatsWeightFormat).c_str()))) strings.get(Strings::CheatsWeightFormat).c_str())))
weight_update(); weight_update();
if (WIDGET_FX(ImGui::SliderInt(strings.get(Strings::CheatsStage).c_str(), &stage, 1, if (WIDGET_FX(ImGui::SliderInt(strings.get(Strings::CheatsStage).c_str(), &stage, 1,
@@ -41,12 +51,12 @@ namespace game::state::play
weight_update(); weight_update();
} }
WIDGET_FX(ImGui::SliderFloat(strings.get(Strings::CheatsDigestionRate).c_str(), &character.digestionRate, WIDGET_FX(ImGui::SliderScalar(strings.get(Strings::CheatsDigestionRate).c_str(), ImGuiDataType_Double,
character.data.digestionRateMin, character.data.digestionRateMax, &character.digestionRate, &digestionRateMin, &digestionRateMax,
strings.get(Strings::CheatsDigestionRateFormat).c_str())); strings.get(Strings::CheatsDigestionRateFormat).c_str()));
WIDGET_FX(ImGui::SliderFloat(strings.get(Strings::CheatsEatSpeed).c_str(), &character.eatSpeed, WIDGET_FX(ImGui::SliderScalar(strings.get(Strings::CheatsEatSpeed).c_str(), ImGuiDataType_Double,
character.data.eatSpeedMin, character.data.eatSpeedMax, &character.eatSpeed, &eatSpeedMin, &eatSpeedMax,
strings.get(Strings::CheatsEatSpeedFormat).c_str())); strings.get(Strings::CheatsEatSpeedFormat).c_str()));
if (WIDGET_FX(ImGui::Button(strings.get(Strings::CheatsDigestButton).c_str()))) if (WIDGET_FX(ImGui::Button(strings.get(Strings::CheatsDigestButton).c_str())))
character.digestionProgress = entity::Character::DIGESTION_MAX; character.digestionProgress = entity::Character::DIGESTION_MAX;