Skip to content

Commit a28fd7d

Browse files
committed
Update due to code revision
1 parent 07d03b9 commit a28fd7d

File tree

4 files changed

+26
-24
lines changed

4 files changed

+26
-24
lines changed

Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,33 +1112,34 @@ void MixedReadMaterialString(CScriptArgReader& argStream, CClientMaterial*& pMat
11121112
//
11131113
// Check 4x4 lua table
11141114
//
1115-
bool IsValidMatrixLuaTable(lua_State* luaVM, uint uiArgIndex)
1115+
bool IsValidMatrixLuaTable(lua_State* luaVM, std::uint32_t argIndex) noexcept
11161116
{
1117-
uint uiRow = 0;
1118-
uint uiCell = 0;
1117+
std::uint32_t cell = 0;
11191118

1120-
if (lua_type(luaVM, uiArgIndex) == LUA_TTABLE)
1119+
if (lua_type(luaVM, argIndex) == LUA_TTABLE)
11211120
{
1122-
for (lua_pushnil(luaVM); lua_next(luaVM, uiArgIndex) != 0; lua_pop(luaVM, 1), uiRow++)
1121+
lua_pushnil(luaVM);
1122+
for (std::uint32_t row = 0; lua_next(luaVM, argIndex) != 0; lua_pop(luaVM, 1), ++row)
11231123
{
11241124
if (lua_type(luaVM, -1) != LUA_TTABLE)
11251125
return false;
11261126

1127-
uint uiCol = 0;
1127+
std::uint32_t col = 0;
11281128

1129-
for (lua_pushnil(luaVM); lua_next(luaVM, -2) != 0; lua_pop(luaVM, 1), uiCol++, uiCell++)
1129+
lua_pushnil(luaVM);
1130+
for (; lua_next(luaVM, -2) != 0; lua_pop(luaVM, 1), ++col, ++cell)
11301131
{
1131-
int iArgumentType = lua_type(luaVM, -1);
1132-
if (iArgumentType != LUA_TNUMBER && iArgumentType != LUA_TSTRING)
1132+
int argumentType = lua_type(luaVM, -1);
1133+
if (argumentType != LUA_TNUMBER && argumentType != LUA_TSTRING)
11331134
return false;
11341135
}
11351136

1136-
if (uiCol != 4)
1137+
if (col != 4)
11371138
return false;
11381139
}
11391140
}
11401141

1141-
if (uiRow != 4 || uiCell != 16)
1142+
if (cell != 16)
11421143
return false;
11431144

11441145
return true;

Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ class CScriptArgReader;
584584
void MixedReadDxFontString(CScriptArgReader& argStream, eFontType& outFontType, eFontType defaultFontType, CClientDxFont*& poutDxFontElement);
585585
void MixedReadGuiFontString(CScriptArgReader& argStream, SString& strFontName, const char* szDefaultFontName, CClientGuiFont*& poutGuiFontElement);
586586
void MixedReadMaterialString(CScriptArgReader& argStream, CClientMaterial*& pMaterialElement);
587-
bool IsValidMatrixLuaTable(lua_State* luaVM, uint uiArgIndex);
587+
bool IsValidMatrixLuaTable(lua_State* luaVM, std::uint32_t argIndex) noexcept;
588588
bool ReadMatrix(lua_State* luaVM, uint uiArgIndex, CMatrix& outMatrix);
589589
void MinClientReqCheck(lua_State* luaVM, const char* szVersionReq, const char* szReason);
590590
bool MinClientReqCheck(CScriptArgReader& argStream, const char* szVersionReq, const char* szReason = nullptr);

Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -649,33 +649,34 @@ void ReadPregFlags(CScriptArgReader& argStream, pcrecpp::RE_Options& pOptions)
649649
//
650650
// Check 4x4 lua table
651651
//
652-
bool IsValidMatrixLuaTable(lua_State* luaVM, uint uiArgIndex)
652+
bool IsValidMatrixLuaTable(lua_State* luaVM, std::uint32_t argIndex) noexcept
653653
{
654-
uint uiRow = 0;
655-
uint uiCell = 0;
654+
std::uint32_t cell = 0;
656655

657-
if (lua_type(luaVM, uiArgIndex) == LUA_TTABLE)
656+
if (lua_type(luaVM, argIndex) == LUA_TTABLE)
658657
{
659-
for (lua_pushnil(luaVM); lua_next(luaVM, uiArgIndex) != 0; lua_pop(luaVM, 1), uiRow++)
658+
lua_pushnil(luaVM);
659+
for (std::uint32_t row = 0; lua_next(luaVM, argIndex) != 0; lua_pop(luaVM, 1), ++row)
660660
{
661661
if (lua_type(luaVM, -1) != LUA_TTABLE)
662662
return false;
663663

664-
uint uiCol = 0;
664+
std::uint32_t col = 0;
665665

666-
for (lua_pushnil(luaVM); lua_next(luaVM, -2) != 0; lua_pop(luaVM, 1), uiCol++, uiCell++)
666+
lua_pushnil(luaVM);
667+
for (; lua_next(luaVM, -2) != 0; lua_pop(luaVM, 1), ++col, ++cell)
667668
{
668-
int iArgumentType = lua_type(luaVM, -1);
669-
if (iArgumentType != LUA_TNUMBER && iArgumentType != LUA_TSTRING)
669+
int argumentType = lua_type(luaVM, -1);
670+
if (argumentType != LUA_TNUMBER && argumentType != LUA_TSTRING)
670671
return false;
671672
}
672673

673-
if (uiCol != 4)
674+
if (col != 4)
674675
return false;
675676
}
676677
}
677678

678-
if (uiRow != 4 || uiCell != 16)
679+
if (cell != 16)
679680
return false;
680681

681682
return true;

Server/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ void MixedReadResourceString(CScriptArgReader& argStream, CResource*& pOutRes
390390
bool StringToBool(const SString& strText);
391391
void MinServerReqCheck(CScriptArgReader& argStream, const char* szVersionReq, const char* szReason);
392392
void ReadPregFlags(CScriptArgReader& argStream, pcrecpp::RE_Options& pOptions);
393-
bool IsValidMatrixLuaTable(lua_State* luaVM, uint uiArgIndex);
393+
bool IsValidMatrixLuaTable(lua_State* luaVM, std::uint32_t argIndex) noexcept;
394394
bool ReadMatrix(lua_State* luaVM, uint uiArgIndex, CMatrix& outMatrix);
395395

396396
//

0 commit comments

Comments
 (0)