1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

showInfoDialog should be compatible with interfaces other than advmapint.

This commit is contained in:
Michał W. Urbańczyk 2008-01-20 12:34:39 +00:00
parent 34f791a0bf
commit d64dfa0a23
8 changed files with 41 additions and 6 deletions

View File

@ -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();

View File

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

View File

@ -286,6 +286,7 @@ void CCastleInterface::show(SDL_Surface * to)
}
void CCastleInterface::activate()
{
LOCPLINT->curint = this;
//for(int i=0;i<buildings.size();i++)
// buildings[i]->activate();
}

View File

@ -24,7 +24,7 @@ public:
void clickRight (tribool down);
};
class CCastleInterface : public IShowable
class CCastleInterface : public IShowable, public IActivable
{
public:
SDL_Surface * townInt;

View File

@ -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; g<heroList.size(); ++g)
{
heroList[g]->deactivate();
}
}
void CHeroWindow::dismissCurrent()
{
}

View File

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

View File

@ -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<SComponent*> & 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);

View File

@ -184,6 +184,7 @@ class CPlayerInterface : public CGameInterface
public:
bool makingTurn;
SDL_Event * current;
IActivable *curint;
CAdvMapInt * adventureInt;
CCastleInterface * castleInt;
FPSmanager * mainFPSmng;