Skip to content

Commit 37b8bf5

Browse files
author
CrosRoad95
committed
string enum and fixed variable name
1 parent 76174d1 commit 37b8bf5

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

Client/mods/deathmatch/logic/luadefs/CLuaColShapeDefs.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void CLuaColShapeDefs::AddClass ( lua_State* luaVM )
3838
lua_classfunction ( luaVM, "getShapeType", "getColShapeType" );
3939

4040
lua_classvariable ( luaVM, "elementsWithin", NULL, "getElementsWithinColShape" );
41-
lua_classvariable ( luaVM, "shape", NULL, "getColShapeType" );
41+
lua_classvariable ( luaVM, "shapeType", NULL, "getColShapeType" );
4242

4343
lua_registerclass ( luaVM, "ColShape", "Element" );
4444
}
@@ -56,7 +56,29 @@ int CLuaColShapeDefs::GetColShapeType ( lua_State* luaVM )
5656
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
5757
if (pLuaMain)
5858
{
59-
lua_pushnumber ( luaVM, pColShape->GetShapeType( ) + 1 );
59+
switch ( pColShape->GetShapeType( ) )
60+
{
61+
case 0:
62+
lua_pushstring(luaVM, "Circle");
63+
break;
64+
case 1:
65+
lua_pushstring(luaVM, "Cuboid");
66+
break;
67+
case 2:
68+
lua_pushstring(luaVM, "Sphere");
69+
break;
70+
case 3:
71+
lua_pushstring(luaVM, "Rectangle");
72+
break;
73+
case 4:
74+
lua_pushstring(luaVM, "Polygon");
75+
break;
76+
case 5:
77+
lua_pushstring(luaVM, "Tube");
78+
break;
79+
default:
80+
lua_pushboolean(luaVM, false);
81+
}
6082
return 1;
6183
}
6284
}

0 commit comments

Comments
 (0)