File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Client/mods/deathmatch/logic/luadefs
Server/mods/deathmatch/logic/luadefs Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,15 @@ int CLuaColShapeDefs::CreateColPolygon(lua_State* luaVM)
255
255
CScriptArgReader argStream (luaVM);
256
256
argStream.ReadVector2D (vecPosition);
257
257
258
+ // Get the points
259
+ std::vector<CVector2D> vecPointList;
260
+ for (uint i = 0 ; i < 3 || argStream.NextIsVector2D (); i++)
261
+ {
262
+ CVector2D vecPoint;
263
+ argStream.ReadVector2D (vecPoint);
264
+ vecPointList.push_back (vecPoint);
265
+ }
266
+
258
267
if (!argStream.HasErrors ())
259
268
{
260
269
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine (luaVM);
@@ -267,11 +276,10 @@ int CLuaColShapeDefs::CreateColPolygon(lua_State* luaVM)
267
276
CClientColPolygon* pShape = CStaticFunctionDefinitions::CreateColPolygon (*pResource, vecPosition);
268
277
if (pShape)
269
278
{
270
- // Get the points
271
- while (argStream. NextCouldBeNumber () && argStream. NextCouldBeNumber ( 1 ) )
279
+ // Add the points
280
+ for (uint i = 0 ; i < vecPointList. size (); i++ )
272
281
{
273
- argStream.ReadVector2D (vecPosition);
274
- pShape->AddPoint (vecPosition);
282
+ pShape->AddPoint (vecPointList[i]);
275
283
}
276
284
277
285
CElementGroup* pGroup = pResource->GetElementGroup ();
Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ int CLuaColShapeDefs::CreateColPolygon(lua_State* luaVM)
249
249
std::vector<CVector2D> vecPointList;
250
250
251
251
CScriptArgReader argStream (luaVM);
252
- for (uint i = 0 ; i < 4 || argStream.NextCouldBeNumber (); i++)
252
+ for (uint i = 0 ; i < 4 || argStream.NextIsVector2D (); i++)
253
253
{
254
254
CVector2D vecPoint;
255
255
argStream.ReadVector2D (vecPoint);
You can’t perform that action at this time.
0 commit comments