diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index 52da5e145..e35603344 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -957,7 +957,6 @@ void CPlayerInterface::showInfoDialog(const std::string &text, const std::vector { waitWhileDialog(); - stopMovement(); if (settings["session"]["autoSkip"].Bool() && !LOCPLINT->shiftPressed()) { return; @@ -968,6 +967,7 @@ void CPlayerInterface::showInfoDialog(const std::string &text, const std::vector { CCS->soundh->playSound(static_cast(soundID)); showingDialog->set(true); + stopMovement(); // interrupt movement to show dialog GH.pushInt(temp); } else @@ -1271,7 +1271,7 @@ bool CPlayerInterface::moveHero( const CGHeroInstance *h, CGPath path ) stillMoveHero.cond.wait(un); tlog5 << "Resuming " << __FUNCTION__ << std::endl; - if (guarded) // Abort movement if a guard was fought. + if (guarded || showingDialog->get() == true) // Abort movement if a guard was fought or there is a dialog to display (Mantis #1136) break; } diff --git a/config/buildings.json b/config/buildings.json index 53518dbd9..d75642f0c 100644 --- a/config/buildings.json +++ b/config/buildings.json @@ -66,6 +66,12 @@ }, "town" : { + "adventureMap" : + { + "castle" : "AVCcasx0.def", + "village" : "AVCCAST0.DEF", + "capitol" : "AVCCASZ0.DEF" + }, "structures" : [ { "animation" : "TBCSEXT2.def", "x" : 46, "y" : 119 }, @@ -298,7 +304,12 @@ }, "town" : { - + "adventureMap" : + { + "castle" : "AVCramx0.def", + "village" : "AVCRAMP0.DEF", + "capitol" : "AVCRAMZ0.DEF" + }, "structures" : [ { "animation" : "TBRMEXT2.def", "x" : 327, "y" : 236 }, @@ -535,6 +546,12 @@ }, "town" : { + "adventureMap" : + { + "castle" : "AVCtowx0.def", + "village" : "AVCTOWR0.DEF", + "capitol" : "AVCTOWZ0.DEF" + }, "structures" : [ { "id" : 0, "animation" : "TBTWMAGE.def", "x" : 597, "y" : 82, "border" : "TOTGLD1.bmp", "area" : "TZTGLD1.bmp" }, @@ -764,6 +781,12 @@ }, "town" : { + "adventureMap" : + { + "castle" : "AVCinfx0.def", + "village" : "AVCINFT0.DEF", + "capitol" : "AVCINFZ0.DEF" + }, "structures" : [ { "id" : 0, "animation" : "TBINMAGE.def", "x" : 667, "y" : 127, "border" : "TOIMAG1A.bmp", "area" : "TZIMAG1A.bmp" }, @@ -995,6 +1018,12 @@ }, "town" : { + "adventureMap" : + { + "castle" : "AVCnecx0.def", + "village" : "AVCNECR0.DEF", + "capitol" : "AVCNECZ0.DEF" + }, "structures" : [ { "animation" : "TBNCEXT2.def", "x" : 25, "y" : 279 }, @@ -1229,6 +1258,12 @@ }, "town" : { + "adventureMap" : + { + "castle" : "AVCdunx0.def", + "village" : "AVCDUNG0.DEF", + "capitol" : "AVCDUNZ0.DEF" + }, "structures" : [ { "id" : 0, "animation" : "TBDNMAGE.def", "x" : 164, "y" : 119, "z" : -1, "border" : "TODMAG1.bmp", "area" : "TZDMAG1.bmp" }, @@ -1457,6 +1492,12 @@ }, "town" : { + "adventureMap" : + { + "castle" : "AVCstrx0.def", + "village" : "AVCSTRO0.DEF", + "capitol" : "AVCSTRZ0.DEF" + }, "structures" : [ { "animation" : "TBSTEXT3.def", "x" : 23, "y" : 20 }, @@ -1684,6 +1725,12 @@ }, "town" : { + "adventureMap" : + { + "castle" : "AVCftrx0.def", + "village" : "AVCFTRT0.DEF", + "capitol" : "AVCFORZ0.DEF" + }, "structures" : [ { "animation" : "TBFREXT2.def", "x" : 372, "y" : 227 }, @@ -1914,6 +1961,12 @@ }, "town" : { + "adventureMap" : + { + "castle" : "avchforx.def", + "village" : "AVCHFOR0.DEF", + "capitol" : "AVCHFORZ.DEF" + }, "structures" : [ { "animation" : "TBELEXT5.def", "x" : 682, "y" : 183, "z" : -1, }, diff --git a/config/towns_defs.json b/config/towns_defs.json deleted file mode 100644 index 959b13ffe..000000000 --- a/config/towns_defs.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - // Graphics for villages and castles on the map, ordered by town id. - "town_defnames": [ - { "village": "AVCCAST0.DEF", "capitol": "AVCCASZ0.DEF" }, - { "village": "AVCRAMP0.DEF", "capitol": "AVCRAMZ0.DEF" }, - { "village": "AVCTOWR0.DEF", "capitol": "AVCTOWZ0.DEF" }, - { "village": "AVCINFT0.DEF", "capitol": "AVCINFZ0.DEF" }, - { "village": "AVCNECR0.DEF", "capitol": "AVCNECZ0.DEF" }, - { "village": "AVCDUNG0.DEF", "capitol": "AVCDUNZ0.DEF" }, - { "village": "AVCSTRO0.DEF", "capitol": "AVCSTRZ0.DEF" }, - { "village": "AVCFTRT0.DEF", "capitol": "AVCFORZ0.DEF" }, - { "village": "AVCHFOR0.DEF", "capitol": "AVCHFORZ.DEF" } - ] -} diff --git a/lib/CDefObjInfoHandler.cpp b/lib/CDefObjInfoHandler.cpp index fca61bb40..55178be64 100644 --- a/lib/CDefObjInfoHandler.cpp +++ b/lib/CDefObjInfoHandler.cpp @@ -120,8 +120,6 @@ void CDefObjInfoHandler::load() gobjs[nobj->id][nobj->subid] = nobj; - if(nobj->id==Obj::TOWN) - castles[nobj->subid]=nobj; } for (int i = 0; i < 8 ; i++) diff --git a/lib/CDefObjInfoHandler.h b/lib/CDefObjInfoHandler.h index 03a13d44e..69e026746 100644 --- a/lib/CDefObjInfoHandler.h +++ b/lib/CDefObjInfoHandler.h @@ -49,7 +49,6 @@ class DLL_LINKAGE CDefObjInfoHandler { public: bmap > > gobjs; - bmap > castles; void load(); ~CDefObjInfoHandler(); @@ -57,6 +56,5 @@ public: template void serialize(Handler &h, const int version) { h & gobjs; - h & castles; } }; diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index e92be8a2c..4d1ef6830 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -1754,27 +1754,34 @@ int CGameState::getPlayerRelations( ui8 color1, ui8 color2 ) void CGameState::loadTownDInfos() { - int i; - const JsonNode config(ResourceID("config/towns_defs.json")); + assert(!VLC->dobjinfo->gobjs[Obj::TOWN].empty()); //make sure that at least some def info was found - assert(config["town_defnames"].Vector().size() == GameConstants::F_NUMBER); + const CGDefInfo * baseInfo = VLC->dobjinfo->gobjs[Obj::TOWN].begin()->second; + auto & townInfos = VLC->dobjinfo->gobjs[Obj::TOWN]; - i = 0; - BOOST_FOREACH(const JsonNode &t, config["town_defnames"].Vector()) + + BOOST_FOREACH(auto & town, VLC->townh->towns) { - villages[i] = new CGDefInfo(*VLC->dobjinfo->castles[i]); - villages[i]->name = t["village"].String(); - map->defy.push_back(villages[i]); + if (!vstd::contains(VLC->dobjinfo->gobjs[Obj::TOWN], town.first)) // no obj info for this town type + { + CGDefInfo * info = new CGDefInfo(*baseInfo); + info->subid = town.first; - forts[i] = VLC->dobjinfo->castles[i]; - map->defy.push_back(forts[i]); + townInfos[town.first] = info; + } + forts[town.first] = townInfos[town.first]; + townInfos[town.first]->name = town.second.clientInfo.advMapCastle; - capitols[i] = new CGDefInfo(*VLC->dobjinfo->castles[i]); - capitols[i]->name = t["capitol"].String(); - map->defy.push_back(capitols[i]); + villages[town.first] = new CGDefInfo(*townInfos[town.first]); + villages[town.first]->name = town.second.clientInfo.advMapVillage; - ++i; - } + capitols[town.first] = new CGDefInfo(*townInfos[town.first]); + capitols[town.first]->name = town.second.clientInfo.advMapCapitol; + + map->defy.push_back(villages[town.first]); + map->defy.push_back(forts[town.first]); + map->defy.push_back(capitols[town.first]); + } } void CGameState::getNeighbours(const TerrainTile &srct, int3 tile, std::vector &vec, const boost::logic::tribool &onLand, bool limitCoastSailing) diff --git a/lib/CTownHandler.cpp b/lib/CTownHandler.cpp index c17b943dd..74729e60f 100644 --- a/lib/CTownHandler.cpp +++ b/lib/CTownHandler.cpp @@ -380,6 +380,10 @@ void CTownHandler::loadClientData(CTown &town, const JsonNode & source) town.clientInfo.guildWindow = source["guildWindow"].String(); town.clientInfo.buildingsIcons = source["buildingsIcons"].String(); + town.clientInfo.advMapVillage = source["adventureMap"]["village"].String(); + town.clientInfo.advMapCastle = source["adventureMap"]["castle"].String(); + town.clientInfo.advMapCapitol = source["adventureMap"]["capitol"].String(); + loadTownHall(town, source["hallSlots"]); loadStructures(town, source["structures"]); loadSiegeScreen(town, source["siege"]); diff --git a/lib/CTownHandler.h b/lib/CTownHandler.h index 9287a985a..3e6e1417c 100644 --- a/lib/CTownHandler.h +++ b/lib/CTownHandler.h @@ -119,6 +119,10 @@ public: /// NOTE: index in vector is meaningless. Vector used instead of list for a bit faster access std::vector > structures; + std::string advMapVillage; + std::string advMapCastle; + std::string advMapCapitol; + std::string siegePrefix; std::vector siegePositions; TCreature siegeShooter; // shooter creature ID