2
0

CMap.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. /*
  2. * CMap.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "CMap.h"
  12. #include "../CArtHandler.h"
  13. #include "../VCMI_Lib.h"
  14. #include "../CCreatureHandler.h"
  15. #include "../CTownHandler.h"
  16. #include "../CHeroHandler.h"
  17. #include "../RiverHandler.h"
  18. #include "../RoadHandler.h"
  19. #include "../TerrainHandler.h"
  20. #include "../mapObjects/CGHeroInstance.h"
  21. #include "../mapObjects/ObjectTemplate.h"
  22. #include "../CGeneralTextHandler.h"
  23. #include "../spells/CSpellHandler.h"
  24. #include "../CSkillHandler.h"
  25. #include "CMapEditManager.h"
  26. #include "CMapOperation.h"
  27. #include "../serializer/JsonSerializeFormat.h"
  28. VCMI_LIB_NAMESPACE_BEGIN
  29. void Rumor::serializeJson(JsonSerializeFormat & handler)
  30. {
  31. handler.serializeString("name", name);
  32. handler.serializeStruct("text", text);
  33. }
  34. DisposedHero::DisposedHero() : heroId(0), portrait(255)
  35. {
  36. }
  37. CMapEvent::CMapEvent() : players(0), humanAffected(0), computerAffected(0),
  38. firstOccurence(0), nextOccurence(0)
  39. {
  40. }
  41. bool CMapEvent::earlierThan(const CMapEvent & other) const
  42. {
  43. return firstOccurence < other.firstOccurence;
  44. }
  45. bool CMapEvent::earlierThanOrEqual(const CMapEvent & other) const
  46. {
  47. return firstOccurence <= other.firstOccurence;
  48. }
  49. void CMapEvent::serializeJson(JsonSerializeFormat & handler)
  50. {
  51. handler.serializeString("name", name);
  52. handler.serializeStruct("message", message);
  53. handler.serializeInt("players", players);
  54. handler.serializeInt("humanAffected", humanAffected);
  55. handler.serializeInt("computerAffected", computerAffected);
  56. handler.serializeInt("firstOccurence", firstOccurence);
  57. handler.serializeInt("nextOccurence", nextOccurence);
  58. resources.serializeJson(handler, "resources");
  59. }
  60. void CCastleEvent::serializeJson(JsonSerializeFormat & handler)
  61. {
  62. CMapEvent::serializeJson(handler);
  63. handler.serializeIdArray("buildings", buildings);
  64. {
  65. auto a = handler.enterArray("creatures");
  66. a.syncSize(creatures);
  67. for(int i = 0; i < creatures.size(); ++i)
  68. a.serializeInt(i, creatures[i]);
  69. }
  70. }
  71. TerrainTile::TerrainTile():
  72. terType(nullptr),
  73. terView(0),
  74. riverType(VLC->riverTypeHandler->getById(River::NO_RIVER)),
  75. riverDir(0),
  76. roadType(VLC->roadTypeHandler->getById(Road::NO_ROAD)),
  77. roadDir(0),
  78. extTileFlags(0),
  79. visitable(false),
  80. blocked(false)
  81. {
  82. }
  83. bool TerrainTile::entrableTerrain(const TerrainTile * from) const
  84. {
  85. return entrableTerrain(from ? from->terType->isLand() : true, from ? from->terType->isWater() : true);
  86. }
  87. bool TerrainTile::entrableTerrain(bool allowLand, bool allowSea) const
  88. {
  89. return terType->isPassable()
  90. && ((allowSea && terType->isWater()) || (allowLand && terType->isLand()));
  91. }
  92. bool TerrainTile::isClear(const TerrainTile * from) const
  93. {
  94. return entrableTerrain(from) && !blocked;
  95. }
  96. Obj TerrainTile::topVisitableId(bool excludeTop) const
  97. {
  98. return topVisitableObj(excludeTop) ? topVisitableObj(excludeTop)->ID : Obj(Obj::NO_OBJ);
  99. }
  100. CGObjectInstance * TerrainTile::topVisitableObj(bool excludeTop) const
  101. {
  102. if(visitableObjects.empty() || (excludeTop && visitableObjects.size() == 1))
  103. return nullptr;
  104. if(excludeTop)
  105. return visitableObjects[visitableObjects.size()-2];
  106. return visitableObjects.back();
  107. }
  108. EDiggingStatus TerrainTile::getDiggingStatus(const bool excludeTop) const
  109. {
  110. if(terType->isWater() || !terType->isPassable())
  111. return EDiggingStatus::WRONG_TERRAIN;
  112. int allowedBlocked = excludeTop ? 1 : 0;
  113. if(blockingObjects.size() > allowedBlocked || topVisitableObj(excludeTop))
  114. return EDiggingStatus::TILE_OCCUPIED;
  115. else
  116. return EDiggingStatus::CAN_DIG;
  117. }
  118. bool TerrainTile::hasFavorableWinds() const
  119. {
  120. return extTileFlags & 128;
  121. }
  122. bool TerrainTile::isWater() const
  123. {
  124. return terType->isWater();
  125. }
  126. CMap::CMap()
  127. : checksum(0)
  128. , grailPos(-1, -1, -1)
  129. , grailRadius(0)
  130. , uidCounter(0)
  131. {
  132. allHeroes.resize(allowedHeroes.size());
  133. allowedAbilities = VLC->skillh->getDefaultAllowed();
  134. allowedArtifact = VLC->arth->getDefaultAllowed();
  135. allowedSpells = VLC->spellh->getDefaultAllowed();
  136. }
  137. CMap::~CMap()
  138. {
  139. getEditManager()->getUndoManager().clearAll();
  140. for(auto obj : objects)
  141. obj.dellNull();
  142. for(auto quest : quests)
  143. quest.dellNull();
  144. resetStaticData();
  145. }
  146. void CMap::removeBlockVisTiles(CGObjectInstance * obj, bool total)
  147. {
  148. const int zVal = obj->pos.z;
  149. for(int fx = 0; fx < obj->getWidth(); ++fx)
  150. {
  151. int xVal = obj->pos.x - fx;
  152. for(int fy = 0; fy < obj->getHeight(); ++fy)
  153. {
  154. int yVal = obj->pos.y - fy;
  155. if(xVal>=0 && xVal < width && yVal>=0 && yVal < height)
  156. {
  157. TerrainTile & curt = terrain[zVal][xVal][yVal];
  158. if(total || obj->visitableAt(xVal, yVal))
  159. {
  160. curt.visitableObjects -= obj;
  161. curt.visitable = curt.visitableObjects.size();
  162. }
  163. if(total || obj->blockingAt(xVal, yVal))
  164. {
  165. curt.blockingObjects -= obj;
  166. curt.blocked = curt.blockingObjects.size();
  167. }
  168. }
  169. }
  170. }
  171. }
  172. void CMap::addBlockVisTiles(CGObjectInstance * obj)
  173. {
  174. const int zVal = obj->pos.z;
  175. for(int fx = 0; fx < obj->getWidth(); ++fx)
  176. {
  177. int xVal = obj->pos.x - fx;
  178. for(int fy = 0; fy < obj->getHeight(); ++fy)
  179. {
  180. int yVal = obj->pos.y - fy;
  181. if(xVal>=0 && xVal < width && yVal >= 0 && yVal < height)
  182. {
  183. TerrainTile & curt = terrain[zVal][xVal][yVal];
  184. if(obj->visitableAt(xVal, yVal))
  185. {
  186. curt.visitableObjects.push_back(obj);
  187. curt.visitable = true;
  188. }
  189. if(obj->blockingAt(xVal, yVal))
  190. {
  191. curt.blockingObjects.push_back(obj);
  192. curt.blocked = true;
  193. }
  194. }
  195. }
  196. }
  197. }
  198. void CMap::calculateGuardingGreaturePositions()
  199. {
  200. int levels = twoLevel ? 2 : 1;
  201. for(int z = 0; z < levels; z++)
  202. {
  203. for(int x = 0; x < width; x++)
  204. {
  205. for(int y = 0; y < height; y++)
  206. {
  207. guardingCreaturePositions[z][x][y] = guardingCreaturePosition(int3(x, y, z));
  208. }
  209. }
  210. }
  211. }
  212. CGHeroInstance * CMap::getHero(HeroTypeID heroID)
  213. {
  214. for(auto & elem : heroesOnMap)
  215. if(elem->getHeroType() == heroID)
  216. return elem;
  217. return nullptr;
  218. }
  219. bool CMap::isCoastalTile(const int3 & pos) const
  220. {
  221. //todo: refactoring: extract neighbor tile iterator and use it in GameState
  222. static const int3 dirs[] = { int3(0,1,0),int3(0,-1,0),int3(-1,0,0),int3(+1,0,0),
  223. int3(1,1,0),int3(-1,1,0),int3(1,-1,0),int3(-1,-1,0) };
  224. if(!isInTheMap(pos))
  225. {
  226. logGlobal->error("Coastal check outside of map: %s", pos.toString());
  227. return false;
  228. }
  229. if(isWaterTile(pos))
  230. return false;
  231. for(const auto & dir : dirs)
  232. {
  233. const int3 hlp = pos + dir;
  234. if(!isInTheMap(hlp))
  235. continue;
  236. const TerrainTile &hlpt = getTile(hlp);
  237. if(hlpt.isWater())
  238. return true;
  239. }
  240. return false;
  241. }
  242. bool CMap::isInTheMap(const int3 & pos) const
  243. {
  244. return pos.x >= 0 && pos.y >= 0 && pos.z >= 0 && pos.x < width && pos.y < height && pos.z <= (twoLevel ? 1 : 0);
  245. }
  246. TerrainTile & CMap::getTile(const int3 & tile)
  247. {
  248. assert(isInTheMap(tile));
  249. return terrain[tile.z][tile.x][tile.y];
  250. }
  251. const TerrainTile & CMap::getTile(const int3 & tile) const
  252. {
  253. assert(isInTheMap(tile));
  254. return terrain[tile.z][tile.x][tile.y];
  255. }
  256. bool CMap::isWaterTile(const int3 &pos) const
  257. {
  258. return isInTheMap(pos) && getTile(pos).isWater();
  259. }
  260. bool CMap::canMoveBetween(const int3 &src, const int3 &dst) const
  261. {
  262. const TerrainTile * dstTile = &getTile(dst);
  263. const TerrainTile * srcTile = &getTile(src);
  264. return checkForVisitableDir(src, dstTile, dst) && checkForVisitableDir(dst, srcTile, src);
  265. }
  266. bool CMap::checkForVisitableDir(const int3 & src, const TerrainTile * pom, const int3 & dst) const
  267. {
  268. if (!pom->entrableTerrain()) //rock is never accessible
  269. return false;
  270. for(auto * obj : pom->visitableObjects) //checking destination tile
  271. {
  272. if(!vstd::contains(pom->blockingObjects, obj)) //this visitable object is not blocking, ignore
  273. continue;
  274. if (!obj->appearance->isVisitableFrom(src.x - dst.x, src.y - dst.y))
  275. return false;
  276. }
  277. return true;
  278. }
  279. int3 CMap::guardingCreaturePosition (int3 pos) const
  280. {
  281. const int3 originalPos = pos;
  282. // Give monster at position priority.
  283. if (!isInTheMap(pos))
  284. return int3(-1, -1, -1);
  285. const TerrainTile &posTile = getTile(pos);
  286. if (posTile.visitable)
  287. {
  288. for (CGObjectInstance* obj : posTile.visitableObjects)
  289. {
  290. if(obj->isBlockedVisitable())
  291. {
  292. if (obj->ID == Obj::MONSTER) // Monster
  293. return pos;
  294. else
  295. return int3(-1, -1, -1); //blockvis objects are not guarded by neighbouring creatures
  296. }
  297. }
  298. }
  299. // See if there are any monsters adjacent.
  300. bool water = posTile.isWater();
  301. pos -= int3(1, 1, 0); // Start with top left.
  302. for (int dx = 0; dx < 3; dx++)
  303. {
  304. for (int dy = 0; dy < 3; dy++)
  305. {
  306. if (isInTheMap(pos))
  307. {
  308. const auto & tile = getTile(pos);
  309. if (tile.visitable && (tile.isWater() == water))
  310. {
  311. for (CGObjectInstance* obj : tile.visitableObjects)
  312. {
  313. if (obj->ID == Obj::MONSTER && checkForVisitableDir(pos, &posTile, originalPos)) // Monster being able to attack investigated tile
  314. {
  315. return pos;
  316. }
  317. }
  318. }
  319. }
  320. pos.y++;
  321. }
  322. pos.y -= 3;
  323. pos.x++;
  324. }
  325. return int3(-1, -1, -1);
  326. }
  327. const CGObjectInstance * CMap::getObjectiveObjectFrom(const int3 & pos, Obj type)
  328. {
  329. for (CGObjectInstance * object : getTile(pos).visitableObjects)
  330. {
  331. if (object->ID == type)
  332. return object;
  333. }
  334. // There is weird bug because of which sometimes heroes will not be found properly despite having correct position
  335. // Try to workaround that and find closest object that we can use
  336. logGlobal->error("Failed to find object of type %d at %s", type.getNum(), pos.toString());
  337. logGlobal->error("Will try to find closest matching object");
  338. CGObjectInstance * bestMatch = nullptr;
  339. for (CGObjectInstance * object : objects)
  340. {
  341. if (object && object->ID == type)
  342. {
  343. if (bestMatch == nullptr)
  344. bestMatch = object;
  345. else
  346. {
  347. if (object->pos.dist2dSQ(pos) < bestMatch->pos.dist2dSQ(pos))
  348. bestMatch = object;// closer than one we already found
  349. }
  350. }
  351. }
  352. assert(bestMatch != nullptr); // if this happens - victory conditions or map itself is very, very broken
  353. logGlobal->error("Will use %s from %s", bestMatch->getObjectName(), bestMatch->pos.toString());
  354. return bestMatch;
  355. }
  356. void CMap::checkForObjectives()
  357. {
  358. // NOTE: probably should be moved to MapFormatH3M.cpp
  359. for (TriggeredEvent & event : triggeredEvents)
  360. {
  361. auto patcher = [&](EventCondition cond) -> EventExpression::Variant
  362. {
  363. switch (cond.condition)
  364. {
  365. case EventCondition::HAVE_ARTIFACT:
  366. event.onFulfill.replaceTextID(VLC->artifacts()->getByIndex(cond.objectType)->getNameTextID());
  367. break;
  368. case EventCondition::HAVE_CREATURES:
  369. event.onFulfill.replaceTextID(VLC->creatures()->getByIndex(cond.objectType)->getNameSingularTextID());
  370. event.onFulfill.replaceNumber(cond.value);
  371. break;
  372. case EventCondition::HAVE_RESOURCES:
  373. event.onFulfill.replaceLocalString(EMetaText::RES_NAMES, cond.objectType);
  374. event.onFulfill.replaceNumber(cond.value);
  375. break;
  376. case EventCondition::HAVE_BUILDING:
  377. if (isInTheMap(cond.position))
  378. cond.object = getObjectiveObjectFrom(cond.position, Obj::TOWN);
  379. break;
  380. case EventCondition::CONTROL:
  381. if (isInTheMap(cond.position))
  382. cond.object = getObjectiveObjectFrom(cond.position, static_cast<Obj>(cond.objectType));
  383. if (cond.object)
  384. {
  385. const auto * town = dynamic_cast<const CGTownInstance *>(cond.object);
  386. if (town)
  387. event.onFulfill.replaceRawString(town->getNameTranslated());
  388. const auto * hero = dynamic_cast<const CGHeroInstance *>(cond.object);
  389. if (hero)
  390. event.onFulfill.replaceRawString(hero->getNameTranslated());
  391. }
  392. break;
  393. case EventCondition::DESTROY:
  394. if (isInTheMap(cond.position))
  395. cond.object = getObjectiveObjectFrom(cond.position, static_cast<Obj>(cond.objectType));
  396. if (cond.object)
  397. {
  398. const auto * hero = dynamic_cast<const CGHeroInstance *>(cond.object);
  399. if (hero)
  400. event.onFulfill.replaceRawString(hero->getNameTranslated());
  401. }
  402. break;
  403. case EventCondition::TRANSPORT:
  404. cond.object = getObjectiveObjectFrom(cond.position, Obj::TOWN);
  405. break;
  406. //break; case EventCondition::DAYS_PASSED:
  407. //break; case EventCondition::IS_HUMAN:
  408. //break; case EventCondition::DAYS_WITHOUT_TOWN:
  409. //break; case EventCondition::STANDARD_WIN:
  410. //TODO: support new condition format
  411. case EventCondition::HAVE_0:
  412. break;
  413. case EventCondition::DESTROY_0:
  414. break;
  415. case EventCondition::HAVE_BUILDING_0:
  416. break;
  417. }
  418. return cond;
  419. };
  420. event.trigger = event.trigger.morph(patcher);
  421. }
  422. }
  423. void CMap::addNewArtifactInstance(ConstTransitivePtr<CArtifactInstance> art)
  424. {
  425. art->setId(static_cast<ArtifactInstanceID>(artInstances.size()));
  426. artInstances.emplace_back(art);
  427. }
  428. void CMap::eraseArtifactInstance(CArtifactInstance * art)
  429. {
  430. //TODO: handle for artifacts removed in map editor
  431. assert(artInstances[art->getId().getNum()] == art);
  432. artInstances[art->getId().getNum()].dellNull();
  433. }
  434. void CMap::addNewQuestInstance(CQuest* quest)
  435. {
  436. quest->qid = static_cast<si32>(quests.size());
  437. quests.emplace_back(quest);
  438. }
  439. void CMap::removeQuestInstance(CQuest * quest)
  440. {
  441. //TODO: should be called only by map editor.
  442. //During game, completed quests or quests from removed objects stay forever
  443. //Shift indexes
  444. auto iter = std::next(quests.begin(), quest->qid);
  445. iter = quests.erase(iter);
  446. for (int i = quest->qid; iter != quests.end(); ++i, ++iter)
  447. {
  448. (*iter)->qid = i;
  449. }
  450. }
  451. void CMap::setUniqueInstanceName(CGObjectInstance * obj)
  452. {
  453. //this gives object unique name even if objects are removed later
  454. auto uid = uidCounter++;
  455. boost::format fmt("%s_%d");
  456. fmt % obj->typeName % uid;
  457. obj->instanceName = fmt.str();
  458. }
  459. void CMap::addNewObject(CGObjectInstance * obj)
  460. {
  461. if(obj->id != ObjectInstanceID(static_cast<si32>(objects.size())))
  462. throw std::runtime_error("Invalid object instance id");
  463. if(obj->instanceName.empty())
  464. throw std::runtime_error("Object instance name missing");
  465. if (vstd::contains(instanceNames, obj->instanceName))
  466. throw std::runtime_error("Object instance name duplicated: "+obj->instanceName);
  467. objects.emplace_back(obj);
  468. instanceNames[obj->instanceName] = obj;
  469. addBlockVisTiles(obj);
  470. //TODO: how about defeated heroes recruited again?
  471. obj->afterAddToMap(this);
  472. }
  473. void CMap::moveObject(CGObjectInstance * obj, const int3 & pos)
  474. {
  475. removeBlockVisTiles(obj);
  476. obj->pos = pos;
  477. addBlockVisTiles(obj);
  478. }
  479. void CMap::removeObject(CGObjectInstance * obj)
  480. {
  481. removeBlockVisTiles(obj);
  482. instanceNames.erase(obj->instanceName);
  483. //update indeces
  484. auto iter = std::next(objects.begin(), obj->id.getNum());
  485. iter = objects.erase(iter);
  486. for(int i = obj->id.getNum(); iter != objects.end(); ++i, ++iter)
  487. {
  488. (*iter)->id = ObjectInstanceID(i);
  489. }
  490. obj->afterRemoveFromMap(this);
  491. //TOOD: Clean artifact instances (mostly worn by hero?) and quests related to this object
  492. }
  493. bool CMap::isWaterMap() const
  494. {
  495. return waterMap;
  496. }
  497. bool CMap::calculateWaterContent()
  498. {
  499. size_t totalTiles = height * width * levels();
  500. size_t waterTiles = 0;
  501. for(auto tile = terrain.origin(); tile < (terrain.origin() + terrain.num_elements()); ++tile)
  502. {
  503. if (tile->isWater())
  504. {
  505. waterTiles++;
  506. }
  507. }
  508. if (waterTiles >= totalTiles / 100) //At least 1% of area is water
  509. {
  510. waterMap = true;
  511. }
  512. return waterMap;
  513. }
  514. void CMap::banWaterContent()
  515. {
  516. banWaterHeroes();
  517. banWaterArtifacts();
  518. banWaterSpells();
  519. banWaterSkills();
  520. }
  521. void CMap::banWaterSpells()
  522. {
  523. for (int j = 0; j < allowedSpells.size(); j++)
  524. {
  525. if (allowedSpells[j])
  526. {
  527. auto* spell = dynamic_cast<const CSpell*>(VLC->spells()->getByIndex(j));
  528. if (spell->onlyOnWaterMap && !isWaterMap())
  529. {
  530. allowedSpells[j] = false;
  531. }
  532. }
  533. }
  534. }
  535. void CMap::banWaterArtifacts()
  536. {
  537. for (int j = 0; j < allowedArtifact.size(); j++)
  538. {
  539. if (allowedArtifact[j])
  540. {
  541. auto* art = dynamic_cast<const CArtifact*>(VLC->artifacts()->getByIndex(j));
  542. if (art->onlyOnWaterMap && !isWaterMap())
  543. {
  544. allowedArtifact[j] = false;
  545. }
  546. }
  547. }
  548. }
  549. void CMap::banWaterSkills()
  550. {
  551. for (int j = 0; j < allowedAbilities.size(); j++)
  552. {
  553. if (allowedAbilities[j])
  554. {
  555. auto* skill = dynamic_cast<const CSkill*>(VLC->skills()->getByIndex(j));
  556. if (skill->onlyOnWaterMap && !isWaterMap())
  557. {
  558. allowedAbilities[j] = false;
  559. }
  560. }
  561. }
  562. }
  563. void CMap::banWaterHeroes()
  564. {
  565. for (int j = 0; j < allowedHeroes.size(); j++)
  566. {
  567. if (allowedHeroes[j])
  568. {
  569. auto* h = dynamic_cast<const CHero*>(VLC->heroTypes()->getByIndex(j));
  570. if ((h->onlyOnWaterMap && !isWaterMap()) || (h->onlyOnMapWithoutWater && isWaterMap()))
  571. {
  572. banHero(HeroTypeID(j));
  573. }
  574. }
  575. }
  576. }
  577. void CMap::banHero(const HeroTypeID & id)
  578. {
  579. allowedHeroes.at(id) = false;
  580. }
  581. void CMap::initTerrain()
  582. {
  583. terrain.resize(boost::extents[levels()][width][height]);
  584. guardingCreaturePositions.resize(boost::extents[levels()][width][height]);
  585. }
  586. CMapEditManager * CMap::getEditManager()
  587. {
  588. if(!editManager) editManager = std::make_unique<CMapEditManager>(this);
  589. return editManager.get();
  590. }
  591. void CMap::resetStaticData()
  592. {
  593. CGKeys::reset();
  594. CGMagi::reset();
  595. CGObelisk::reset();
  596. CGTownInstance::reset();
  597. }
  598. VCMI_LIB_NAMESPACE_END