1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

- adventure map defs are now part of town config. Should be the last part

- possibly fixed #1136
This commit is contained in:
Ivan Savenko 2012-10-05 19:57:28 +00:00
parent c071a03a8a
commit 9f0441a0be
8 changed files with 86 additions and 36 deletions

View File

@ -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<soundBase::soundID>(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;
}

View File

@ -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, },

View File

@ -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" }
]
}

View File

@ -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++)

View File

@ -49,7 +49,6 @@ class DLL_LINKAGE CDefObjInfoHandler
{
public:
bmap<int, bmap<int, ConstTransitivePtr<CGDefInfo> > > gobjs;
bmap<int, ConstTransitivePtr<CGDefInfo> > castles;
void load();
~CDefObjInfoHandler();
@ -57,6 +56,5 @@ public:
template <typename Handler> void serialize(Handler &h, const int version)
{
h & gobjs;
h & castles;
}
};

View File

@ -1754,26 +1754,33 @@ 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]);
}
}

View File

@ -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"]);

View File

@ -119,6 +119,10 @@ public:
/// NOTE: index in vector is meaningless. Vector used instead of list for a bit faster access
std::vector<ConstTransitivePtr<CStructure> > structures;
std::string advMapVillage;
std::string advMapCastle;
std::string advMapCapitol;
std::string siegePrefix;
std::vector<Point> siegePositions;
TCreature siegeShooter; // shooter creature ID