diff --git a/Client/mods/deathmatch/logic/lua/CLuaManager.cpp b/Client/mods/deathmatch/logic/lua/CLuaManager.cpp index bba8af3686f..78e7dc20a8e 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaManager.cpp +++ b/Client/mods/deathmatch/logic/lua/CLuaManager.cpp @@ -151,7 +151,7 @@ CLuaMain* CLuaManager::GetVirtualMachine(lua_State* luaVM) void CLuaManager::LoadCFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // ** BACKWARDS COMPATIBILITY FUNCS. SHOULD BE REMOVED BEFORE FINAL RELEASE! ** {"getPlayerRotation", CLuaPedDefs::GetPedRotation}, {"canPlayerBeKnockedOffBike", CLuaPedDefs::CanPedBeKnockedOffBike}, @@ -405,10 +405,8 @@ void CLuaManager::LoadCFunctions() }; // Add all functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); // Luadef definitions CLuaAudioDefs::LoadFunctions(); diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp index 4ded68ab3b2..6236312640e 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp @@ -13,7 +13,7 @@ void CLuaAudioDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Audio funcs {"playSoundFrontEnd", PlaySoundFrontEnd}, {"setAmbientSoundEnabled", SetAmbientSoundEnabled}, @@ -65,10 +65,8 @@ void CLuaAudioDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaAudioDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp index 5e329a54fea..a70b1a07e4d 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp @@ -13,7 +13,7 @@ void CLuaBlipDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"createBlip", CreateBlip}, {"createBlipAttachedTo", CreateBlipAttachedTo}, {"getBlipIcon", GetBlipIcon}, @@ -30,10 +30,8 @@ void CLuaBlipDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaBlipDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaBrowserDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaBrowserDefs.cpp index 999d0b85cf8..5d640763513 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaBrowserDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaBrowserDefs.cpp @@ -14,7 +14,7 @@ void CLuaBrowserDefs::LoadFunctions() { // Define browser functions - std::map functions{ + constexpr static const std::pair functions[]{ {"createBrowser", CreateBrowser}, {"requestBrowserDomains", RequestBrowserDomains}, {"loadBrowserURL", LoadBrowserURL}, @@ -49,10 +49,8 @@ void CLuaBrowserDefs::LoadFunctions() }; // Add browser functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaBrowserDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaCameraDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaCameraDefs.cpp index 4cd3e836a37..283e58fb45b 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaCameraDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaCameraDefs.cpp @@ -14,7 +14,7 @@ void CLuaCameraDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Cam get funcs {"getCamera", GetCamera}, {"getCameraViewMode", GetCameraViewMode}, @@ -39,10 +39,8 @@ void CLuaCameraDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaCameraDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp index 92f9f2719d9..169469c7a58 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp @@ -13,7 +13,7 @@ void CLuaColShapeDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"createColCircle", CreateColCircle}, {"createColCuboid", CreateColCuboid}, {"createColSphere", CreateColSphere}, @@ -36,10 +36,8 @@ void CLuaColShapeDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaColShapeDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp index 456dd1af540..86f438b481c 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp @@ -15,7 +15,7 @@ extern bool g_bAllowAspectRatioAdjustment; void CLuaDrawingDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"dxDrawLine", DxDrawLine}, {"dxDrawMaterialLine3D", DxDrawMaterialLine3D}, {"dxDrawMaterialSectionLine3D", DxDrawMaterialSectionLine3D}, @@ -61,10 +61,8 @@ void CLuaDrawingDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaDrawingDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaEffectDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaEffectDefs.cpp index 1fae44c3efd..5b9940a01a2 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaEffectDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaEffectDefs.cpp @@ -13,7 +13,7 @@ void CLuaEffectDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"fxAddBlood", fxAddBlood}, {"fxAddWood", fxAddWood}, {"fxAddSparks", fxAddSparks}, @@ -36,10 +36,8 @@ void CLuaEffectDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaEffectDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaElementDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaElementDefs.cpp index 8bb7ccaeb55..7a11bc85fd1 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaElementDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaElementDefs.cpp @@ -16,7 +16,7 @@ using std::list; void CLuaElementDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Element get funcs {"getRootElement", GetRootElement}, {"isElement", IsElement}, @@ -98,10 +98,8 @@ void CLuaElementDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaElementDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp index 13f078aaebc..d132750c903 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp @@ -13,7 +13,7 @@ void CLuaEngineDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"engineFreeModel", EngineFreeModel}, {"engineLoadTXD", EngineLoadTXD}, {"engineLoadCOL", EngineLoadCOL}, @@ -59,10 +59,8 @@ void CLuaEngineDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaEngineDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaFireDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaFireDefs.cpp index f9372154c90..c03a332b097 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaFireDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaFireDefs.cpp @@ -12,16 +12,14 @@ void CLuaFireDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"createFire", CreateFire}, {"extinguishFire", ExtinguishFire}, }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } int CLuaFireDefs::CreateFire(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaGUIDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaGUIDefs.cpp index e38f9b3b82d..62a7afac818 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaGUIDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaGUIDefs.cpp @@ -36,7 +36,7 @@ static const SFixedArray g_chatboxLayoutC void CLuaGUIDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"guiGetInputEnabled", GUIGetInputEnabled}, {"guiSetInputEnabled", GUISetInputEnabled}, {"guiGetInputMode", GUIGetInputMode}, @@ -195,10 +195,8 @@ void CLuaGUIDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaGUIDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.cpp index 620698cb247..111c79ee85f 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.cpp @@ -13,7 +13,7 @@ void CLuaMarkerDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"createMarker", CreateMarker}, {"getMarkerCount", GetMarkerCount}, @@ -31,10 +31,8 @@ void CLuaMarkerDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaMarkerDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp index 5e51ab06a77..a49f949df7e 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp @@ -13,7 +13,7 @@ void CLuaObjectDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Object create/destroy funcs {"createObject", CreateObject}, @@ -38,10 +38,8 @@ void CLuaObjectDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaObjectDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp index 7060d7f44f8..c3e25dbaeac 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp @@ -15,7 +15,7 @@ void CLuaPedDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"createPed", CreatePed}, {"detonateSatchels", DetonateSatchels}, {"killPed", KillPed}, @@ -92,10 +92,8 @@ void CLuaPedDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaPedDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPickupDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaPickupDefs.cpp index 6d51620360f..a04b8cecca8 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPickupDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPickupDefs.cpp @@ -13,7 +13,7 @@ void CLuaPickupDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"createPickup", CreatePickup}, {"getPickupType", GetPickupType}, @@ -25,10 +25,8 @@ void CLuaPickupDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaPickupDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPlayerDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaPlayerDefs.cpp index 2fccd289943..c04e80ccd32 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPlayerDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPlayerDefs.cpp @@ -13,7 +13,7 @@ void CLuaPlayerDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Player get funcs {"getLocalPlayer", GetLocalPlayer}, {"getPlayerName", GetPlayerName}, @@ -50,10 +50,8 @@ void CLuaPlayerDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaPlayerDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPointLightDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaPointLightDefs.cpp index d44e5bd0821..54eff5aa94d 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPointLightDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPointLightDefs.cpp @@ -13,7 +13,7 @@ void CLuaPointLightDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"createLight", CreateLight}, {"getLightType", GetLightType}, {"getLightRadius", GetLightRadius}, @@ -25,10 +25,8 @@ void CLuaPointLightDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaPointLightDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaProjectileDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaProjectileDefs.cpp index 5359762ee12..6755a6b003b 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaProjectileDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaProjectileDefs.cpp @@ -13,7 +13,7 @@ void CLuaProjectileDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"createProjectile", CreateProjectile}, {"getProjectileType", GetProjectileType}, {"getProjectileTarget", GetProjectileTarget}, @@ -24,10 +24,8 @@ void CLuaProjectileDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaProjectileDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaRadarAreaDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaRadarAreaDefs.cpp index 27711e59aa0..90f1757a4ee 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaRadarAreaDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaRadarAreaDefs.cpp @@ -14,7 +14,7 @@ void CLuaRadarAreaDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"createRadarArea", CreateRadarArea}, {"getRadarAreaColor", GetRadarAreaColor}, {"getRadarAreaSize", GetRadarAreaSize}, @@ -26,10 +26,8 @@ void CLuaRadarAreaDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaRadarAreaDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp index db96a7b175f..8d3f9d09047 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp @@ -14,7 +14,7 @@ using std::list; void CLuaResourceDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"call", Call}, {"getThisResource", GetThisResource}, {"getResourceConfig", GetResourceConfig}, @@ -30,10 +30,8 @@ void CLuaResourceDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaResourceDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaSearchLightDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaSearchLightDefs.cpp index 29bb8647e91..18fda530c6a 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaSearchLightDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaSearchLightDefs.cpp @@ -13,7 +13,7 @@ void CLuaSearchLightDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"createSearchLight", CreateSearchLight}, {"getSearchLightStartPosition", GetSearchLightStartPosition}, @@ -28,10 +28,8 @@ void CLuaSearchLightDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaSearchLightDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaTeamDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaTeamDefs.cpp index dbb900892e0..ae71489f578 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaTeamDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaTeamDefs.cpp @@ -14,7 +14,7 @@ using std::list; void CLuaTeamDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"getTeamFromName", GetTeamFromName}, {"getTeamName", GetTeamName}, {"getTeamColor", GetTeamColor}, @@ -24,10 +24,8 @@ void CLuaTeamDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaTeamDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaTimerDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaTimerDefs.cpp index 55fb7e4a815..1cd91b853f7 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaTimerDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaTimerDefs.cpp @@ -13,7 +13,7 @@ void CLuaTimerDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"setTimer", SetTimer}, {"killTimer", KillTimer}, {"resetTimer", ResetTimer}, @@ -23,10 +23,8 @@ void CLuaTimerDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaTimerDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp index b5135424f73..9b818ca761c 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp @@ -14,7 +14,7 @@ void CLuaVehicleDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Vehicle get funcs {"getVehicleType", GetVehicleType}, {"getVehicleModelFromName", GetVehicleModelFromName}, @@ -142,10 +142,8 @@ void CLuaVehicleDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaVehicleDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp index 8248ba8f101..a391045f83b 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp @@ -13,7 +13,7 @@ void CLuaWaterDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"createWater", CreateWater}, {"testLineAgainstWater", TestLineAgainstWater}, {"resetWaterColor", ResetWaterColor}, @@ -31,10 +31,8 @@ void CLuaWaterDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaWaterDefs::AddClass(lua_State* luaVM) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaWeaponDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaWeaponDefs.cpp index bd3d00e0a2d..bdfae11add7 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaWeaponDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaWeaponDefs.cpp @@ -15,7 +15,7 @@ void CLuaWeaponDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"getWeaponNameFromID", GetWeaponNameFromID}, {"getWeaponIDFromName", GetWeaponIDFromName}, {"getSlotFromWeapon", GetSlotFromWeapon}, @@ -42,10 +42,8 @@ void CLuaWeaponDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaWeaponDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/lua/CLuaManager.cpp b/Server/mods/deathmatch/logic/lua/CLuaManager.cpp index 305daffc015..b8922ea59b1 100644 --- a/Server/mods/deathmatch/logic/lua/CLuaManager.cpp +++ b/Server/mods/deathmatch/logic/lua/CLuaManager.cpp @@ -155,7 +155,7 @@ CResource* CLuaManager::GetVirtualMachineResource(lua_State* luaVM) void CLuaManager::LoadCFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"addEvent", CLuaFunctionDefs::AddEvent}, {"addEventHandler", CLuaFunctionDefs::AddEventHandler}, {"removeEventHandler", CLuaFunctionDefs::RemoveEventHandler}, @@ -357,10 +357,8 @@ void CLuaManager::LoadCFunctions() }; // Add all functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); // Restricted functions CLuaCFunctions::AddFunction("setServerConfigSetting", CLuaFunctionDefs::SetServerConfigSetting, true); diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaACLDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaACLDefs.cpp index 1ec5f0087b8..4be85f9fa0f 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaACLDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaACLDefs.cpp @@ -20,7 +20,7 @@ static const char* GetResourceName(lua_State* luaVM) void CLuaACLDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"aclReload", aclReload}, {"aclSave", aclSave}, @@ -56,10 +56,8 @@ void CLuaACLDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaACLDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaAccountDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaAccountDefs.cpp index fe38ae655bb..60c50746829 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaAccountDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaAccountDefs.cpp @@ -13,7 +13,7 @@ void CLuaAccountDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Log in/out funcs {"logIn", LogIn}, {"logOut", LogOut}, @@ -44,10 +44,8 @@ void CLuaAccountDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaAccountDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaBanDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaBanDefs.cpp index a4c681abdf5..0f2eabc68fb 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaBanDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaBanDefs.cpp @@ -13,7 +13,7 @@ void CLuaBanDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"addBan", AddBan}, {"removeBan", RemoveBan}, @@ -37,10 +37,8 @@ void CLuaBanDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaBanDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp index f3b41ffebb0..1f6a7086931 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaBlipDefs.cpp @@ -13,7 +13,7 @@ void CLuaBlipDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Blip create/destroy funcs {"createBlip", CreateBlip}, {"createBlipAttachedTo", CreateBlipAttachedTo}, @@ -34,10 +34,8 @@ void CLuaBlipDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaBlipDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaCameraDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaCameraDefs.cpp index e58dabf1d67..37387ac3178 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaCameraDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaCameraDefs.cpp @@ -13,7 +13,7 @@ void CLuaCameraDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Get functions {"getCameraMatrix", getCameraMatrix}, {"getCameraTarget", getCameraTarget}, @@ -27,10 +27,8 @@ void CLuaCameraDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } int CLuaCameraDefs::getCameraMatrix(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp index e615bbdbbaa..eda424e8cbc 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp @@ -13,7 +13,7 @@ void CLuaColShapeDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"createColCircle", CreateColCircle}, {"createColCuboid", CreateColCuboid}, {"createColSphere", CreateColSphere}, @@ -36,10 +36,8 @@ void CLuaColShapeDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaColShapeDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaDatabaseDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaDatabaseDefs.cpp index 4caac84f54a..7380c895b3e 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaDatabaseDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaDatabaseDefs.cpp @@ -13,7 +13,7 @@ void CLuaDatabaseDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"dbConnect", DbConnect}, {"dbExec", DbExec}, {"dbQuery", DbQuery}, @@ -32,10 +32,8 @@ void CLuaDatabaseDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaDatabaseDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaElementDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaElementDefs.cpp index a410c23f8a4..9d5783be7ea 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaElementDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaElementDefs.cpp @@ -13,7 +13,7 @@ void CLuaElementDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Create/destroy {"createElement", createElement}, {"destroyElement", destroyElement}, @@ -100,10 +100,8 @@ void CLuaElementDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } // TODO: specials diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaHandlingDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaHandlingDefs.cpp index 36e9c7c52ff..2593221b126 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaHandlingDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaHandlingDefs.cpp @@ -13,7 +13,7 @@ void CLuaHandlingDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Set {"setVehicleHandling", SetVehicleHandling}, {"setModelHandling", SetModelHandling}, @@ -25,10 +25,8 @@ void CLuaHandlingDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } int CLuaHandlingDefs::SetVehicleHandling(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.cpp index 59bc3b4be3c..16fc3ab10e1 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.cpp @@ -12,7 +12,7 @@ void CLuaMarkerDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Marker functions {"createMarker", CreateMarker}, @@ -33,10 +33,8 @@ void CLuaMarkerDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaMarkerDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp index bff8a1e84f8..d3f8d7bd3e7 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaObjectDefs.cpp @@ -13,7 +13,7 @@ void CLuaObjectDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Object create/destroy funcs {"createObject", CreateObject}, @@ -29,10 +29,8 @@ void CLuaObjectDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaObjectDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp index 3c41c9650cf..14d80da029c 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp @@ -13,7 +13,7 @@ void CLuaPedDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Ped funcs {"createPed", CreatePed}, {"getValidPedModels", GetValidPedModels}, @@ -78,10 +78,8 @@ void CLuaPedDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } // TODO: specials diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaPickupDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaPickupDefs.cpp index 2e8efcfb634..8ac71e21b84 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaPickupDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaPickupDefs.cpp @@ -13,7 +13,7 @@ void CLuaPickupDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Create/destroy {"createPickup", createPickup}, @@ -32,10 +32,8 @@ void CLuaPickupDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaPickupDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaPlayerDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaPlayerDefs.cpp index 7a079e4084a..bea1d3e9c17 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaPlayerDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaPlayerDefs.cpp @@ -13,7 +13,7 @@ void CLuaPlayerDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Player get funcs {"getPlayerCount", GetPlayerCount}, {"getPlayerFromNick", GetPlayerFromName}, @@ -102,10 +102,8 @@ void CLuaPlayerDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaPlayerDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaRadarAreaDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaRadarAreaDefs.cpp index 9008928102c..ab931109274 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaRadarAreaDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaRadarAreaDefs.cpp @@ -13,7 +13,7 @@ void CLuaRadarAreaDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Radar area create/destroy funcs {"createRadarArea", CreateRadarArea}, @@ -30,10 +30,8 @@ void CLuaRadarAreaDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaRadarAreaDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp index e4fbbee5afa..2208f4454c3 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp @@ -16,7 +16,7 @@ extern CNetServer* g_pRealNetServer; void CLuaResourceDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Create/edit functions {"createResource", createResource}, {"copyResource", copyResource}, @@ -68,10 +68,8 @@ void CLuaResourceDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); CLuaCFunctions::AddFunction("updateResourceACLRequest", updateResourceACLRequest, true); } diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.cpp index e5c277a7fd6..15caac7ccc0 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaTeamDefs.cpp @@ -13,7 +13,7 @@ void CLuaTeamDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Team create/destroy functions {"createTeam", CreateTeam}, @@ -33,10 +33,8 @@ void CLuaTeamDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaTeamDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaTextDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaTextDefs.cpp index 4cad3318972..603c756b88a 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaTextDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaTextDefs.cpp @@ -13,7 +13,7 @@ void CLuaTextDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"textCreateDisplay", textCreateDisplay}, {"textDestroyDisplay", textDestroyDisplay}, {"textCreateTextItem", textCreateTextItem}, @@ -39,10 +39,8 @@ void CLuaTextDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaTextDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaTimerDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaTimerDefs.cpp index 097d3be2b2d..4959f1cb61c 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaTimerDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaTimerDefs.cpp @@ -13,7 +13,7 @@ void CLuaTimerDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"setTimer", SetTimer}, {"killTimer", KillTimer}, {"resetTimer", ResetTimer}, @@ -23,10 +23,8 @@ void CLuaTimerDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaTimerDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp index b072876178d..9ec7a1e16ec 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp @@ -13,7 +13,7 @@ void CLuaVehicleDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Vehicle create/destroy funcs {"createVehicle", CreateVehicle}, @@ -120,10 +120,8 @@ void CLuaVehicleDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaVehicleDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaVoiceDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaVoiceDefs.cpp index 9f62b742eb7..d1bb9eb6853 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaVoiceDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaVoiceDefs.cpp @@ -13,17 +13,15 @@ void CLuaVoiceDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"isVoiceEnabled", IsVoiceEnabled}, {"setPlayerVoiceBroadcastTo", SetPlayerVoiceBroadcastTo}, {"setPlayerVoiceIgnoreFrom", setPlayerVoiceIgnoreFrom}, }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } int CLuaVoiceDefs::IsVoiceEnabled(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp index c9ba13d519d..289821f5bc7 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaWaterDefs.cpp @@ -13,7 +13,7 @@ void CLuaWaterDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"createWater", CreateWater}, {"setWaterLevel", SetWaterLevel}, {"resetWaterLevel", ResetWaterLevel}, @@ -25,10 +25,8 @@ void CLuaWaterDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaWaterDefs::AddClass(lua_State* luaVM) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp index 73b7156b11c..38c55cd8b22 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp @@ -13,7 +13,7 @@ void CLuaWorldDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Get {"getTime", getTime}, {"getWeather", getWeather}, @@ -90,10 +90,8 @@ void CLuaWorldDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } int CLuaWorldDefs::getTime(lua_State* luaVM) diff --git a/Shared/mods/deathmatch/logic/luadefs/CLuaBitDefs.cpp b/Shared/mods/deathmatch/logic/luadefs/CLuaBitDefs.cpp index 36d927a01e8..e6ad6f0125f 100644 --- a/Shared/mods/deathmatch/logic/luadefs/CLuaBitDefs.cpp +++ b/Shared/mods/deathmatch/logic/luadefs/CLuaBitDefs.cpp @@ -14,7 +14,7 @@ void CLuaBitDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"bitAnd", bitAnd}, {"bitNot", bitNot}, {"bitOr", bitOr}, @@ -32,10 +32,8 @@ void CLuaBitDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } int CLuaBitDefs::bitAnd(lua_State* luaVM) diff --git a/Shared/mods/deathmatch/logic/luadefs/CLuaCryptDefs.cpp b/Shared/mods/deathmatch/logic/luadefs/CLuaCryptDefs.cpp index 96a87258deb..bdfb03723d6 100644 --- a/Shared/mods/deathmatch/logic/luadefs/CLuaCryptDefs.cpp +++ b/Shared/mods/deathmatch/logic/luadefs/CLuaCryptDefs.cpp @@ -13,7 +13,7 @@ void CLuaCryptDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"md5", ArgumentParserWarn}, {"sha256", ArgumentParserWarn}, {"hash", ArgumentParserWarn}, @@ -28,10 +28,8 @@ void CLuaCryptDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } std::string CLuaCryptDefs::Md5(std::string strMd5) diff --git a/Shared/mods/deathmatch/logic/luadefs/CLuaFileDefs.cpp b/Shared/mods/deathmatch/logic/luadefs/CLuaFileDefs.cpp index ddeb9367641..055f5d0311e 100644 --- a/Shared/mods/deathmatch/logic/luadefs/CLuaFileDefs.cpp +++ b/Shared/mods/deathmatch/logic/luadefs/CLuaFileDefs.cpp @@ -14,7 +14,7 @@ void CLuaFileDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"fileOpen", fileOpen}, {"fileCreate", fileCreate}, {"fileExists", fileExists}, @@ -36,10 +36,8 @@ void CLuaFileDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaFileDefs::AddClass(lua_State* luaVM) diff --git a/Shared/mods/deathmatch/logic/luadefs/CLuaUTFDefs.cpp b/Shared/mods/deathmatch/logic/luadefs/CLuaUTFDefs.cpp index adcb79c023f..f210e5e7479 100644 --- a/Shared/mods/deathmatch/logic/luadefs/CLuaUTFDefs.cpp +++ b/Shared/mods/deathmatch/logic/luadefs/CLuaUTFDefs.cpp @@ -12,7 +12,7 @@ void CLuaUTFDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"utfLen", UtfLen}, {"utfSeek", UtfSeek}, {"utfSub", UtfSub}, @@ -21,10 +21,8 @@ void CLuaUTFDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } int CLuaUTFDefs::UtfLen(lua_State* luaVM) diff --git a/Shared/mods/deathmatch/logic/luadefs/CLuaUtilDefs.cpp b/Shared/mods/deathmatch/logic/luadefs/CLuaUtilDefs.cpp index 566d027cf6b..bc1b90618f9 100644 --- a/Shared/mods/deathmatch/logic/luadefs/CLuaUtilDefs.cpp +++ b/Shared/mods/deathmatch/logic/luadefs/CLuaUtilDefs.cpp @@ -12,7 +12,7 @@ void CLuaUtilDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ // Util functions to make scripting easier for the end user // Some of these are based on standard mIRC script funcs as a lot of people will be used to them {"deref", Dereference}, @@ -49,10 +49,8 @@ void CLuaUtilDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } int CLuaUtilDefs::DisabledFunction(lua_State* luaVM) diff --git a/Shared/mods/deathmatch/logic/luadefs/CLuaXMLDefs.cpp b/Shared/mods/deathmatch/logic/luadefs/CLuaXMLDefs.cpp index 398ea11f005..6f23ee46f42 100644 --- a/Shared/mods/deathmatch/logic/luadefs/CLuaXMLDefs.cpp +++ b/Shared/mods/deathmatch/logic/luadefs/CLuaXMLDefs.cpp @@ -12,7 +12,7 @@ void CLuaXMLDefs::LoadFunctions() { - std::map functions{ + constexpr static const std::pair functions[]{ {"xmlCreateFile", xmlCreateFile}, {"xmlLoadFile", xmlLoadFile}, {"xmlLoadString", xmlLoadString}, @@ -36,10 +36,8 @@ void CLuaXMLDefs::LoadFunctions() }; // Add functions - for (const auto& pair : functions) - { - CLuaCFunctions::AddFunction(pair.first, pair.second); - } + for (const auto& [name, func] : functions) + CLuaCFunctions::AddFunction(name, func); } void CLuaXMLDefs::AddClass(lua_State* luaVM)