Small cleanup

This commit is contained in:
Pepe20129 2025-01-27 21:33:41 +01:00
parent 6277194c48
commit ea4340cab5
2 changed files with 38 additions and 29 deletions

View File

@ -65,7 +65,7 @@ std::vector<AltTrapType> getEnabledAddTraps () {
};
static void RollRandomTrap(uint32_t seed) {
uint32_t finalSeed = seed + (IS_RANDO ? Rando::Context::GetInstance()->GetSettings()->GetSeed() : gSaveContext.ship.stats.fileCreatedAt);
uint32_t finalSeed = seed + (IS_RANDO ? Rando::Context::GetInstance()->GetSeed() : gSaveContext.ship.stats.fileCreatedAt);
Random_Init(finalSeed);
roll = RandomElement(getEnabledAddTraps());

View File

@ -117,9 +117,44 @@ void AfterModChange() {
}
void DrawModInfo(std::string file) {
ImGui::SameLine();
ImGui::Text(file.c_str());
}
void DrawEnabledMods() {
std::vector<std::string> enabledMods = GetEnabledModFiles();
if (enabledMods.empty()) {
ImGui::Text("<None>");
return;
}
for (std::string file : enabledMods) {
if (ImGui::ArrowButton(file.c_str(), ImGuiDir_Left)) {
modFiles[file] = false;
GetArchiveManager()->RemoveArchive(file);
AfterModChange();
}
DrawModInfo(file);
}
}
void DrawDisabledMods() {
std::vector<std::string> disabledMods = GetDisabledModFiles();
if (disabledMods.empty()) {
ImGui::Text("<None>");
return;
}
for (std::string file : disabledMods) {
if (ImGui::ArrowButton(file.c_str(), ImGuiDir_Right)) {
modFiles[file] = true;
GetArchiveManager()->AddArchive(file);
AfterModChange();
}
DrawModInfo(file);
}
}
void ModMenuWindow::DrawElement() {
if (ImGui::Button("Update")) {
UpdateModFiles();
@ -136,20 +171,7 @@ void ModMenuWindow::DrawElement() {
ImGui::TableNextColumn();
if (ImGui::BeginChild("Disabled Mods", ImVec2(0, -8))) {
std::vector<std::string> disabledMods = GetDisabledModFiles();
if (!disabledMods.empty()) {
for (std::string file : disabledMods) {
if (ImGui::ArrowButton(file.c_str(), ImGuiDir_Right)) {
modFiles[file] = true;
GetArchiveManager()->AddArchive(file);
AfterModChange();
}
ImGui::SameLine();
DrawModInfo(file);
}
} else {
ImGui::Text("<None>");
}
DrawDisabledMods();
ImGui::EndChild();
}
@ -157,20 +179,7 @@ void ModMenuWindow::DrawElement() {
ImGui::TableNextColumn();
if (ImGui::BeginChild("Enabled Mods", ImVec2(0, -8))) {
std::vector<std::string> enabledMods = GetEnabledModFiles();
if (!enabledMods.empty()) {
for (std::string file : enabledMods) {
if (ImGui::ArrowButton(file.c_str(), ImGuiDir_Left)) {
modFiles[file] = false;
GetArchiveManager()->RemoveArchive(file);
AfterModChange();
}
ImGui::SameLine();
DrawModInfo(file);
}
} else {
ImGui::Text("<None>");
}
DrawEnabledMods();
ImGui::EndChild();
}