| 1028 | } |
| 1029 | #undef LOAD_SPECIAL |
| 1030 | int lightingEngineViewscreen::parseItems(lua_State* L) |
| 1031 | { |
| 1032 | auto engine= (lightingEngineViewscreen*)lua_touserdata(L, 1); |
| 1033 | engine->itemDefs.clear(); |
| 1034 | Lua::StackUnwinder unwinder(L); |
| 1035 | lua_getfield(L,2,"items"); |
| 1036 | if(!lua_istable(L,-1)) |
| 1037 | { |
| 1038 | luaL_error(L,"Items table not found."); |
| 1039 | return 0; |
| 1040 | } |
| 1041 | lua_pushnil(L); |
| 1042 | while (lua_next(L, -2) != 0) { |
| 1043 | if(!lua_istable(L,-1)) |
| 1044 | luaL_error(L,"Broken item definitions."); |
| 1045 | lua_getfield(L,-1,"type"); |
| 1046 | int type=lua_tonumber(L,-1); |
| 1047 | lua_pop(L,1); |
| 1048 | lua_getfield(L,-1,"subtype"); |
| 1049 | int subtype=luaL_optinteger(L,-1,-1); |
| 1050 | lua_pop(L,1); |
| 1051 | itemLightDef item; |
| 1052 | lua_getfield(L,-1,"light"); |
| 1053 | item.light=lua_parseMatDef(L); |
| 1054 | GETLUAFLAG(item.haul,"hauling"); |
| 1055 | GETLUAFLAG(item.equiped,"equiped"); |
| 1056 | GETLUAFLAG(item.inBuilding,"inBuilding"); |
| 1057 | GETLUAFLAG(item.inContainer,"contained"); |
| 1058 | GETLUAFLAG(item.onGround,"onGround"); |
| 1059 | GETLUAFLAG(item.useMaterial,"useMaterial"); |
| 1060 | engine->itemDefs[std::make_pair(type,subtype)]=item; |
| 1061 | lua_pop(L,2); |
| 1062 | } |
| 1063 | lua_pop(L,1); |
| 1064 | return 0; |
| 1065 | } |
| 1066 | int lightingEngineViewscreen::parseCreatures(lua_State* L) |
| 1067 | { |
| 1068 | auto engine= (lightingEngineViewscreen*)lua_touserdata(L, 1); |
nothing calls this directly
no test coverage detected