From 89b5620aeec1cadc645301250143ce8b1740ed5b Mon Sep 17 00:00:00 2001 From: Qais Patankar Date: Wed, 14 Oct 2020 21:27:03 +0100 Subject: [PATCH] Delete getTrainTrack and setTrainTrack (#1713) --- .../logic/CStaticFunctionDefinitions.cpp | 22 -------- .../logic/CStaticFunctionDefinitions.h | 2 - .../logic/luadefs/CLuaVehicleDefs.cpp | 53 ------------------ .../logic/luadefs/CLuaVehicleDefs.h | 2 - .../logic/CStaticFunctionDefinitions.cpp | 32 ----------- .../logic/CStaticFunctionDefinitions.h | 2 - .../logic/luadefs/CLuaVehicleDefs.cpp | 55 ------------------- .../logic/luadefs/CLuaVehicleDefs.h | 2 - 8 files changed, 170 deletions(-) diff --git a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index 784de66cb8..9cdb305b35 100644 --- a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -2714,17 +2714,6 @@ bool CStaticFunctionDefinitions::GetTrainSpeed(CClientVehicle& Vehicle, float& f return true; } -bool CStaticFunctionDefinitions::GetTrainTrack(CClientVehicle& Vehicle, uchar& ucTrack) -{ - if (Vehicle.GetVehicleType() != CLIENTVEHICLE_TRAIN) - return false; - else if (Vehicle.IsDerailed()) - return false; - - ucTrack = Vehicle.GetTrainTrack(); - return true; -} - bool CStaticFunctionDefinitions::GetTrainPosition(CClientVehicle& Vehicle, float& fPosition) { if (Vehicle.GetVehicleType() != CLIENTVEHICLE_TRAIN) @@ -3364,17 +3353,6 @@ bool CStaticFunctionDefinitions::SetTrainSpeed(CClientVehicle& Vehicle, float fS return true; } -bool CStaticFunctionDefinitions::SetTrainTrack(CClientVehicle& Vehicle, uchar ucTrack) -{ - if (Vehicle.GetVehicleType() != CLIENTVEHICLE_TRAIN) - return false; - else if (Vehicle.IsDerailed()) - return false; - - Vehicle.SetTrainTrack(ucTrack); - return true; -} - bool CStaticFunctionDefinitions::SetTrainPosition(CClientVehicle& Vehicle, float fPosition) { if (Vehicle.GetVehicleType() != CLIENTVEHICLE_TRAIN) diff --git a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h index 4248ccccd9..d8fc31326f 100644 --- a/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h +++ b/Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h @@ -209,7 +209,6 @@ class CStaticFunctionDefinitions static bool IsTrainDerailable(CClientVehicle& Vehicle, bool& bIsDerailable); static bool GetTrainDirection(CClientVehicle& Vehicle, bool& bDirection); static bool GetTrainSpeed(CClientVehicle& Vehicle, float& fSpeed); - static bool GetTrainTrack(CClientVehicle& Vehicle, uchar& ucTrack); static bool GetTrainPosition(CClientVehicle& Vehicle, float& fPosition); static bool IsTrainChainEngine(CClientVehicle& Vehicle, bool& bChainEngine); static bool IsVehicleBlown(CClientVehicle& Vehicle, bool& bBlown); @@ -259,7 +258,6 @@ class CStaticFunctionDefinitions static bool SetTrainDerailable(CClientVehicle& Vehicle, bool bDerailable); static bool SetTrainDirection(CClientVehicle& Vehicle, bool bDirection); static bool SetTrainSpeed(CClientVehicle& Vehicle, float fSpeed); - static bool SetTrainTrack(CClientVehicle& Vehicle, uchar ucTrack); static bool SetTrainPosition(CClientVehicle& Vehicle, float fPosition); static bool SetVehicleHeadLightColor(CClientEntity& Vehicle, const SColor color); static bool SetVehicleDoorOpenRatio(CClientEntity& Vehicle, unsigned char ucDoor, float fRatio, unsigned long ulTime = 0); diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp index 5ca7f9cdd9..521a89e25b 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp @@ -57,7 +57,6 @@ void CLuaVehicleDefs::LoadFunctions() {"isTrainDerailable", IsTrainDerailable}, {"getTrainDirection", GetTrainDirection}, {"getTrainSpeed", GetTrainSpeed}, - // CLuaCFunctions::AddFunction ( "getTrainTrack", GetTrainTrack ); {"getTrainPosition", GetTrainPosition}, {"isTrainChainEngine", IsTrainChainEngine}, {"getVehicleGravity", GetVehicleGravity}, @@ -117,7 +116,6 @@ void CLuaVehicleDefs::LoadFunctions() {"setTrainDerailable", SetTrainDerailable}, {"setTrainDirection", SetTrainDirection}, {"setTrainSpeed", SetTrainSpeed}, - // CLuaCFunctions::AddFunction ( "setTrainTrack", SetTrainTrack ); {"setTrainPosition", SetTrainPosition}, {"setVehicleTaxiLightOn", SetVehicleTaxiLightOn}, {"setVehicleGravity", SetVehicleGravity}, @@ -177,7 +175,6 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM) lua_classfunction(luaVM, "getNitroLevel", "getVehicleNitroLevel"); lua_classfunction(luaVM, "getDirection", "getTrainDirection"); lua_classfunction(luaVM, "getTrainSpeed", "getTrainSpeed"); - // lua_classfunction ( luaVM, "getTrack", "getTrainTrack" ); lua_classfunction(luaVM, "getTrainPosition", "getTrainPosition"); lua_classfunction(luaVM, "getName", "getVehicleName"); lua_classfunction(luaVM, "getVehicleType", "getVehicleType"); @@ -260,7 +257,6 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM) lua_classfunction(luaVM, "setNitroLevel", "setVehicleNitroLevel"); lua_classfunction(luaVM, "setDirection", "setTrainDirection"); lua_classfunction(luaVM, "setTrainSpeed", "setTrainSpeed"); - // lua_classfunction ( luaVM, "setTrack", "setTrainTrack" ); lua_classfunction(luaVM, "setTrainPosition", "setTrainPosition"); lua_classfunction(luaVM, "setDerailable", "setTrainDerailable"); lua_classfunction(luaVM, "setDerailed", "setTrainDerailed"); @@ -316,7 +312,6 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM) lua_classvariable(luaVM, "towedByVehicle", NULL, "getVehicleTowedByVehicle"); lua_classvariable(luaVM, "direction", "setTrainDirection", "getTrainDirection"); lua_classvariable(luaVM, "trainSpeed", "setTrainSpeed", "getTrainSpeed"); - // lua_classvariable ( luaVM, "track", "setTrainTrack", "getTrainTrack" ); lua_classvariable(luaVM, "trainPosition", "setTrainPosition", "getTrainPosition"); lua_classvariable(luaVM, "derailable", "setTrainDerailable", "isTrainDerailable"); lua_classvariable(luaVM, "derailed", "setTrainDerailed", "isTrainDerailed"); @@ -1367,28 +1362,6 @@ int CLuaVehicleDefs::GetTrainSpeed(lua_State* luaVM) return 1; } -int CLuaVehicleDefs::GetTrainTrack(lua_State* luaVM) -{ - CClientVehicle* pVehicle = NULL; - CScriptArgReader argStream(luaVM); - argStream.ReadUserData(pVehicle); - - if (!argStream.HasErrors()) - { - uchar ucTrack; - if (CStaticFunctionDefinitions::GetTrainTrack(*pVehicle, ucTrack)) - { - lua_pushnumber(luaVM, ucTrack); - return 1; - } - } - else - m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage()); - - lua_pushboolean(luaVM, false); - return 1; -} - int CLuaVehicleDefs::GetTrainPosition(lua_State* luaVM) { CClientVehicle* pVehicle = NULL; @@ -2333,32 +2306,6 @@ int CLuaVehicleDefs::SetTrainSpeed(lua_State* luaVM) return 1; } -int CLuaVehicleDefs::SetTrainTrack(lua_State* luaVM) -{ - CClientVehicle* pVehicle = NULL; - uchar ucTrack; - CScriptArgReader argStream(luaVM); - argStream.ReadUserData(pVehicle); - argStream.ReadNumber(ucTrack); - - if (ucTrack > 3) - argStream.SetCustomError("Invalid track number range (0-3)"); - - if (!argStream.HasErrors()) - { - if (CStaticFunctionDefinitions::SetTrainTrack(*pVehicle, ucTrack)) - { - lua_pushboolean(luaVM, true); - return 1; - } - } - else - m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage()); - - lua_pushboolean(luaVM, false); - return 1; -} - int CLuaVehicleDefs::SetTrainPosition(lua_State* luaVM) { CClientVehicle* pVehicle = NULL; diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h index 03328ff5dd..8900ec68fe 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h @@ -63,7 +63,6 @@ class CLuaVehicleDefs : public CLuaDefs LUA_DECLARE(IsTrainDerailable); LUA_DECLARE(GetTrainDirection); LUA_DECLARE(GetTrainSpeed); - LUA_DECLARE(GetTrainTrack); LUA_DECLARE(GetTrainPosition); LUA_DECLARE(IsTrainChainEngine); LUA_DECLARE_OOP(GetVehicleGravity); @@ -120,7 +119,6 @@ class CLuaVehicleDefs : public CLuaDefs LUA_DECLARE(SetTrainDerailable); LUA_DECLARE(SetTrainDirection); LUA_DECLARE(SetTrainSpeed); - LUA_DECLARE(SetTrainTrack); LUA_DECLARE(SetTrainPosition); LUA_DECLARE(SetVehicleGravity); LUA_DECLARE(SetVehicleHeadLightColor); diff --git a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp index 4b1c4270e5..19d9ff28c0 100644 --- a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp +++ b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp @@ -5220,19 +5220,6 @@ bool CStaticFunctionDefinitions::GetTrainSpeed(CVehicle* pVehicle, float& fSpeed return true; } -bool CStaticFunctionDefinitions::GetTrainTrack(CVehicle* pVehicle, uchar& ucTrack) -{ - assert(pVehicle); - - if (pVehicle->GetVehicleType() != VEHICLE_TRAIN) - return false; - else if (pVehicle->IsDerailed()) - return false; - - ucTrack = pVehicle->GetTrainTrack(); - return true; -} - bool CStaticFunctionDefinitions::GetTrainPosition(CVehicle* pVehicle, float& fPosition) { assert(pVehicle); @@ -7153,25 +7140,6 @@ bool CStaticFunctionDefinitions::SetTrainSpeed(CVehicle* pVehicle, float fSpeed) return true; } -bool CStaticFunctionDefinitions::SetTrainTrack(CVehicle* pVehicle, uchar ucTrack) -{ - assert(pVehicle); - - if (pVehicle->GetVehicleType() != VEHICLE_TRAIN) - return false; - else if (pVehicle->IsDerailed()) - return false; - - pVehicle->SetTrainTrack(ucTrack); - - CBitStream BitStream; - BitStream.pBitStream->Write(ucTrack); - - m_pPlayerManager->BroadcastOnlyJoined(CElementRPCPacket(pVehicle, SET_TRAIN_TRACK, *BitStream.pBitStream)); - - return true; -} - bool CStaticFunctionDefinitions::SetTrainPosition(CVehicle* pVehicle, float fPosition) { assert(pVehicle); diff --git a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.h b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.h index a64c73266e..11f25655fa 100644 --- a/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.h +++ b/Server/mods/deathmatch/logic/CStaticFunctionDefinitions.h @@ -268,7 +268,6 @@ class CStaticFunctionDefinitions static bool IsTrainDerailable(CVehicle* pVehicle, bool& bDerailable); static bool GetTrainDirection(CVehicle* pVehicle, bool& bDirection); static bool GetTrainSpeed(CVehicle* pVehicle, float& fSpeed); - static bool GetTrainTrack(CVehicle* pVehicle, uchar& ucTrack); static bool GetTrainPosition(CVehicle* pVehicle, float& fPosition); static bool IsVehicleBlown(CVehicle* pVehicle); static bool GetVehicleHeadLightColor(CVehicle* pVehicle, SColor& outColor); @@ -331,7 +330,6 @@ class CStaticFunctionDefinitions static bool SetTrainDerailable(CVehicle* pVehicle, bool bDerailable); static bool SetTrainDirection(CVehicle* pVehicle, bool bDirection); static bool SetTrainSpeed(CVehicle* pVehicle, float fSpeed); - static bool SetTrainTrack(CVehicle* pVehicle, uchar ucTrack); static bool SetTrainPosition(CVehicle* pVehicle, float fPosition); static bool SetVehicleHeadLightColor(CVehicle* pVehicle, const SColor color); static bool SetVehicleTurretPosition(CVehicle* pVehicle, float fHorizontal, float fVertical); diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp index 3949ef6192..591718249b 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp @@ -57,7 +57,6 @@ void CLuaVehicleDefs::LoadFunctions() {"isTrainDerailable", IsTrainDerailable}, {"getTrainDirection", GetTrainDirection}, {"getTrainSpeed", GetTrainSpeed}, - // {"getTrainTrack", GetTrainTrack}, {"getTrainPosition", GetTrainPosition}, {"isVehicleBlown", IsVehicleBlown}, {"getVehicleHeadLightColor", GetVehicleHeadLightColor}, @@ -105,7 +104,6 @@ void CLuaVehicleDefs::LoadFunctions() {"setTrainDerailable", SetTrainDerailable}, {"setTrainDirection", SetTrainDirection}, {"setTrainSpeed", SetTrainSpeed}, - // {"setTrainTrack", SetTrainTrack}, {"setTrainPosition", SetTrainPosition}, {"setVehicleHeadLightColor", SetVehicleHeadLightColor}, {"setVehicleTurretPosition", SetVehicleTurretPosition}, @@ -164,7 +162,6 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM) lua_classfunction(luaVM, "getSirens", "getVehicleSirens"); lua_classfunction(luaVM, "getDirection", "getTrainDirection"); lua_classfunction(luaVM, "getTrainSpeed", "getTrainSpeed"); - // lua_classfunction ( luaVM, "getTrack", "getTrainTrack" ); lua_classfunction(luaVM, "getTrainPosition", "getTrainPosition"); lua_classfunction(luaVM, "getHeadLightColor", "getVehicleHeadLightColor"); lua_classfunction(luaVM, "getColor", "getVehicleColor"); @@ -226,7 +223,6 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM) lua_classfunction(luaVM, "setDerailable", "setTrainDerailable"); lua_classfunction(luaVM, "setDerailed", "setTrainDerailed"); lua_classfunction(luaVM, "setDirection", "setTrainDirection"); - // lua_classfunction ( luaVM, "setTrack", "setTrainTrack" ); lua_classfunction(luaVM, "setTrainPosition", "setTrainPosition"); lua_classfunction(luaVM, "setTrainSpeed", "setTrainSpeed"); // Reduce confusion @@ -237,7 +233,6 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM) lua_classvariable(luaVM, "blown", "blowVehicle", "isVehicleBlown"); lua_classvariable(luaVM, "direction", "setTrainDirection", "getTrainDirection"); lua_classvariable(luaVM, "trainSpeed", "setTrainSpeed", "getTrainSpeed"); - // lua_classvariable ( luaVM, "track", "setTrainTrack", "getTrainTrack" ); lua_classvariable(luaVM, "trainPosition", "setTrainPosition", "getTrainPosition"); lua_classvariable(luaVM, "taxiLightOn", "setVehicleTaxiLightOn", "isVehicleTaxiLightOn"); lua_classvariable(luaVM, "fuelTankExplodable", "setVehicleFuelTankExplodable", "isVehicleFuelTankExplodable"); @@ -1695,29 +1690,6 @@ int CLuaVehicleDefs::GetTrainPosition(lua_State* luaVM) return 1; } -int CLuaVehicleDefs::GetTrainTrack(lua_State* luaVM) -{ - CVehicle* pVehicle; - - CScriptArgReader argStream(luaVM); - argStream.ReadUserData(pVehicle); - - if (!argStream.HasErrors()) - { - uchar ucTrack; - if (CStaticFunctionDefinitions::GetTrainTrack(pVehicle, ucTrack)) - { - lua_pushnumber(luaVM, ucTrack); - return 1; - } - } - else - m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage()); - - lua_pushboolean(luaVM, false); - return 1; -} - int CLuaVehicleDefs::FixVehicle(lua_State* luaVM) { CElement* pElement; @@ -2823,33 +2795,6 @@ int CLuaVehicleDefs::SetTrainSpeed(lua_State* luaVM) return 1; } -int CLuaVehicleDefs::SetTrainTrack(lua_State* luaVM) -{ - CVehicle* pVehicle; - uchar ucTrack; - - CScriptArgReader argStream(luaVM); - argStream.ReadUserData(pVehicle); - argStream.ReadNumber(ucTrack); - - if (ucTrack > 3) - argStream.SetCustomError("Invalid track number range (0-3)"); - - if (!argStream.HasErrors()) - { - if (CStaticFunctionDefinitions::SetTrainTrack(pVehicle, ucTrack)) - { - lua_pushboolean(luaVM, true); - return 1; - } - } - else - m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage()); - - lua_pushboolean(luaVM, false); - return 1; -} - int CLuaVehicleDefs::SetTrainPosition(lua_State* luaVM) { CVehicle* pVehicle; diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h b/Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h index 7bc60f9b48..9fadd29e0c 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h +++ b/Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h @@ -62,7 +62,6 @@ class CLuaVehicleDefs : public CLuaDefs LUA_DECLARE(IsTrainDerailable); LUA_DECLARE(GetTrainDirection); LUA_DECLARE(GetTrainSpeed); - LUA_DECLARE(GetTrainTrack); LUA_DECLARE(GetTrainPosition); LUA_DECLARE(IsVehicleBlown); LUA_DECLARE(GetVehicleHeadLightColor); @@ -111,7 +110,6 @@ class CLuaVehicleDefs : public CLuaDefs LUA_DECLARE(SetTrainDerailable); LUA_DECLARE(SetTrainDirection); LUA_DECLARE(SetTrainSpeed); - LUA_DECLARE(SetTrainTrack); LUA_DECLARE(SetTrainPosition); LUA_DECLARE(SetVehicleHeadLightColor); LUA_DECLARE(SetVehicleTurretPosition);