From 09d0394aba0b90e95be97d191b63a5b7bb1f153b Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Wed, 3 Jul 2024 19:43:08 -0400 Subject: [PATCH] Alleviate the script warning nagging --- autogen/convert_structs.py | 2 +- src/pc/lua/smlua.h | 2 +- src/pc/mods/mod.h | 1 + src/pc/mods/mod_storage.cpp | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/autogen/convert_structs.py b/autogen/convert_structs.py index 99968d7e..9e54575d 100644 --- a/autogen/convert_structs.py +++ b/autogen/convert_structs.py @@ -81,7 +81,7 @@ override_field_mutable = { } override_field_invisible = { - "Mod": [ "files" ], + "Mod": [ "files", "showedScriptWarning" ], "MarioState": [ "visibleToEnemies" ], "NetworkPlayer": [ "gag", "moderator"], "GraphNode": [ "_guard1", "_guard2" ], diff --git a/src/pc/lua/smlua.h b/src/pc/lua/smlua.h index 039a7753..93761200 100644 --- a/src/pc/lua/smlua.h +++ b/src/pc/lua/smlua.h @@ -22,7 +22,7 @@ #define LOG_LUA(...) { if (!gSmLuaSuppressErrors) { printf("[LUA] "), printf(__VA_ARGS__), printf("\n"), smlua_mod_error(), snprintf(gDjuiConsoleTmpBuffer, CONSOLE_MAX_TMP_BUFFER, __VA_ARGS__), sys_swap_backslashes(gDjuiConsoleTmpBuffer), djui_console_message_create(gDjuiConsoleTmpBuffer, CONSOLE_MESSAGE_ERROR); } } #define LOG_LUA_LINE(...) { if (!gSmLuaSuppressErrors) { printf("[LUA] "), printf(__VA_ARGS__), printf("\n"), smlua_mod_error(); snprintf(gDjuiConsoleTmpBuffer, CONSOLE_MAX_TMP_BUFFER, __VA_ARGS__), sys_swap_backslashes(gDjuiConsoleTmpBuffer), djui_console_message_create(gDjuiConsoleTmpBuffer, CONSOLE_MESSAGE_ERROR), smlua_logline(); } } -#define LOG_LUA_LINE_WARNING(...) { smlua_mod_warning(); snprintf(gDjuiConsoleTmpBuffer, CONSOLE_MAX_TMP_BUFFER, __VA_ARGS__), sys_swap_backslashes(gDjuiConsoleTmpBuffer), djui_console_message_create(gDjuiConsoleTmpBuffer, CONSOLE_MESSAGE_WARNING); } +#define LOG_LUA_LINE_WARNING(...) { if (!gLuaActiveMod->showedScriptWarning) { gLuaActiveMod->showedScriptWarning = true; smlua_mod_warning(); snprintf(gDjuiConsoleTmpBuffer, CONSOLE_MAX_TMP_BUFFER, __VA_ARGS__), sys_swap_backslashes(gDjuiConsoleTmpBuffer), djui_console_message_create(gDjuiConsoleTmpBuffer, CONSOLE_MESSAGE_WARNING); } } #ifdef DEVELOPMENT #define LUA_STACK_CHECK_BEGIN() int __LUA_STACK_TOP = lua_gettop(gLuaState) diff --git a/src/pc/mods/mod.h b/src/pc/mods/mod.h index 3340cd5c..7c16979d 100644 --- a/src/pc/mods/mod.h +++ b/src/pc/mods/mod.h @@ -36,6 +36,7 @@ struct Mod { bool renderBehindHud; bool pausable; bool ignoreScriptWarnings; + bool showedScriptWarning; size_t size; u8 customBehaviorIndex; }; diff --git a/src/pc/mods/mod_storage.cpp b/src/pc/mods/mod_storage.cpp index 58309946..b6dc8536 100644 --- a/src/pc/mods/mod_storage.cpp +++ b/src/pc/mods/mod_storage.cpp @@ -16,7 +16,7 @@ extern "C" { #define C_FIELD extern "C" -void strdelete(char* string, const char* substr) { +static void strdelete(char* string, const char* substr) { // i is used to loop through the string u16 i = 0;