* Loads the resources required by the map in the battle save. * @param game Pointer to the game. */
| 316 | * @param game Pointer to the game. |
| 317 | */ |
| 318 | void 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. |
no test coverage detected