Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions Client/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,15 @@ int CLuaColShapeDefs::CreateColPolygon(lua_State* luaVM)
CScriptArgReader argStream(luaVM);
argStream.ReadVector2D(vecPosition);

// Get the points
std::vector<CVector2D> vecPointList;
for (uint i = 0; i < 3 || argStream.NextIsVector2D(); i++)
{
CVector2D vecPoint;
argStream.ReadVector2D(vecPoint);
vecPointList.push_back(vecPoint);
}

if (!argStream.HasErrors())
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine(luaVM);
Expand All @@ -267,11 +276,10 @@ int CLuaColShapeDefs::CreateColPolygon(lua_State* luaVM)
CClientColPolygon* pShape = CStaticFunctionDefinitions::CreateColPolygon(*pResource, vecPosition);
if (pShape)
{
// Get the points
while (argStream.NextCouldBeNumber() && argStream.NextCouldBeNumber(1))
// Add the points
for (uint i = 0; i < vecPointList.size(); i++)
{
argStream.ReadVector2D(vecPosition);
pShape->AddPoint(vecPosition);
pShape->AddPoint(vecPointList[i]);
}

CElementGroup* pGroup = pResource->GetElementGroup();
Expand Down
2 changes: 1 addition & 1 deletion Server/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ int CLuaColShapeDefs::CreateColPolygon(lua_State* luaVM)
std::vector<CVector2D> vecPointList;

CScriptArgReader argStream(luaVM);
for (uint i = 0; i < 4 || argStream.NextCouldBeNumber(); i++)
for (uint i = 0; i < 4 || argStream.NextIsVector2D(); i++)
{
CVector2D vecPoint;
argStream.ReadVector2D(vecPoint);
Expand Down