Skip to content

Commit 53e63fb

Browse files
authored
swap ordering
1 parent ea24f89 commit 53e63fb

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

Server/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2303,24 +2303,38 @@ int CLuaVehicleDefs::GetVehicleRespawnRotation(lua_State* luaVM)
23032303
return 1;
23042304
}
23052305

2306-
int CLuaVehicleDefs::GetVehicleRespawnPosition(lua_State* luaVM)
2306+
int CLuaVehicleDefs::SetVehicleRespawnPosition(lua_State* luaVM)
23072307
{
2308-
// float, float, float getVehicleRespawnPosition( vehicle theVehicle )
2309-
CElement* pElement = NULL;
2308+
CElement* pElement;
2309+
CVector vecPosition;
23102310

23112311
CScriptArgReader argStream(luaVM);
23122312
argStream.ReadUserData(pElement);
2313+
argStream.ReadVector3D(vecPosition);
23132314

2314-
if (!argStream.HasErrors())
2315+
if (argStream.NextIsVector3D())
23152316
{
2316-
CVector vecPosition;
2317-
if (CStaticFunctionDefinitions::GetVehicleRespawnPosition(pElement, vecPosition))
2318-
{
2319-
lua_pushnumber(luaVM, vecPosition.fX);
2320-
lua_pushnumber(luaVM, vecPosition.fY);
2321-
lua_pushnumber(luaVM, vecPosition.fZ);
2317+
CVector vecRotation;
2318+
argStream.ReadVector3D(vecRotation);
23222319

2323-
return 3;
2320+
if (!argStream.HasErrors())
2321+
{
2322+
if (CStaticFunctionDefinitions::SetVehicleRespawnPosition(pElement, vecPosition) &&
2323+
CStaticFunctionDefinitions::SetVehicleRespawnRotation(pElement, vecRotation))
2324+
{
2325+
lua_pushboolean(luaVM, true);
2326+
return 1;
2327+
}
2328+
}
2329+
else
2330+
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
2331+
}
2332+
else if (!argStream.HasErrors())
2333+
{
2334+
if (CStaticFunctionDefinitions::SetVehicleRespawnPosition(pElement, vecPosition))
2335+
{
2336+
lua_pushboolean(luaVM, true);
2337+
return 1;
23242338
}
23252339
}
23262340
else
@@ -2330,21 +2344,24 @@ int CLuaVehicleDefs::GetVehicleRespawnPosition(lua_State* luaVM)
23302344
return 1;
23312345
}
23322346

2333-
int CLuaVehicleDefs::SetVehicleRespawnRotation(lua_State* luaVM)
2347+
int CLuaVehicleDefs::GetVehicleRespawnPosition(lua_State* luaVM)
23342348
{
2335-
CElement* pElement;
2336-
CVector vecRotation;
2349+
// float, float, float getVehicleRespawnPosition( vehicle theVehicle )
2350+
CElement* pElement = NULL;
23372351

23382352
CScriptArgReader argStream(luaVM);
23392353
argStream.ReadUserData(pElement);
2340-
argStream.ReadVector3D(vecRotation, CVector());
23412354

23422355
if (!argStream.HasErrors())
23432356
{
2344-
if (CStaticFunctionDefinitions::SetVehicleRespawnRotation(pElement, vecRotation))
2357+
CVector vecPosition;
2358+
if (CStaticFunctionDefinitions::GetVehicleRespawnPosition(pElement, vecPosition))
23452359
{
2346-
lua_pushboolean(luaVM, true);
2347-
return 1;
2360+
lua_pushnumber(luaVM, vecPosition.fX);
2361+
lua_pushnumber(luaVM, vecPosition.fY);
2362+
lua_pushnumber(luaVM, vecPosition.fZ);
2363+
2364+
return 3;
23482365
}
23492366
}
23502367
else
@@ -2354,35 +2371,18 @@ int CLuaVehicleDefs::SetVehicleRespawnRotation(lua_State* luaVM)
23542371
return 1;
23552372
}
23562373

2357-
int CLuaVehicleDefs::SetVehicleRespawnPosition(lua_State* luaVM)
2374+
int CLuaVehicleDefs::SetVehicleRespawnRotation(lua_State* luaVM)
23582375
{
23592376
CElement* pElement;
2360-
CVector vecPosition;
2377+
CVector vecRotation;
23612378

23622379
CScriptArgReader argStream(luaVM);
23632380
argStream.ReadUserData(pElement);
2364-
argStream.ReadVector3D(vecPosition);
2365-
2366-
if (argStream.NextIsVector3D())
2367-
{
2368-
CVector vecRotation;
2369-
argStream.ReadVector3D(vecRotation);
2381+
argStream.ReadVector3D(vecRotation, CVector());
23702382

2371-
if (!argStream.HasErrors())
2372-
{
2373-
if (CStaticFunctionDefinitions::SetVehicleRespawnPosition(pElement, vecPosition) &&
2374-
CStaticFunctionDefinitions::SetVehicleRespawnRotation(pElement, vecRotation))
2375-
{
2376-
lua_pushboolean(luaVM, true);
2377-
return 1;
2378-
}
2379-
}
2380-
else
2381-
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
2382-
}
2383-
else if (!argStream.HasErrors())
2383+
if (!argStream.HasErrors())
23842384
{
2385-
if (CStaticFunctionDefinitions::SetVehicleRespawnPosition(pElement, vecPosition))
2385+
if (CStaticFunctionDefinitions::SetVehicleRespawnRotation(pElement, vecRotation))
23862386
{
23872387
lua_pushboolean(luaVM, true);
23882388
return 1;

0 commit comments

Comments
 (0)