mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-07 03:17:22 -04:00
Horrible C++ template nightmares (fix clang-tidy warning about int conversions with ranges)
This commit is contained in:
@@ -129,4 +129,6 @@ private:
|
||||
void initOverlayFiles();
|
||||
};
|
||||
|
||||
using ModIndex = std::ranges::range_difference_t<decltype(std::declval<ModLoader>().mods())>;
|
||||
|
||||
} // namespace dusk
|
||||
|
||||
@@ -59,7 +59,7 @@ ModsWindow::ModsWindow() {
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < mods.size(); ++i) {
|
||||
for (ModIndex i = 0; i < mods.size(); ++i) {
|
||||
mSnapshot.push_back({mods[i].active, mods[i].load_failed});
|
||||
|
||||
add_tab(mods[i].metadata.name, [this, i](Rml::Element* content) {
|
||||
@@ -95,7 +95,7 @@ void ModsWindow::update() {
|
||||
|
||||
bool dirty = mods.size() != mSnapshot.size();
|
||||
if (!dirty) {
|
||||
for (size_t i = 0; i < mods.size(); ++i) {
|
||||
for (ModIndex i = 0; i < mods.size(); ++i) {
|
||||
if (mods[i].active != mSnapshot[i].active ||
|
||||
mods[i].load_failed != mSnapshot[i].load_failed)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "dusk/mod_loader.hpp"
|
||||
|
||||
namespace dusk::ui {
|
||||
|
||||
class ModsWindow : public Window {
|
||||
@@ -17,7 +19,7 @@ private:
|
||||
bool load_failed;
|
||||
};
|
||||
std::vector<ModSnapshot> mSnapshot;
|
||||
int mActiveModIndex = 0;
|
||||
ModIndex mActiveModIndex = 0;
|
||||
};
|
||||
|
||||
} // namespace dusk::ui
|
||||
|
||||
Reference in New Issue
Block a user