mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-30 23:10:14 -05:00
Small cleanup
This commit is contained in:
parent
6277194c48
commit
ea4340cab5
@ -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());
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user