MCPcopy Create free account
hub / github.com/DFHack/dfhack / parseCreatures

Method parseCreatures

plugins/rendermax/renderer_light.cpp:1066–1095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1064 return 0;
1065}
1066int 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}
1096int lightingEngineViewscreen::parseBuildings(lua_State* L)
1097{
1098 auto engine= (lightingEngineViewscreen*)lua_touserdata(L, 1);

Callers

nothing calls this directly

Calls 7

lua_touserdataFunction · 0.85
lua_getfieldFunction · 0.85
luaL_errorFunction · 0.85
lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
lua_parseMatDefFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected