Skip to content

Commit 304444a

Browse files
committed
small refactors
1 parent c86dc0a commit 304444a

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/EndLevelLayer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,10 @@ class $modify(MyEndLevelLayer, EndLevelLayer) {
251251
formattedList += modListEntry;
252252
formattedList += '\n';
253253
}
254-
const std::string& formattedTitle = fmt::format("{} Total ({} Loaded, {} Disabled, {} w/Problems)", manager->totalMods, manager->loadedMods, manager->disabledMods, manager->problemMods);
255-
MDPopup::create(formattedTitle, formattedList, "Copy", "Close", [formattedList](const bool btn2){
254+
const std::string& formattedTitle = fmt::format("{} Total ({} Loaded, {} Disabled, of which {} w/Problems)", manager->totalMods, manager->loadedMods, manager->disabledMods, manager->problemMods);
255+
MDPopup::create(formattedTitle, formattedList, "Copy", "Close", [formattedTitle, formattedList](const bool btn2){
256256
if (btn2) return;
257-
geode::utils::clipboard::write(formattedList);
257+
geode::utils::clipboard::write(fmt::format("{}\n{}", formattedTitle, formattedList));
258258
Notification::create("Copied mods list")->show();
259259
})->show();
260260
}

src/MenuLayer.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ class $modify(MyMenuLayer, MenuLayer) {
1414
Manager* manager = managerMacro;
1515
manager->totalMods = mods.size();
1616
std::ranges::for_each(mods, [&](const Mod* mod) {
17-
if (!mod->hasLoadProblems() && mod->isEnabled()) manager->loadedMods += 1;
18-
else manager->problemMods += 1;
19-
20-
if (!mod->isEnabled()) manager->disabledMods += 1;
17+
bool incrementedOnce = false;
18+
if (mod->getAllProblems().empty() && mod->isEnabled()) manager->loadedMods += 1;
19+
else if (!mod->isEnabled() && !mod->hasLoadProblems()) manager->disabledMods += 1;
2120

2221
const std::string& modID = mod->getID();
2322

@@ -40,7 +39,13 @@ class $modify(MyMenuLayer, MenuLayer) {
4039
for (const auto [type, cause, message] : problems) {
4140
if (type == LoadProblem::Type::Suggestion || type == LoadProblem::Type::Recommendation) continue;
4241
std::string colorTag = "<c-FF0000>";
43-
if (type == LoadProblem::Type::Conflict || type == LoadProblem::Type::Duplicate || type == LoadProblem::Type::DisabledDependency || type == LoadProblem::Type::MissingDependency) colorTag = "<cy>";
42+
if (type == LoadProblem::Type::Conflict || type == LoadProblem::Type::Duplicate || type == LoadProblem::Type::DisabledDependency || type == LoadProblem::Type::MissingDependency) {
43+
colorTag = "<cy>";
44+
if (!incrementedOnce) {
45+
manager->problemMods += 1;
46+
incrementedOnce = true;
47+
}
48+
}
4449
else if (type == LoadProblem::Type::UnsupportedVersion || type == LoadProblem::Type::UnsupportedGeodeVersion || type == LoadProblem::Type::NeedsNewerGeodeVersion) colorTag = "<c-DCDCDC>";
4550
formattedProblemsList = formattedProblemsList.append(fmt::format("{}{}</c> | ", colorTag, message));
4651
}

0 commit comments

Comments
 (0)