diff --git a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp index 2695042388..a592503c28 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp +++ b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp @@ -1112,33 +1112,34 @@ void MixedReadMaterialString(CScriptArgReader& argStream, CClientMaterial*& pMat // // Check 4x4 lua table // -bool IsValidMatrixLuaTable(lua_State* luaVM, uint uiArgIndex) +bool IsValidMatrixLuaTable(lua_State* luaVM, std::uint32_t argIndex) noexcept { - uint uiRow = 0; - uint uiCell = 0; + std::uint32_t cell = 0; - if (lua_type(luaVM, uiArgIndex) == LUA_TTABLE) + if (lua_type(luaVM, argIndex) == LUA_TTABLE) { - for (lua_pushnil(luaVM); lua_next(luaVM, uiArgIndex) != 0; lua_pop(luaVM, 1), uiRow++) + lua_pushnil(luaVM); + for (std::uint32_t row = 0; lua_next(luaVM, argIndex) != 0; lua_pop(luaVM, 1), ++row) { if (lua_type(luaVM, -1) != LUA_TTABLE) return false; - uint uiCol = 0; + std::uint32_t col = 0; - for (lua_pushnil(luaVM); lua_next(luaVM, -2) != 0; lua_pop(luaVM, 1), uiCol++, uiCell++) + lua_pushnil(luaVM); + for (; lua_next(luaVM, -2) != 0; lua_pop(luaVM, 1), ++col, ++cell) { - int iArgumentType = lua_type(luaVM, -1); - if (iArgumentType != LUA_TNUMBER && iArgumentType != LUA_TSTRING) + int argumentType = lua_type(luaVM, -1); + if (argumentType != LUA_TNUMBER && argumentType != LUA_TSTRING) return false; } - if (uiCol != 4) + if (col != 4) return false; } } - if (uiRow != 4 || uiCell != 16) + if (cell != 16) return false; return true; diff --git a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h index a08e5a32d5..944f6780d1 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h +++ b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h @@ -584,7 +584,7 @@ class CScriptArgReader; void MixedReadDxFontString(CScriptArgReader& argStream, eFontType& outFontType, eFontType defaultFontType, CClientDxFont*& poutDxFontElement); void MixedReadGuiFontString(CScriptArgReader& argStream, SString& strFontName, const char* szDefaultFontName, CClientGuiFont*& poutGuiFontElement); void MixedReadMaterialString(CScriptArgReader& argStream, CClientMaterial*& pMaterialElement); -bool IsValidMatrixLuaTable(lua_State* luaVM, uint uiArgIndex); +bool IsValidMatrixLuaTable(lua_State* luaVM, std::uint32_t argIndex) noexcept; bool ReadMatrix(lua_State* luaVM, uint uiArgIndex, CMatrix& outMatrix); void MinClientReqCheck(lua_State* luaVM, const char* szVersionReq, const char* szReason); bool MinClientReqCheck(CScriptArgReader& argStream, const char* szVersionReq, const char* szReason = nullptr); diff --git a/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp b/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp index c22f076f7c..27afc8510e 100644 --- a/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp +++ b/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp @@ -649,33 +649,34 @@ void ReadPregFlags(CScriptArgReader& argStream, pcrecpp::RE_Options& pOptions) // // Check 4x4 lua table // -bool IsValidMatrixLuaTable(lua_State* luaVM, uint uiArgIndex) +bool IsValidMatrixLuaTable(lua_State* luaVM, std::uint32_t argIndex) noexcept { - uint uiRow = 0; - uint uiCell = 0; + std::uint32_t cell = 0; - if (lua_type(luaVM, uiArgIndex) == LUA_TTABLE) + if (lua_type(luaVM, argIndex) == LUA_TTABLE) { - for (lua_pushnil(luaVM); lua_next(luaVM, uiArgIndex) != 0; lua_pop(luaVM, 1), uiRow++) + lua_pushnil(luaVM); + for (std::uint32_t row = 0; lua_next(luaVM, argIndex) != 0; lua_pop(luaVM, 1), ++row) { if (lua_type(luaVM, -1) != LUA_TTABLE) return false; - uint uiCol = 0; + std::uint32_t col = 0; - for (lua_pushnil(luaVM); lua_next(luaVM, -2) != 0; lua_pop(luaVM, 1), uiCol++, uiCell++) + lua_pushnil(luaVM); + for (; lua_next(luaVM, -2) != 0; lua_pop(luaVM, 1), ++col, ++cell) { - int iArgumentType = lua_type(luaVM, -1); - if (iArgumentType != LUA_TNUMBER && iArgumentType != LUA_TSTRING) + int argumentType = lua_type(luaVM, -1); + if (argumentType != LUA_TNUMBER && argumentType != LUA_TSTRING) return false; } - if (uiCol != 4) + if (col != 4) return false; } } - if (uiRow != 4 || uiCell != 16) + if (cell != 16) return false; return true; diff --git a/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h b/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h index 5c5aa8a9d0..62d4312c51 100644 --- a/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h +++ b/Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h @@ -390,7 +390,7 @@ void MixedReadResourceString(CScriptArgReader& argStream, CResource*& pOutRes bool StringToBool(const SString& strText); void MinServerReqCheck(CScriptArgReader& argStream, const char* szVersionReq, const char* szReason); void ReadPregFlags(CScriptArgReader& argStream, pcrecpp::RE_Options& pOptions); -bool IsValidMatrixLuaTable(lua_State* luaVM, uint uiArgIndex); +bool IsValidMatrixLuaTable(lua_State* luaVM, std::uint32_t argIndex) noexcept; bool ReadMatrix(lua_State* luaVM, uint uiArgIndex, CMatrix& outMatrix); //