MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / loadMapResources

Method loadMapResources

src/Savegame/SavedBattleGame.cpp:318–349  ·  view source on GitHub ↗

* Loads the resources required by the map in the battle save. * @param game Pointer to the game. */

Source from the content-addressed store, hash-verified

316 * @param game Pointer to the game.
317 */
318void SavedBattleGame::loadMapResources(Game *game)
319{
320 ResourcePack *res = game->getResourcePack();
321 for (std::vector<MapDataSet*>::const_iterator i = _mapDataSets.begin(); i != _mapDataSets.end(); ++i)
322 {
323 (*i)->loadData();
324 if (game->getRuleset()->getMCDPatch((*i)->getName()))
325 {
326 game->getRuleset()->getMCDPatch((*i)->getName())->modifyData(*i);
327 }
328 }
329
330 int mdsID, mdID;
331
332 for (int i = 0; i < _mapsize_z * _mapsize_y * _mapsize_x; ++i)
333 {
334 for (int part = 0; part < 4; part++)
335 {
336 _tiles[i]->getMapData(&mdID, &mdsID, part);
337 if (mdID != -1 && mdsID != -1)
338 {
339 _tiles[i]->setMapData(_mapDataSets[mdsID]->getObjects()->at(mdID), mdID, mdsID, part);
340 }
341 }
342 }
343
344 initUtilities(res);
345 getTileEngine()->calculateSunShading();
346 getTileEngine()->calculateTerrainLighting();
347 getTileEngine()->calculateUnitLighting();
348 getTileEngine()->recalculateFOV();
349}
350
351/**
352 * Saves the saved battle game to a YAML file.

Callers 1

initMethod · 0.80

Calls 13

loadDataMethod · 0.80
getMCDPatchMethod · 0.80
modifyDataMethod · 0.80
setMapDataMethod · 0.80
getObjectsMethod · 0.80
calculateSunShadingMethod · 0.80
calculateUnitLightingMethod · 0.80
recalculateFOVMethod · 0.80
getResourcePackMethod · 0.45
getRulesetMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected