BattleOnlyMode.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. /*
  2. * BattleOnlyMode.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 "BattleOnlyMode.h"
  12. #include "../CServerHandler.h"
  13. #include "../GameEngine.h"
  14. #include "../GameInstance.h"
  15. #include "../render/IRenderHandler.h"
  16. #include "../render/CAnimation.h"
  17. #include "../render/Canvas.h"
  18. #include "../render/CanvasImage.h"
  19. #include "../gui/Shortcut.h"
  20. #include "../gui/WindowHandler.h"
  21. #include "../widgets/Buttons.h"
  22. #include "../widgets/GraphicalPrimitiveCanvas.h"
  23. #include "../widgets/TextControls.h"
  24. #include "../widgets/CTextInput.h"
  25. #include "../widgets/Images.h"
  26. #include "../windows/GUIClasses.h"
  27. #include "../windows/CHeroOverview.h"
  28. #include "../windows/CCreatureWindow.h"
  29. #include "../../lib/GameLibrary.h"
  30. #include "../../lib/gameState/CGameState.h"
  31. #include "../../lib/StartInfo.h"
  32. #include "../../lib/VCMIDirs.h"
  33. #include "../../lib/CRandomGenerator.h"
  34. #include "../../lib/callback/EditorCallback.h"
  35. #include "../../lib/entities/hero/CHero.h"
  36. #include "../../lib/entities/hero/CHeroClass.h"
  37. #include "../../lib/entities/hero/CHeroHandler.h"
  38. #include "../../lib/entities/faction/CTown.h"
  39. #include "../../lib/entities/faction/CTownHandler.h"
  40. #include "../../lib/mapObjects/CGHeroInstance.h"
  41. #include "../../lib/mapObjects/CGTownInstance.h"
  42. #include "../../lib/mapObjectConstructors/AObjectTypeHandler.h"
  43. #include "../../lib/mapObjectConstructors/CObjectClassesHandler.h"
  44. #include "../../lib/mapping/CMap.h"
  45. #include "../../lib/mapping/CMapInfo.h"
  46. #include "../../lib/mapping/CMapEditManager.h"
  47. #include "../../lib/mapping/CMapService.h"
  48. #include "../../lib/mapping/MapFormat.h"
  49. #include "../../lib/texts/CGeneralTextHandler.h"
  50. #include "../../lib/texts/TextOperations.h"
  51. #include "../../lib/filesystem/Filesystem.h"
  52. void BattleOnlyMode::openBattleWindow()
  53. {
  54. ENGINE->windows().createAndPushWindow<BattleOnlyModeWindow>();
  55. }
  56. BattleOnlyModeWindow::BattleOnlyModeWindow()
  57. : CWindowObject(BORDERED)
  58. , selectedTerrain(TerrainId::DIRT)
  59. , selectedTown(FactionID::NONE)
  60. {
  61. OBJECT_CONSTRUCTION;
  62. pos.w = 519;
  63. pos.h = 238;
  64. updateShadow();
  65. center();
  66. init();
  67. backgroundTexture = std::make_shared<FilledTexturePlayerColored>(Rect(0, 0, pos.w, pos.h));
  68. backgroundTexture->setPlayerColor(PlayerColor(1));
  69. buttonOk = std::make_shared<CButton>(Point(191, 203), AnimationPath::builtin("MuBchck"), CButton::tooltip(), [this](){ startBattle(); }, EShortcut::GLOBAL_ACCEPT);
  70. buttonAbort = std::make_shared<CButton>(Point(265, 203), AnimationPath::builtin("MuBcanc"), CButton::tooltip(), [this](){ close(); }, EShortcut::GLOBAL_CANCEL);
  71. title = std::make_shared<CLabel>(260, 20, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW, LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyMode"));
  72. battlefieldSelector = std::make_shared<CButton>(Point(29, 174), AnimationPath::builtin("GSPButtonClear"), CButton::tooltip(), [this](){
  73. std::vector<std::string> texts;
  74. std::vector<std::shared_ptr<IImage>> images;
  75. auto & terrains = LIBRARY->terrainTypeHandler->objects;
  76. for (const auto & terrain : terrains)
  77. {
  78. texts.push_back(terrain->getNameTranslated());
  79. const auto & patterns = LIBRARY->terviewh->getTerrainViewPatterns(terrain->getId());
  80. TerrainViewPattern pattern;
  81. for(auto & p : patterns)
  82. if(p[0].id == "n1")
  83. pattern = p[0];
  84. auto image = ENGINE->renderHandler().loadImage(terrain->tilesFilename, pattern.mapping[0].first, 0, EImageBlitMode::OPAQUE);
  85. image->scaleTo(Point(23, 23), EScalingAlgorithm::NEAREST);
  86. images.push_back(image);
  87. }
  88. auto factions = LIBRARY->townh->getDefaultAllowed();
  89. for (const auto & faction : factions)
  90. {
  91. texts.push_back(faction.toFaction()->getNameTranslated());
  92. auto image = ENGINE->renderHandler().loadImage(AnimationPath::builtin("ITPA"), faction.toFaction()->town->clientInfo.icons[true][false] + 2, 0, EImageBlitMode::OPAQUE);
  93. image->scaleTo(Point(35, 23), EScalingAlgorithm::NEAREST);
  94. images.push_back(image);
  95. }
  96. ENGINE->windows().createAndPushWindow<CObjectListWindow>(texts, nullptr, LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyModeBattlefield"), LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyModeBattlefieldSelect"), [this, terrains, factions](int index){
  97. if(terrains.size() > index)
  98. {
  99. selectedTerrain = terrains[index]->getId();
  100. selectedTown = FactionID::NONE;
  101. }
  102. else
  103. {
  104. selectedTerrain = TerrainId::NONE;
  105. auto it = std::next(factions.begin(), index - terrains.size());
  106. if (it != factions.end())
  107. selectedTown = *it;
  108. }
  109. setTerrainButtonText();
  110. setOkButtonEnabled();
  111. }, (selectedTerrain != TerrainId::NONE ? static_cast<int>(selectedTerrain) : static_cast<int>(selectedTown + terrains.size())), images, true, true);
  112. });
  113. buttonReset = std::make_shared<CButton>(Point(289, 174), AnimationPath::builtin("GSPButtonClear"), CButton::tooltip(), [this](){
  114. selectedTerrain = TerrainId::DIRT;
  115. selectedTown = FactionID::NONE;
  116. setTerrainButtonText();
  117. setOkButtonEnabled();
  118. heroSelector1->selectedHero.reset();
  119. heroSelector2->selectedHero.reset();
  120. heroSelector1->selectedArmy->clearSlots();
  121. heroSelector2->selectedArmy->clearSlots();
  122. for(size_t i=0; i<GameConstants::ARMY_SIZE; i++)
  123. {
  124. heroSelector1->selectedArmyInput.at(i)->setText("1");
  125. heroSelector2->selectedArmyInput.at(i)->setText("1");
  126. }
  127. heroSelector1->setHeroIcon();
  128. heroSelector1->setCreatureIcons();
  129. heroSelector2->setHeroIcon();
  130. heroSelector2->setCreatureIcons();
  131. redraw();
  132. });
  133. buttonReset->setTextOverlay(LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyModeReset"), EFonts::FONT_SMALL, Colors::WHITE);
  134. setTerrainButtonText();
  135. setOkButtonEnabled();
  136. heroSelector1 = std::make_shared<BattleOnlyModeHeroSelector>(*this, Point(0, 40));
  137. heroSelector2 = std::make_shared<BattleOnlyModeHeroSelector>(*this, Point(260, 40));
  138. }
  139. void BattleOnlyModeWindow::init()
  140. {
  141. map = std::make_unique<CMap>(nullptr);
  142. map->version = EMapFormat::VCMI;
  143. map->creationDateTime = std::time(nullptr);
  144. map->width = 10;
  145. map->height = 10;
  146. map->mapLevels = 1;
  147. map->battleOnly = true;
  148. cb = std::make_unique<EditorCallback>(map.get());
  149. }
  150. void BattleOnlyModeWindow::setTerrainButtonText()
  151. {
  152. battlefieldSelector->setTextOverlay(LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyModeBattlefield") + ": " + (selectedTerrain != TerrainId::NONE ? selectedTerrain.toEntity(LIBRARY)->getNameTranslated() : selectedTown.toEntity(LIBRARY)->getNameTranslated()), EFonts::FONT_SMALL, Colors::WHITE);
  153. }
  154. void BattleOnlyModeWindow::setOkButtonEnabled()
  155. {
  156. bool canStart = (selectedTerrain != TerrainId::NONE || selectedTown != FactionID::NONE);
  157. canStart &= (heroSelector1 && heroSelector1->selectedHero && ((heroSelector2 && heroSelector2->selectedHero) || (selectedTown != FactionID::NONE && heroSelector2->selectedArmy->stacksCount())));
  158. buttonOk->block(!canStart);
  159. }
  160. std::shared_ptr<IImage> drawBlackBox(Point size, std::string text)
  161. {
  162. auto image = ENGINE->renderHandler().createImage(size, CanvasScalingPolicy::AUTO);
  163. Canvas canvas = image->getCanvas();
  164. canvas.drawColor(Rect(0, 0, size.x, size.y), Colors::BLACK);
  165. canvas.drawText(Point(size.x / 2, size.y / 2), FONT_TINY, Colors::WHITE, ETextAlignment::CENTER, text);
  166. return image;
  167. }
  168. BattleOnlyModeHeroSelector::BattleOnlyModeHeroSelector(BattleOnlyModeWindow& parent, Point position)
  169. : parent(parent)
  170. , selectedArmy(std::make_shared<CCreatureSet>())
  171. {
  172. OBJECT_CONSTRUCTION;
  173. pos.x += position.x;
  174. pos.y += position.y;
  175. backgroundImage = std::make_shared<CPicture>(ImagePath::builtin("heroSlotsBlue"), Point(3, 4));
  176. for(size_t i=0; i<GameConstants::PRIMARY_SKILLS; i++)
  177. {
  178. auto image = std::make_shared<CAnimImage>(AnimationPath::builtin("PSKIL32"), i, 0, 78 + i * 36, 26);
  179. primSkills.push_back(image);
  180. primSkillsBorder.push_back(std::make_shared<GraphicalPrimitiveCanvas>(Rect(78 + i * 36, 26, 32, 32)));
  181. primSkillsBorder.back()->addRectangle(Point(0, 0), Point(32, 32), ColorRGBA(44, 108, 255));
  182. primSkillsInput.push_back(std::make_shared<CTextInput>(Rect(78 + i * 36, 58, 32, 16), EFonts::FONT_SMALL, ETextAlignment::CENTER, false));
  183. primSkillsInput.back()->setFilterNumber(0, 100);
  184. primSkillsInput.back()->setText("0");
  185. }
  186. creatureImage.resize(GameConstants::ARMY_SIZE);
  187. for(size_t i=0; i<GameConstants::ARMY_SIZE; i++)
  188. {
  189. selectedArmyInput.push_back(std::make_shared<CTextInput>(Rect(5 + i * 36, 113, 32, 16), EFonts::FONT_SMALL, ETextAlignment::CENTER, false));
  190. selectedArmyInput.back()->setFilterNumber(1, 10000000, 3);
  191. selectedArmyInput.back()->setText("1");
  192. selectedArmyInput.back()->setCallback([this, i](const std::string & text){
  193. if(!selectedArmy->slotEmpty(SlotID(i)))
  194. selectedArmy->setCreature(SlotID(i), selectedArmy->getCreature(SlotID(i))->getId(), TextOperations::parseMetric<int>(text));
  195. });
  196. }
  197. setHeroIcon();
  198. setCreatureIcons();
  199. }
  200. void BattleOnlyModeHeroSelector::setHeroIcon()
  201. {
  202. OBJECT_CONSTRUCTION;
  203. if(!selectedHero)
  204. {
  205. heroImage = std::make_shared<CPicture>(drawBlackBox(Point(58, 64), LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyModeSelect")), Point(6, 7));
  206. heroLabel = std::make_shared<CLabel>(160, 16, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, LIBRARY->generaltexth->translate("core.genrltxt.507"));
  207. }
  208. else
  209. {
  210. heroImage = std::make_shared<CPicture>(ENGINE->renderHandler().loadAnimation(AnimationPath::builtin("PortraitsLarge"), EImageBlitMode::COLORKEY)->getImage(selectedHero->getHeroType()->imageIndex), Point(6, 7));
  211. heroLabel = std::make_shared<CLabel>(160, 16, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, selectedHero->getNameTranslated());
  212. }
  213. heroImage->addLClickCallback([this](){
  214. auto allowedSet = LIBRARY->heroh->getDefaultAllowed();
  215. std::vector<HeroTypeID> heroes(allowedSet.begin(), allowedSet.end());
  216. std::sort(heroes.begin(), heroes.end(), [](auto a, auto b) {
  217. auto heroA = a.toHeroType();
  218. auto heroB = b.toHeroType();
  219. if (heroA->heroClass->getId() == heroB->heroClass->getId())
  220. return heroA->getNameTranslated() < heroB->getNameTranslated();
  221. if (heroA->heroClass->faction == heroB->heroClass->faction)
  222. return heroA->heroClass->getId() < heroB->heroClass->getId();
  223. return heroA->heroClass->faction < heroB->heroClass->faction;
  224. });
  225. int selectedIndex = !selectedHero ? 0 : (1 + std::distance(heroes.begin(), std::find_if(heroes.begin(), heroes.end(), [this](auto heroID) {
  226. return heroID == selectedHero->getHeroType()->getId();
  227. })));
  228. std::vector<std::string> texts;
  229. std::vector<std::shared_ptr<IImage>> images;
  230. // Add "no hero" option
  231. texts.push_back(LIBRARY->generaltexth->translate("core.genrltxt.507"));
  232. images.push_back(nullptr);
  233. for (const auto & h : heroes)
  234. {
  235. texts.push_back(h.toHeroType()->getNameTranslated());
  236. auto image = ENGINE->renderHandler().loadImage(AnimationPath::builtin("PortraitsSmall"), h.toHeroType()->imageIndex, 0, EImageBlitMode::OPAQUE);
  237. image->scaleTo(Point(35, 23), EScalingAlgorithm::NEAREST);
  238. images.push_back(image);
  239. }
  240. auto window = std::make_shared<CObjectListWindow>(texts, nullptr, LIBRARY->generaltexth->translate("object.core.hero.name"), LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyModeHeroSelect"), [this, heroes](int index){
  241. if(index == 0)
  242. {
  243. selectedHero.reset();
  244. setHeroIcon();
  245. return;
  246. }
  247. index--;
  248. auto hero = heroes[index];
  249. auto factory = LIBRARY->objtypeh->getHandlerFor(Obj::HERO, hero.toHeroType()->heroClass->getId());
  250. auto templates = factory->getTemplates();
  251. auto obj = std::dynamic_pointer_cast<CGHeroInstance>(factory->create(parent.cb.get(), templates.front()));
  252. obj->setHeroType(hero);
  253. selectedHero = obj;
  254. setHeroIcon();
  255. parent.setOkButtonEnabled();
  256. }, selectedIndex, images, true, true);
  257. window->onPopup = [heroes](int index) {
  258. if(index == 0)
  259. return;
  260. index--;
  261. ENGINE->windows().createAndPushWindow<CHeroOverview>(heroes.at(index));
  262. };
  263. ENGINE->windows().pushWindow(window);
  264. });
  265. heroImage->addRClickCallback([this](){
  266. if(!selectedHero)
  267. return;
  268. ENGINE->windows().createAndPushWindow<CHeroOverview>(selectedHero->getHeroType()->getId());
  269. });
  270. }
  271. void BattleOnlyModeHeroSelector::setCreatureIcons()
  272. {
  273. OBJECT_CONSTRUCTION;
  274. for(int i = 0; i < creatureImage.size(); i++)
  275. {
  276. if(selectedArmy->slotEmpty(SlotID(i)))
  277. creatureImage[i] = std::make_shared<CPicture>(drawBlackBox(Point(32, 32), LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyModeSelect")), Point(6 + i * 36, 78));
  278. else
  279. {
  280. auto creatureID = selectedArmy->Slots().at(SlotID(i))->getCreatureID();
  281. creatureImage[i] = std::make_shared<CPicture>(ENGINE->renderHandler().loadAnimation(AnimationPath::builtin("CPRSMALL"), EImageBlitMode::COLORKEY)->getImage(LIBRARY->creh->objects.at(creatureID)->getIconIndex()), Point(6 + i * 36, 78));
  282. }
  283. creatureImage[i]->addLClickCallback([this, i](){
  284. auto allowedSet = LIBRARY->creh->getDefaultAllowed();
  285. std::vector<CreatureID> creatures(allowedSet.begin(), allowedSet.end());
  286. std::sort(creatures.begin(), creatures.end(), [](auto a, auto b) {
  287. auto creatureA = a.toCreature();
  288. auto creatureB = b.toCreature();
  289. if (creatureA->getLevel() == creatureB->getLevel())
  290. return creatureA->getNameSingularTranslated() < creatureB->getNameSingularTranslated();
  291. if (creatureA->getFactionID() == creatureB->getFactionID())
  292. return creatureA->getLevel() < creatureB->getLevel();
  293. return creatureA->getFactionID() < creatureB->getFactionID();
  294. });
  295. int selectedIndex = selectedArmy->slotEmpty(SlotID(i)) ? 0 : (1 + std::distance(creatures.begin(), std::find_if(creatures.begin(), creatures.end(), [this, i](auto creatureID) {
  296. return creatureID == selectedArmy->Slots().at(SlotID(i))->getId();
  297. })));
  298. std::vector<std::string> texts;
  299. std::vector<std::shared_ptr<IImage>> images;
  300. // Add "no creature" option
  301. texts.push_back(LIBRARY->generaltexth->translate("core.genrltxt.507"));
  302. images.push_back(nullptr);
  303. for (const auto & c : creatures)
  304. {
  305. texts.push_back(c.toCreature()->getNameSingularTranslated());
  306. auto image = ENGINE->renderHandler().loadImage(AnimationPath::builtin("CPRSMALL"), c.toCreature()->getIconIndex(), 0, EImageBlitMode::OPAQUE);
  307. image->scaleTo(Point(23, 23), EScalingAlgorithm::NEAREST);
  308. images.push_back(image);
  309. }
  310. auto window = std::make_shared<CObjectListWindow>(texts, nullptr, LIBRARY->generaltexth->translate("core.genrltxt.42"), LIBRARY->generaltexth->translate("vcmi.lobby.battleOnlyModeCreatureSelect"), [this, creatures, i](int index){
  311. if(index == 0)
  312. {
  313. if(!selectedArmy->slotEmpty(SlotID(i)))
  314. selectedArmy->eraseStack(SlotID(i));
  315. setCreatureIcons();
  316. return;
  317. }
  318. index--;
  319. auto creature = creatures.at(index).toCreature();
  320. selectedArmy->setCreature(SlotID(i), creature->getId(), 100);
  321. selectedArmyInput[SlotID(i)]->setText("100");
  322. setCreatureIcons();
  323. }, selectedIndex, images, true, true);
  324. window->onPopup = [creatures](int index) {
  325. if(index == 0)
  326. return;
  327. index--;
  328. ENGINE->windows().createAndPushWindow<CStackWindow>(creatures.at(index).toCreature(), true);
  329. };
  330. ENGINE->windows().pushWindow(window);
  331. });
  332. creatureImage[i]->addRClickCallback([this, i](){
  333. if(selectedArmy->slotEmpty(SlotID(i)))
  334. return;
  335. ENGINE->windows().createAndPushWindow<CStackWindow>(LIBRARY->creh->objects.at(selectedArmy->Slots().at(SlotID(i))->getCreatureID()).get(), true);
  336. });
  337. }
  338. }
  339. void BattleOnlyModeWindow::startBattle()
  340. {
  341. auto rng = &CRandomGenerator::getDefault();
  342. map->initTerrain();
  343. map->getEditManager()->clearTerrain(rng);
  344. map->getEditManager()->getTerrainSelection().selectAll();
  345. map->getEditManager()->drawTerrain(selectedTerrain == TerrainId::NONE ? TerrainId::DIRT : selectedTerrain, 0, rng);
  346. map->players[0].canComputerPlay = true;
  347. map->players[0].canHumanPlay = true;
  348. map->players[1] = map->players[0];
  349. auto knownHeroes = LIBRARY->objtypeh->knownSubObjects(Obj::HERO);
  350. auto addHero = [&](auto & selector, PlayerColor color, const int3 & position)
  351. {
  352. selector->selectedHero->setOwner(color);
  353. selector->selectedHero->pos = position;
  354. for(size_t i=0; i<GameConstants::PRIMARY_SKILLS; i++)
  355. selector->selectedHero->pushPrimSkill(PrimarySkill(i), std::stoi(selector->primSkillsInput[i]->getText()));
  356. selector->selectedHero->clearSlots();
  357. for(int slot = 0; slot < GameConstants::ARMY_SIZE; slot++)
  358. if(!selector->selectedArmy->slotEmpty(SlotID(slot)))
  359. selector->selectedHero->putStack(SlotID(slot), selector->selectedArmy->detachStack(SlotID(slot)));
  360. map->getEditManager()->insertObject(selector->selectedHero);
  361. };
  362. addHero(heroSelector1, PlayerColor(0), int3(5, 6, 0));
  363. if(selectedTown == FactionID::NONE)
  364. addHero(heroSelector2, PlayerColor(1), int3(5, 5, 0));
  365. else
  366. {
  367. auto factory = LIBRARY->objtypeh->getHandlerFor(Obj::TOWN, selectedTown);
  368. auto templates = factory->getTemplates();
  369. auto obj = factory->create(cb.get(), templates.front());
  370. auto townObj = std::dynamic_pointer_cast<CGTownInstance>(obj);
  371. obj->setOwner(PlayerColor(1));
  372. obj->pos = int3(5, 5, 0);
  373. for (const auto & building : townObj->getTown()->getAllBuildings())
  374. townObj->addBuilding(building);
  375. if(!heroSelector2->selectedHero)
  376. {
  377. for(int slot = 0; slot < GameConstants::ARMY_SIZE; slot++)
  378. if(!heroSelector2->selectedArmy->slotEmpty(SlotID(slot)))
  379. townObj->getArmy()->putStack(SlotID(slot), heroSelector2->selectedArmy->detachStack(SlotID(slot)));
  380. }
  381. else
  382. addHero(heroSelector2, PlayerColor(1), int3(5, 5, 0));
  383. map->getEditManager()->insertObject(townObj);
  384. }
  385. auto path = VCMIDirs::get().userDataPath() / "Maps";
  386. boost::filesystem::create_directories(path);
  387. const std::string fileName = "BattleOnlyMode.vmap";
  388. const auto fullPath = path / fileName;
  389. CMapService mapService;
  390. mapService.saveMap(map, fullPath);
  391. CResourceHandler::get()->updateFilteredFiles([&](const std::string & mount) { return true; });
  392. auto mapInfo = std::make_shared<CMapInfo>();
  393. mapInfo->mapInit("Maps/BattleOnlyMode");
  394. GAME->server().setMapInfo(mapInfo);
  395. ExtraOptionsInfo extraOptions;
  396. extraOptions.unlimitedReplay = true;
  397. GAME->server().setExtraOptionsInfo(extraOptions);
  398. GAME->server().sendStartGame();
  399. }