| 1064 | return 0; |
| 1065 | } |
| 1066 | int lightingEngineViewscreen::parseCreatures(lua_State* L) |
| 1067 | { |
| 1068 | auto engine= (lightingEngineViewscreen*)lua_touserdata(L, 1); |
| 1069 | engine->creatureDefs.clear(); |
| 1070 | Lua::StackUnwinder unwinder(L); |
| 1071 | lua_getfield(L,2,"creatures"); |
| 1072 | if(!lua_istable(L,-1)) |
| 1073 | { |
| 1074 | luaL_error(L,"Creatures table not found."); |
| 1075 | return 0; |
| 1076 | } |
| 1077 | lua_pushnil(L); |
| 1078 | while (lua_next(L, -2) != 0) { |
| 1079 | if(!lua_istable(L,-1)) |
| 1080 | luaL_error(L,"Broken creature definitions."); |
| 1081 | lua_getfield(L,-1,"race"); |
| 1082 | int race=lua_tonumber(L,-1); |
| 1083 | lua_pop(L,1); |
| 1084 | lua_getfield(L,-1,"caste"); |
| 1085 | int caste=lua_tonumber(L,-1); |
| 1086 | lua_pop(L,1); |
| 1087 | creatureLightDef cr; |
| 1088 | lua_getfield(L,-1,"light"); |
| 1089 | cr.light=lua_parseMatDef(L); |
| 1090 | engine->creatureDefs[std::make_pair(race,caste)]=cr; |
| 1091 | lua_pop(L,2); |
| 1092 | } |
| 1093 | lua_pop(L,1); |
| 1094 | return 0; |
| 1095 | } |
| 1096 | int lightingEngineViewscreen::parseBuildings(lua_State* L) |
| 1097 | { |
| 1098 | auto engine= (lightingEngineViewscreen*)lua_touserdata(L, 1); |
nothing calls this directly
no test coverage detected