Skip to content

Commit

Permalink
Delete getTrainTrack and setTrainTrack (#1713)
Browse files Browse the repository at this point in the history
  • Loading branch information
qaisjp committed Oct 14, 2020
1 parent d9ee1af commit 89b5620
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 170 deletions.
22 changes: 0 additions & 22 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
53 changes: 0 additions & 53 deletions Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ void CLuaVehicleDefs::LoadFunctions()
{"isTrainDerailable", IsTrainDerailable},
{"getTrainDirection", GetTrainDirection},
{"getTrainSpeed", GetTrainSpeed},
// CLuaCFunctions::AddFunction ( "getTrainTrack", GetTrainTrack );
{"getTrainPosition", GetTrainPosition},
{"isTrainChainEngine", IsTrainChainEngine},
{"getVehicleGravity", GetVehicleGravity},
Expand Down Expand Up @@ -117,7 +116,6 @@ void CLuaVehicleDefs::LoadFunctions()
{"setTrainDerailable", SetTrainDerailable},
{"setTrainDirection", SetTrainDirection},
{"setTrainSpeed", SetTrainSpeed},
// CLuaCFunctions::AddFunction ( "setTrainTrack", SetTrainTrack );
{"setTrainPosition", SetTrainPosition},
{"setVehicleTaxiLightOn", SetVehicleTaxiLightOn},
{"setVehicleGravity", SetVehicleGravity},
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
32 changes: 0 additions & 32 deletions Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions Server/mods/deathmatch/logic/CStaticFunctionDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
55 changes: 0 additions & 55 deletions Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ void CLuaVehicleDefs::LoadFunctions()
{"isTrainDerailable", IsTrainDerailable},
{"getTrainDirection", GetTrainDirection},
{"getTrainSpeed", GetTrainSpeed},
// {"getTrainTrack", GetTrainTrack},
{"getTrainPosition", GetTrainPosition},
{"isVehicleBlown", IsVehicleBlown},
{"getVehicleHeadLightColor", GetVehicleHeadLightColor},
Expand Down Expand Up @@ -105,7 +104,6 @@ void CLuaVehicleDefs::LoadFunctions()
{"setTrainDerailable", SetTrainDerailable},
{"setTrainDirection", SetTrainDirection},
{"setTrainSpeed", SetTrainSpeed},
// {"setTrainTrack", SetTrainTrack},
{"setTrainPosition", SetTrainPosition},
{"setVehicleHeadLightColor", SetVehicleHeadLightColor},
{"setVehicleTurretPosition", SetVehicleTurretPosition},
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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

Expand All @@ -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");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 89b5620

Please sign in to comment.