Surround BeginTable() calls and table-related draw code in if(){} blocks to fix resize crash. (#4700)

This commit is contained in:
Malkierian 2024-12-16 12:09:25 -07:00 committed by GitHub
parent 2a3bdca8a2
commit e1a53a77d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -884,7 +884,7 @@ void PlandomizerDrawIceTrapSetup(uint32_t index) {
}
void PlandomizerDrawOptions() {
ImGui::BeginTable("LoadSpoiler", 2);
if (ImGui::BeginTable("LoadSpoiler", 2)) {
ImGui::TableNextColumn();
ImGui::SeparatorText("Load/Save Spoiler Log");
PlandomizerPopulateSeedList();
@ -902,7 +902,8 @@ void PlandomizerDrawOptions() {
}
ImGui::EndCombo();
}
} else {
}
else {
ImGui::Text("No Spoiler Logs found.");
}
ImGui::BeginDisabled(existingSeedList.empty());
@ -922,7 +923,7 @@ void PlandomizerDrawOptions() {
ImGui::SeparatorText("Current Seed Hash");
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + (ImGui::GetContentRegionAvail().x * 0.5f) - (34.0f * 5.0f));
if (spoilerLogData.size() > 0) {
ImGui::BeginTable("HashIcons", 5);
if (ImGui::BeginTable("HashIcons", 5)) {
for (int i = 0; i < 5; i++) {
ImGui::TableSetupColumn("Icon", ImGuiTableColumnFlags_WidthFixed, 34.0f);
}
@ -937,7 +938,8 @@ void PlandomizerDrawOptions() {
ImVec2(35.0f, 18.0f), ImVec2(1, 1), ImVec2(0, 0), 2.0f, ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) {
if (hash + 1 >= gSeedTextures.size()) {
hash = 0;
} else {
}
else {
hash++;
}
}
@ -946,7 +948,8 @@ void PlandomizerDrawOptions() {
ImVec2(35.0f, 18.0f), ImVec2(0, 0), ImVec2(1, 1), 2.0f, ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1))) {
if (hash == 0) {
hash = gSeedTextures.size() - 1;
} else {
}
else {
hash--;
}
}
@ -958,10 +961,13 @@ void PlandomizerDrawOptions() {
}
PlandoPopImageButtonStyle();
ImGui::EndTable();
} else {
}
}
else {
ImGui::Text("No Spoiler Log Loaded");
}
ImGui::EndTable();
}
ImGui::SeparatorText("Options");
if (plandoLogData.size() == 0) {
@ -1019,7 +1025,7 @@ void PlandomizerDrawHintsWindow() {
std::string hintInputText;
ImGui::BeginChild("Hints");
ImGui::BeginTable("Hints Window", 1, ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_ScrollY);
if (ImGui::BeginTable("Hints Window", 1, ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_ScrollY)) {
ImGui::TableSetupColumn("Hint Entries");
ImGui::TableSetupScrollFreeze(0, 1);
ImGui::TableHeadersRow();
@ -1052,13 +1058,14 @@ void PlandomizerDrawHintsWindow() {
}
ImGui::EndTable();
}
ImGui::EndChild();
}
void PlandomizerDrawLocationsWindow(RandomizerCheckArea rcArea) {
uint32_t index = 0;
ImGui::BeginChild("Locations");
ImGui::BeginTable("Locations Window", 4, ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_ScrollY);
if (ImGui::BeginTable("Locations Window", 4, ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_ScrollY)) {
ImGui::TableSetupColumn("Spoiler Log Check Name", ImGuiTableColumnFlags_WidthFixed, 250.0f);
ImGui::TableSetupColumn("Spoiler Log Reward", ImGuiTableColumnFlags_WidthFixed, 190.0f);
ImGui::TableSetupColumn("New Reward", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoHeaderLabel, 34.0f);
@ -1079,7 +1086,8 @@ void PlandomizerDrawLocationsWindow(RandomizerCheckArea rcArea) {
if (plandoLogData[index].checkRewardItem.GetRandomizerGet() == RG_ICE_TRAP) {
ImGui::TableNextColumn();
PlandomizerDrawIceTrapSetup(index);
} else if (spoilerData.shopPrice != -1) {
}
else if (spoilerData.shopPrice != -1) {
ImGui::TableNextColumn();
ImGui::BeginTable("Shops", 1, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersInner);
ImGui::TableSetupColumn("Shop Price");
@ -1087,13 +1095,15 @@ void PlandomizerDrawLocationsWindow(RandomizerCheckArea rcArea) {
ImGui::TableNextColumn();
PlandomizerDrawShopSlider(index);
ImGui::EndTable();
} else {
}
else {
ImGui::TableNextColumn();
}
}
index++;
}
ImGui::EndTable();
}
ImGui::EndChild();
}