Exclude [CS] mods when calculating enabled count for warning

This commit is contained in:
Agent X 2023-12-17 20:33:37 -05:00
parent 522d2fbb71
commit 631dcdcfb3
3 changed files with 14 additions and 1 deletions

View file

@ -74,7 +74,7 @@ static void djui_mod_checkbox_on_hover_end(UNUSED struct DjuiBase* base) {
static void djui_mod_checkbox_on_value_change(UNUSED struct DjuiBase* base) {
mods_update_selectable();
if (mods_get_enabled_count() >= 10) {
if (mods_get_enabled_count() - mods_get_character_select_count() >= 10) {
if (!sWarned) {
sWarned = true;
djui_popup_create(DLANG(HOST_MODS, WARNING), 3);

View file

@ -49,6 +49,18 @@ u16 mods_get_enabled_count(void) {
return enabled;
}
u16 mods_get_character_select_count(void) {
u16 enabled = 0;
for (u16 i = 0; i < gLocalMods.entryCount; i++) {
struct Mod* mod = gLocalMods.entries[i];
if (!mod->enabled || strcmp(mod->name, "[CS]")) { continue; }
enabled++;
}
return enabled;
}
u8 mods_has_autoexec_mod(void) {
for (u16 i = 0; i < gLocalMods.entryCount; i++) {
if (mod_get_is_autoexec(gLocalMods.entries[i])) { return TRUE; }

View file

@ -24,6 +24,7 @@ extern char gRemoteModsBasePath[];
void mods_get_main_mod_name(char* destination, u32 maxSize);
u16 mods_get_enabled_count(void);
u16 mods_get_character_select_count(void);
u8 mods_has_autoexec_mod(void);
bool mods_generate_remote_base_path(void);
void mods_activate(struct Mods* mods);