| 1094 | return 0; |
| 1095 | } |
| 1096 | int lightingEngineViewscreen::parseBuildings(lua_State* L) |
| 1097 | { |
| 1098 | auto engine= (lightingEngineViewscreen*)lua_touserdata(L, 1); |
| 1099 | engine->buildingDefs.clear(); |
| 1100 | Lua::StackUnwinder unwinder(L); |
| 1101 | lua_getfield(L,2,"buildings"); |
| 1102 | if(!lua_istable(L,-1)) |
| 1103 | { |
| 1104 | luaL_error(L,"Buildings table not found."); |
| 1105 | return 0; |
| 1106 | } |
| 1107 | lua_pushnil(L); |
| 1108 | while (lua_next(L, -2) != 0) { |
| 1109 | int type=lua_tonumber(L,-2); |
| 1110 | if(!lua_istable(L,-1)) |
| 1111 | { |
| 1112 | luaL_error(L,"Broken building definitions."); |
| 1113 | } |
| 1114 | //os->print("Processing type:%d\n",type); |
| 1115 | lua_pushnil(L); |
| 1116 | while (lua_next(L, -2) != 0) { |
| 1117 | int subtype=lua_tonumber(L,-2); |
| 1118 | //os->print("\tProcessing subtype:%d\n",index); |
| 1119 | lua_pushnil(L); |
| 1120 | while (lua_next(L, -2) != 0) { |
| 1121 | int custom=lua_tonumber(L,-2); |
| 1122 | //os->print("\tProcessing custom:%d\n",index); |
| 1123 | buildingLightDef current; |
| 1124 | current.light=lua_parseMatDef(L); |
| 1125 | engine->buildingDefs[std::make_tuple(type,subtype,custom)]=current; |
| 1126 | GETLUAFLAG(current.poweredOnly,"poweredOnly"); |
| 1127 | GETLUAFLAG(current.useMaterial,"useMaterial"); |
| 1128 | |
| 1129 | lua_getfield(L,-1,"size"); |
| 1130 | current.size=luaL_optnumber(L,-1,1); |
| 1131 | lua_pop(L,1); |
| 1132 | |
| 1133 | lua_getfield(L,-1,"thickness"); |
| 1134 | current.thickness=luaL_optnumber(L,-1,1); |
| 1135 | lua_pop(L,1); |
| 1136 | |
| 1137 | lua_pop(L, 1); |
| 1138 | } |
| 1139 | |
| 1140 | lua_pop(L, 1); |
| 1141 | } |
| 1142 | lua_pop(L, 1); |
| 1143 | } |
| 1144 | lua_pop(L,1); |
| 1145 | return 0; |
| 1146 | } |
| 1147 | void lightingEngineViewscreen::defaultSettings() |
| 1148 | { |
| 1149 | matAmbience=matLightDef(rgbf(0.85f,0.85f,0.85f)); |
nothing calls this directly
no test coverage detected