1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-05-13 22:06:58 +02:00

Fixed setting adventure map underground button state after game load;

This commit is contained in:
Fay 2015-01-19 21:48:52 +01:00
parent beaf1a62c5
commit 8adc209366
3 changed files with 18 additions and 5 deletions

View File

@ -143,6 +143,8 @@ void CPlayerInterface::init(shared_ptr<CCallback> CB)
if(!adventureInt)
adventureInt = new CAdvMapInt();
else
adventureInt->restoreState();
}
void CPlayerInterface::yourTurn()
{

View File

@ -402,10 +402,11 @@ void CResDataBar::showAll(SDL_Surface * to)
CAdvMapInt::CAdvMapInt():
mode(EAdvMapMode::NORMAL),
minimap(Rect(ADVOPT.minimapX, ADVOPT.minimapY, ADVOPT.minimapW, ADVOPT.minimapH)),
statusbar(ADVOPT.statusbarX,ADVOPT.statusbarY,ADVOPT.statusbarG),
heroList(ADVOPT.hlistSize, Point(ADVOPT.hlistX, ADVOPT.hlistY), ADVOPT.hlistAU, ADVOPT.hlistAD),
townList(ADVOPT.tlistSize, Point(ADVOPT.tlistX, ADVOPT.tlistY), ADVOPT.tlistAU, ADVOPT.tlistAD),
infoBar(Rect(ADVOPT.infoboxX, ADVOPT.infoboxY, 192, 192) )
statusbar(ADVOPT.statusbarX,ADVOPT.statusbarY,ADVOPT.statusbarG),
heroList(ADVOPT.hlistSize, Point(ADVOPT.hlistX, ADVOPT.hlistY), ADVOPT.hlistAU, ADVOPT.hlistAD),
townList(ADVOPT.tlistSize, Point(ADVOPT.tlistX, ADVOPT.tlistY), ADVOPT.tlistAU, ADVOPT.tlistAD),
infoBar(Rect(ADVOPT.infoboxX, ADVOPT.infoboxY, 192, 192) ),
activeMapPanel(nullptr)
{
duringAITurn = false;
state = NA;
@ -546,10 +547,17 @@ infoBar(Rect(ADVOPT.infoboxX, ADVOPT.infoboxY, 192, 192) )
Colors::WHITE, CGI->generaltexth->allTexts[618]));
activeMapPanel = panelMain;
restoreState();
addUsedEvents(MOVE);
}
void CAdvMapInt::restoreState()
{
changeMode(EAdvMapMode::NORMAL);
underground->block(!CGI->mh->map->twoLevel);
worldViewUnderground->block(!CGI->mh->map->twoLevel);
addUsedEvents(MOVE);
}
CAdvMapInt::~CAdvMapInt()

View File

@ -208,6 +208,9 @@ public:
void updateMoveHero(const CGHeroInstance *h, tribool hasPath = boost::logic::indeterminate);
void updateNextHero(const CGHeroInstance *h);
/// called by player interface if it wants to reuse this object for new/loaded map
void restoreState();
/// changes current adventure map mode; used to switch between default view and world view; scale is ignored if EAdvMapMode == NORMAL
void changeMode(EAdvMapMode newMode, float newScale = 0.36f);
};