diff --git a/CAdvmapInterface.cpp b/CAdvmapInterface.cpp index 83e08bf66..e7fc6358b 100644 --- a/CAdvmapInterface.cpp +++ b/CAdvmapInterface.cpp @@ -1343,8 +1343,18 @@ void CAdvMapInt::fendTurn() LOCPLINT->makingTurn = false; } +void CAdvMapInt::activate() +{ + //todo - docelowo wartoby rozdzielic czesc odpowiedzialna za wyswietlanie i aktywacje + show(); +} +void CAdvMapInt::deactivate() +{ + hide(); +} void CAdvMapInt::show() { + LOCPLINT->curint = this; blitAt(bg,0,0); kingOverview.show(); diff --git a/CAdvmapInterface.h b/CAdvmapInterface.h index 8f1c05412..f4b2eeb27 100644 --- a/CAdvmapInterface.h +++ b/CAdvmapInterface.h @@ -193,7 +193,7 @@ public: CDefHandler * getAnim(int mode); }; /*****************************/ -class CAdvMapInt //adventure map interface +class CAdvMapInt : public IActivable //adventure map interface { public: CAdvMapInt(int Player); @@ -258,6 +258,9 @@ public: void fnextHero(); void fendTurn(); + void activate(); + void deactivate(); + void show(); //shows and activates adv. map interface void hide(); //deactivates advmap interface void update(); //redraws terrain diff --git a/CCastleInterface.cpp b/CCastleInterface.cpp index 4b7c115cd..c49115ec2 100644 --- a/CCastleInterface.cpp +++ b/CCastleInterface.cpp @@ -286,6 +286,7 @@ void CCastleInterface::show(SDL_Surface * to) } void CCastleInterface::activate() { + LOCPLINT->curint = this; //for(int i=0;iactivate(); } diff --git a/CCastleInterface.h b/CCastleInterface.h index f03e62f6e..30b571d08 100644 --- a/CCastleInterface.h +++ b/CCastleInterface.h @@ -24,7 +24,7 @@ public: void clickRight (tribool down); }; -class CCastleInterface : public IShowable +class CCastleInterface : public IShowable, public IActivable { public: SDL_Surface * townInt; diff --git a/CHeroWindow.cpp b/CHeroWindow.cpp index 3f8367efc..6b124044c 100644 --- a/CHeroWindow.cpp +++ b/CHeroWindow.cpp @@ -343,6 +343,7 @@ void CHeroWindow::quit() void CHeroWindow::activate() { + LOCPLINT->curint = this; quitButton->activate(); dismissButton->activate(); questlogButton->activate(); @@ -361,6 +362,24 @@ void CHeroWindow::activate() //LOCPLINT->lclickable.push_back(artFeet); } +void CHeroWindow::deactivate() +{ + quitButton->deactivate(); + dismissButton->deactivate(); + questlogButton->deactivate(); + gar1button->deactivate(); + gar2button->deactivate(); + gar3button->deactivate(); + gar4button->deactivate(); + leftArtRoll->deactivate(); + rightArtRoll->deactivate(); + portraitArea->deactivate(); + for(int g=0; gdeactivate(); + } +} + void CHeroWindow::dismissCurrent() { } diff --git a/CHeroWindow.h b/CHeroWindow.h index 2cca80aed..b2dbf53d6 100644 --- a/CHeroWindow.h +++ b/CHeroWindow.h @@ -27,7 +27,7 @@ public: void show(SDL_Surface * to = NULL); }; -class CHeroWindow: public IShowable, public virtual CIntObject +class CHeroWindow: public IActivable, public IShowable, public virtual CIntObject { SDL_Surface * background, * curBack; const CGHeroInstance * curHero; @@ -56,6 +56,7 @@ public: ~CHeroWindow(); //d-tor void setHero(const CGHeroInstance * hero); //sets main displayed hero void activate(); //activates hero window; + void deactivate(); //activates hero window; virtual void show(SDL_Surface * to = NULL); //shows hero window void redrawCurBack(); //redraws curBAck from scratch void quit(); //stops displaying hero window diff --git a/CPlayerInterface.cpp b/CPlayerInterface.cpp index 5947bf709..efd76e7f6 100644 --- a/CPlayerInterface.cpp +++ b/CPlayerInterface.cpp @@ -52,7 +52,7 @@ void CInfoWindow::close() SDL_FreeSurface(bitmap); bitmap = NULL; LOCPLINT->removeObjToBlit(this); - LOCPLINT->adventureInt->show(); + LOCPLINT->curint->activate(); delete this; } CInfoWindow::~CInfoWindow() @@ -250,7 +250,7 @@ void CSelWindow::close() SDL_FreeSurface(bitmap); bitmap = NULL; LOCPLINT->removeObjToBlit(this); - LOCPLINT->adventureInt->show(); + LOCPLINT->curint->activate(); LOCPLINT->cb->selectionMade(ret,ID); delete this; //call owner with selection result @@ -1539,7 +1539,7 @@ void CPlayerInterface::showComp(SComponent comp) void CPlayerInterface::showInfoDialog(std::string text, std::vector & components) { - adventureInt->hide(); //dezaktywacja starego interfejsu + curint->deactivate(); //dezaktywacja starego interfejsu CInfoWindow * temp = CMessage::genIWindow(text,LOCPLINT->playerID,32,components); LOCPLINT->objsToBlit.push_back(temp); temp->pos.x=300-(temp->pos.w/2); diff --git a/CPlayerInterface.h b/CPlayerInterface.h index 33f45892e..91225e8da 100644 --- a/CPlayerInterface.h +++ b/CPlayerInterface.h @@ -184,6 +184,7 @@ class CPlayerInterface : public CGameInterface public: bool makingTurn; SDL_Event * current; + IActivable *curint; CAdvMapInt * adventureInt; CCastleInterface * castleInt; FPSmanager * mainFPSmng;