mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Second part of GUI reorganization. Some things may not work properly.
This commit is contained in:
parent
4653396d76
commit
1d765e8f29
@ -60,7 +60,7 @@ AdventureMapButton::AdventureMapButton( const std::pair<std::string, std::string
|
||||
pom[0] = help.first;
|
||||
init(Callback, pom, help.second, playerColoredButton, defName, add, x, y, key);
|
||||
}
|
||||
void AdventureMapButton::clickLeft (boost::logic::tribool down)
|
||||
void AdventureMapButton::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(blocked)
|
||||
return;
|
||||
@ -71,23 +71,15 @@ void AdventureMapButton::clickLeft (boost::logic::tribool down)
|
||||
show(screenBuf);
|
||||
if (actOnDown && down)
|
||||
{
|
||||
pressedL=state;
|
||||
//if(!callback.empty())
|
||||
callback();
|
||||
}
|
||||
else if (!actOnDown && pressedL && (down==false))
|
||||
else if (!actOnDown && previousState && (down==false))
|
||||
{
|
||||
pressedL=state;
|
||||
//if(!callback.empty())
|
||||
callback();
|
||||
}
|
||||
else
|
||||
{
|
||||
pressedL=state;
|
||||
}
|
||||
}
|
||||
|
||||
void AdventureMapButton::clickRight (boost::logic::tribool down)
|
||||
void AdventureMapButton::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(helpBox.size()) //there is no point to show window with nothing inside...
|
||||
LOCPLINT->adventureInt->handleRightClick(helpBox,down,this);
|
||||
@ -95,7 +87,7 @@ void AdventureMapButton::clickRight (boost::logic::tribool down)
|
||||
|
||||
void AdventureMapButton::hover (bool on)
|
||||
{
|
||||
Hoverable::hover(on);
|
||||
////Hoverable::hover(on);
|
||||
std::string *name = (vstd::contains(hoverTexts,state))
|
||||
? (&hoverTexts[state])
|
||||
: (vstd::contains(hoverTexts,0) ? (&hoverTexts[0]) : NULL);
|
||||
@ -128,19 +120,19 @@ void AdventureMapButton::activate()
|
||||
{
|
||||
if (active) return;
|
||||
active=true;
|
||||
ClickableL::activate();
|
||||
ClickableR::activate();
|
||||
Hoverable::activate();
|
||||
KeyInterested::activate();
|
||||
activateLClick();
|
||||
activateRClick();
|
||||
activateHover();
|
||||
activateKeys();
|
||||
}
|
||||
void AdventureMapButton::deactivate()
|
||||
{
|
||||
if (!active) return;
|
||||
active=false;
|
||||
ClickableL::deactivate();
|
||||
ClickableR::deactivate();
|
||||
Hoverable::deactivate();
|
||||
KeyInterested::deactivate();
|
||||
deactivateLClick();
|
||||
deactivateRClick();
|
||||
deactivateHover();
|
||||
deactivateKeys();
|
||||
}
|
||||
|
||||
void AdventureMapButton::init(const CFunctionList<void()> &Callback, const std::map<int,std::string> &Name, const std::string &HelpBox, bool playerColoredButton, const std::string &defName, std::vector<std::string> * add, int x, int y, int key)
|
||||
@ -216,7 +208,7 @@ void CHighlightableButton::select(bool on)
|
||||
}
|
||||
}
|
||||
|
||||
void CHighlightableButton::clickLeft( tribool down )
|
||||
void CHighlightableButton::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(blocked)
|
||||
return;
|
||||
@ -225,16 +217,11 @@ void CHighlightableButton::clickLeft( tribool down )
|
||||
else
|
||||
state = selected ? 3 : 0;
|
||||
show(screenBuf);
|
||||
if (pressedL && (down==false))
|
||||
if(previousState && down == false)
|
||||
{
|
||||
pressedL=state;
|
||||
if(!onlyOn || !selected)
|
||||
select(!selected);
|
||||
}
|
||||
else
|
||||
{
|
||||
pressedL=state;
|
||||
}
|
||||
}
|
||||
|
||||
CHighlightableButton::CHighlightableButton( const CFunctionList<void()> &onSelect, const CFunctionList<void()> &onDeselect, const std::map<int,std::string> &Name, const std::string &HelpBox, bool playerColoredButton, const std::string &defName, std::vector<std::string> * add, int x, int y, int key)
|
||||
@ -328,7 +315,7 @@ void CSlider::sliderClicked()
|
||||
{
|
||||
if(!moving)
|
||||
{
|
||||
MotionInterested::activate();
|
||||
activateMouseMove();
|
||||
moving = true;
|
||||
}
|
||||
}
|
||||
@ -386,7 +373,7 @@ void CSlider::activate() // makes button active
|
||||
left.activate();
|
||||
right.activate();
|
||||
slider.activate();
|
||||
ClickableL::activate();
|
||||
activateLClick();
|
||||
}
|
||||
|
||||
void CSlider::deactivate() // makes button inactive (but doesn't delete)
|
||||
@ -394,10 +381,10 @@ void CSlider::deactivate() // makes button inactive (but doesn't delete)
|
||||
left.deactivate();
|
||||
right.deactivate();
|
||||
slider.deactivate();
|
||||
ClickableL::deactivate();
|
||||
deactivateLClick();
|
||||
}
|
||||
|
||||
void CSlider::clickLeft (tribool down)
|
||||
void CSlider::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(down)
|
||||
{
|
||||
@ -410,7 +397,7 @@ void CSlider::clickLeft (tribool down)
|
||||
}
|
||||
if(moving)
|
||||
{
|
||||
MotionInterested::deactivate();
|
||||
deactivateMouseMove();
|
||||
moving = false;
|
||||
}
|
||||
}
|
||||
|
@ -19,8 +19,7 @@ class CDefEssential;
|
||||
|
||||
namespace config{struct ButtonInfo;}
|
||||
|
||||
class AdventureMapButton
|
||||
: public ClickableR, public Hoverable, public KeyShortcut, public CButtonBase
|
||||
class AdventureMapButton : public CButtonBase
|
||||
{
|
||||
public:
|
||||
std::map<int,std::string> hoverTexts; //state -> text for statusbar
|
||||
@ -30,8 +29,8 @@ public:
|
||||
actOnDown; //runs when mouse is pressed down over it, not when up
|
||||
ui8 blocked;
|
||||
|
||||
void clickRight (boost::logic::tribool down);
|
||||
virtual void clickLeft (boost::logic::tribool down);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
virtual void clickLeft(tribool down, bool previousState);
|
||||
void hover (bool on);
|
||||
void block(ui8 on); //if button is blocked then it'll change it's graphic to inactive (offset==2) and won't react on l-clicks
|
||||
void activate(); // makes button active
|
||||
@ -55,7 +54,7 @@ public:
|
||||
bool selected, onlyOn;
|
||||
CFunctionList<void()> callback2; //when disselecting
|
||||
void select(bool on);
|
||||
void clickLeft (boost::logic::tribool down);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
};
|
||||
|
||||
class CHighlightableButtonsGroup
|
||||
@ -78,7 +77,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class CSlider : public IShowable, public MotionInterested, public ClickableL
|
||||
class CSlider : public CIntObject
|
||||
{
|
||||
public:
|
||||
AdventureMapButton left, right, slider; //if vertical then left=up
|
||||
@ -96,7 +95,7 @@ public:
|
||||
|
||||
void sliderClicked();
|
||||
void moveLeft();
|
||||
void clickLeft (boost::logic::tribool down);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
|
||||
void moveRight();
|
||||
void moveTo(int to);
|
||||
|
@ -267,21 +267,21 @@ void CMinimap::initFlaggableObjs(int level)
|
||||
void CMinimap::updateRadar()
|
||||
{}
|
||||
|
||||
void CMinimap::clickRight (tribool down)
|
||||
void CMinimap::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
LOCPLINT->adventureInt->handleRightClick(rcText,down,this);
|
||||
}
|
||||
|
||||
void CMinimap::clickLeft (tribool down)
|
||||
void CMinimap::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if (down && (!pressedL))
|
||||
MotionInterested::activate();
|
||||
if (down && (!previousState))
|
||||
activateMouseMove();
|
||||
else if (!down)
|
||||
{
|
||||
if (std::find(GH.motioninterested.begin(),GH.motioninterested.end(),this)!=GH.motioninterested.end())
|
||||
MotionInterested::deactivate();
|
||||
deactivateMouseMove();
|
||||
}
|
||||
ClickableL::clickLeft(down);
|
||||
//ClickableL::clickLeft(down);
|
||||
if (!((bool)down))
|
||||
return;
|
||||
|
||||
@ -297,7 +297,7 @@ void CMinimap::clickLeft (tribool down)
|
||||
|
||||
void CMinimap::hover (bool on)
|
||||
{
|
||||
Hoverable::hover(on);
|
||||
//Hoverable::hover(on);
|
||||
if (on)
|
||||
LOCPLINT->adventureInt->statusbar.print(statusbarTxt);
|
||||
else if (LOCPLINT->adventureInt->statusbar.current==statusbarTxt)
|
||||
@ -308,25 +308,25 @@ void CMinimap::mouseMoved (const SDL_MouseMotionEvent & sEvent)
|
||||
{
|
||||
if (pressedL)
|
||||
{
|
||||
clickLeft(true);
|
||||
clickLeft(true, true);
|
||||
}
|
||||
}
|
||||
void CMinimap::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
ClickableR::activate();
|
||||
Hoverable::activate();
|
||||
activateLClick();
|
||||
activateRClick();
|
||||
activateHover();
|
||||
if (pressedL)
|
||||
MotionInterested::activate();
|
||||
activateMouseMove();
|
||||
}
|
||||
|
||||
void CMinimap::deactivate()
|
||||
{
|
||||
if (pressedL)
|
||||
MotionInterested::deactivate();
|
||||
ClickableL::deactivate();
|
||||
ClickableR::deactivate();
|
||||
Hoverable::deactivate();
|
||||
deactivateMouseMove();
|
||||
deactivateLClick();
|
||||
deactivateRClick();
|
||||
deactivateHover();
|
||||
}
|
||||
|
||||
void CMinimap::showTile(const int3 &pos)
|
||||
@ -426,6 +426,11 @@ void CMinimap::hideTile(const int3 &pos)
|
||||
{
|
||||
}
|
||||
|
||||
void CMinimap::show( SDL_Surface * to )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CTerrainRect::CTerrainRect()
|
||||
:currentPath(NULL)
|
||||
{
|
||||
@ -448,19 +453,19 @@ CTerrainRect::~CTerrainRect()
|
||||
}
|
||||
void CTerrainRect::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
ClickableR::activate();
|
||||
Hoverable::activate();
|
||||
MotionInterested::activate();
|
||||
activateLClick();
|
||||
activateRClick();
|
||||
activateHover();
|
||||
activateMouseMove();
|
||||
};
|
||||
void CTerrainRect::deactivate()
|
||||
{
|
||||
ClickableL::deactivate();
|
||||
ClickableR::deactivate();
|
||||
Hoverable::deactivate();
|
||||
MotionInterested::deactivate();
|
||||
deactivateLClick();
|
||||
deactivateRClick();
|
||||
deactivateHover();
|
||||
deactivateMouseMove();
|
||||
};
|
||||
void CTerrainRect::clickLeft(tribool down)
|
||||
void CTerrainRect::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if ((down==false) || indeterminate(down))
|
||||
return;
|
||||
@ -549,7 +554,7 @@ void CTerrainRect::clickLeft(tribool down)
|
||||
}
|
||||
} //end of hero is selected "case"
|
||||
}
|
||||
void CTerrainRect::clickRight(tribool down)
|
||||
void CTerrainRect::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
int3 mp = whichTileIsIt();
|
||||
if ((mp.x<0)
|
||||
@ -680,7 +685,7 @@ void CTerrainRect::hover(bool on)
|
||||
LOCPLINT->adventureInt->statusbar.clear();
|
||||
CGI->curh->changeGraphic(0,0);
|
||||
}
|
||||
Hoverable::hover(on);
|
||||
//Hoverable::hover(on);
|
||||
}
|
||||
void CTerrainRect::showPath(const SDL_Rect * extRect)
|
||||
{
|
||||
@ -1051,16 +1056,16 @@ int3 CTerrainRect::whichTileIsIt()
|
||||
return whichTileIsIt(GH.current->motion.x,GH.current->motion.y);
|
||||
}
|
||||
|
||||
void CResDataBar::clickRight (tribool down)
|
||||
void CResDataBar::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
}
|
||||
void CResDataBar::activate()
|
||||
{
|
||||
ClickableR::activate();
|
||||
activateRClick();
|
||||
}
|
||||
void CResDataBar::deactivate()
|
||||
{
|
||||
ClickableR::deactivate();
|
||||
deactivateRClick();
|
||||
}
|
||||
CResDataBar::CResDataBar(const std::string &defname, int x, int y, int offx, int offy, int resdist, int datedist)
|
||||
{
|
||||
@ -1119,6 +1124,11 @@ void CResDataBar::draw(SDL_Surface * to)
|
||||
//updateRect(&pos,screen);
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
void CResDataBar::show( SDL_Surface * to )
|
||||
{
|
||||
|
||||
}
|
||||
CInfoBar::CInfoBar()
|
||||
{
|
||||
toNextTick = mode = pom = -1;
|
||||
@ -1241,7 +1251,7 @@ void CInfoBar::newDay(int Day)
|
||||
}
|
||||
}
|
||||
pom = 0;
|
||||
TimeInterested::activate();
|
||||
activateTimer();
|
||||
toNextTick = 500;
|
||||
blitAnim(mode);
|
||||
//blitAt(day->ourImages[pom].bitmap,pos.x+10,pos.y+10);
|
||||
@ -1255,7 +1265,7 @@ void CInfoBar::showComp(SComponent * comp, int time)
|
||||
printAtMiddle(comp->subtitle,pos.x+91,pos.y+158,GEOR13,zwykly);
|
||||
printAtMiddleWB(comp->description,pos.x+94,pos.y+31,GEOR13,26,zwykly);
|
||||
SDL_FreeSurface(b);
|
||||
TimeInterested::activate();
|
||||
activateTimer();
|
||||
mode = 6;
|
||||
toNextTick = time;
|
||||
}
|
||||
@ -1267,7 +1277,7 @@ void CInfoBar::tick()
|
||||
pom++;
|
||||
if (pom >= getAnim(mode)->ourImages.size())
|
||||
{
|
||||
TimeInterested::deactivate();
|
||||
deactivateTimer();
|
||||
toNextTick = -1;
|
||||
mode = 5;
|
||||
draw(screen2);
|
||||
@ -1278,7 +1288,7 @@ void CInfoBar::tick()
|
||||
}
|
||||
else if (mode == 6)
|
||||
{
|
||||
TimeInterested::deactivate();
|
||||
deactivateTimer();
|
||||
toNextTick = -1;
|
||||
mode = 5;
|
||||
draw(screen2);
|
||||
@ -1286,6 +1296,10 @@ void CInfoBar::tick()
|
||||
|
||||
}
|
||||
|
||||
void CInfoBar::show( SDL_Surface * to )
|
||||
{
|
||||
|
||||
}
|
||||
CAdvMapInt::CAdvMapInt(int Player)
|
||||
:player(Player),
|
||||
statusbar(ADVOPT.statusbarX,ADVOPT.statusbarY,ADVOPT.statusbarG),
|
||||
@ -1323,7 +1337,6 @@ heroList(ADVOPT.hlistSize),
|
||||
townList(ADVOPT.tlistSize,ADVOPT.tlistX,ADVOPT.tlistY,ADVOPT.tlistAU,ADVOPT.tlistAD)//(5,&genRect(192,48,747,196),747,196,747,372),
|
||||
{
|
||||
active = 0;
|
||||
subInt = NULL;
|
||||
selection = NULL;
|
||||
townList.fun = boost::bind(&CAdvMapInt::selectionChanged,this);
|
||||
LOCPLINT->adventureInt=this;
|
||||
|
@ -25,8 +25,7 @@ class CHeroWindow;
|
||||
*
|
||||
*/
|
||||
|
||||
class CMinimap
|
||||
: public ClickableL, public ClickableR, public Hoverable, public MotionInterested, public virtual CIntObject
|
||||
class CMinimap : public CIntObject
|
||||
{
|
||||
public:
|
||||
SDL_Surface * radar;
|
||||
@ -38,6 +37,7 @@ public:
|
||||
|
||||
CMinimap(bool draw=true);
|
||||
~CMinimap();
|
||||
void show(SDL_Surface * to);
|
||||
void draw(SDL_Surface * to);
|
||||
void redraw(int level=-1);// (level==-1) => redraw all levels
|
||||
void initMap(int level=-1);// (level==-1) => redraw all levels
|
||||
@ -46,8 +46,8 @@ public:
|
||||
|
||||
void updateRadar();
|
||||
|
||||
void clickRight (boost::logic::tribool down);
|
||||
void clickLeft (boost::logic::tribool down);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void hover (bool on);
|
||||
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
|
||||
void activate(); // makes button active
|
||||
@ -57,7 +57,7 @@ public:
|
||||
void showVisibleTiles(int level=-1);// (level==-1) => redraw all levels
|
||||
};
|
||||
class CTerrainRect
|
||||
: public ClickableL, public ClickableR, public Hoverable, public MotionInterested
|
||||
: public CIntObject
|
||||
{
|
||||
public:
|
||||
int tilesw, tilesh; //width and height of terrain to blit in tiles
|
||||
@ -70,8 +70,8 @@ public:
|
||||
CPath * currentPath;
|
||||
void activate();
|
||||
void deactivate();
|
||||
void clickLeft(boost::logic::tribool down);
|
||||
void clickRight(boost::logic::tribool down);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void hover(bool on);
|
||||
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
|
||||
void show(SDL_Surface * to);
|
||||
@ -80,14 +80,14 @@ public:
|
||||
int3 whichTileIsIt(); //uses current cursor pos
|
||||
};
|
||||
class CResDataBar
|
||||
:public ClickableR, public virtual CIntObject
|
||||
: public CIntObject
|
||||
{
|
||||
public:
|
||||
SDL_Surface * bg;
|
||||
std::vector<std::pair<int,int> > txtpos;
|
||||
std::string datetext;
|
||||
|
||||
void clickRight (boost::logic::tribool down);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void activate();
|
||||
void deactivate();
|
||||
CResDataBar();
|
||||
@ -95,9 +95,9 @@ public:
|
||||
~CResDataBar();
|
||||
|
||||
void draw(SDL_Surface * to);
|
||||
void show(SDL_Surface * to);
|
||||
};
|
||||
class CInfoBar
|
||||
:public virtual CIntObject, public TimeInterested
|
||||
class CInfoBar : public CIntObject
|
||||
{
|
||||
public:
|
||||
CDefHandler *day, *week1, *week2, *week3, *week4;
|
||||
@ -113,9 +113,10 @@ public:
|
||||
void draw(SDL_Surface * to, const CGObjectInstance * specific=NULL); // if specific==0 function draws info about selected hero/town
|
||||
void blitAnim(int mode);//0 - day, 1 - week
|
||||
CDefHandler * getAnim(int mode);
|
||||
void show(SDL_Surface * to);
|
||||
};
|
||||
/*****************************/
|
||||
class CAdvMapInt : public CMainInterface, public KeyInterested, public MotionInterested //adventure map interface
|
||||
class CAdvMapInt : public CIntObject //adventure map interface
|
||||
{
|
||||
public:
|
||||
CAdvMapInt(int Player);
|
||||
@ -183,7 +184,7 @@ public:
|
||||
void selectionChanged();
|
||||
void centerOn(int3 on);
|
||||
int3 verifyPos(int3 ver);
|
||||
void handleRightClick(std::string text, boost::logic::tribool down, CIntObject * client);
|
||||
void handleRightClick(std::string text, tribool down, CIntObject * client);
|
||||
void keyPressed(const SDL_KeyboardEvent & key);
|
||||
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
|
||||
};
|
||||
|
@ -301,10 +301,9 @@ void CBattleInterface::setPrintMouseShadow(bool set)
|
||||
|
||||
void CBattleInterface::activate()
|
||||
{
|
||||
KeyInterested::activate();
|
||||
MotionInterested::activate();
|
||||
ClickableR::activate();
|
||||
subInt = NULL;
|
||||
activateKeys();
|
||||
activateMouseMove();
|
||||
activateRClick();
|
||||
bOptions->activate();
|
||||
bSurrender->activate();
|
||||
bFlee->activate();
|
||||
@ -328,9 +327,9 @@ void CBattleInterface::activate()
|
||||
|
||||
void CBattleInterface::deactivate()
|
||||
{
|
||||
KeyInterested::deactivate();
|
||||
MotionInterested::deactivate();
|
||||
ClickableR::deactivate();
|
||||
deactivateKeys();
|
||||
deactivateMouseMove();
|
||||
deactivateRClick();
|
||||
bOptions->deactivate();
|
||||
bSurrender->deactivate();
|
||||
bFlee->deactivate();
|
||||
@ -862,7 +861,7 @@ void CBattleInterface::mouseMoved(const SDL_MouseMotionEvent &sEvent)
|
||||
}
|
||||
}
|
||||
|
||||
void CBattleInterface::clickRight(boost::logic::tribool down)
|
||||
void CBattleInterface::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(!down && spellDestSelectMode)
|
||||
{
|
||||
@ -2342,11 +2341,11 @@ void CBattleHero::show(SDL_Surface *to)
|
||||
|
||||
void CBattleHero::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
activateLClick();
|
||||
}
|
||||
void CBattleHero::deactivate()
|
||||
{
|
||||
ClickableL::deactivate();
|
||||
deactivateLClick();
|
||||
}
|
||||
|
||||
void CBattleHero::setPhase(int newPhase)
|
||||
@ -2362,7 +2361,7 @@ void CBattleHero::setPhase(int newPhase)
|
||||
}
|
||||
}
|
||||
|
||||
void CBattleHero::clickLeft(boost::logic::tribool down)
|
||||
void CBattleHero::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(!down && myHero && LOCPLINT->cb->battleCanCastSpell()) //check conditions
|
||||
{
|
||||
@ -2442,24 +2441,24 @@ std::pair<int, int> CBattleHex::getXYUnitAnim(const int & hexNum, const bool & a
|
||||
}
|
||||
void CBattleHex::activate()
|
||||
{
|
||||
Hoverable::activate();
|
||||
MotionInterested::activate();
|
||||
ClickableL::activate();
|
||||
ClickableR::activate();
|
||||
activateHover();
|
||||
activateMouseMove();
|
||||
activateLClick();
|
||||
activateRClick();
|
||||
}
|
||||
|
||||
void CBattleHex::deactivate()
|
||||
{
|
||||
Hoverable::deactivate();
|
||||
MotionInterested::deactivate();
|
||||
ClickableL::deactivate();
|
||||
ClickableR::deactivate();
|
||||
deactivateHover();
|
||||
deactivateMouseMove();
|
||||
deactivateLClick();
|
||||
deactivateRClick();
|
||||
}
|
||||
|
||||
void CBattleHex::hover(bool on)
|
||||
{
|
||||
hovered = on;
|
||||
Hoverable::hover(on);
|
||||
//Hoverable::hover(on);
|
||||
if(!on && setAlterText)
|
||||
{
|
||||
myInterface->console->alterTxt = std::string();
|
||||
@ -2506,7 +2505,7 @@ void CBattleHex::mouseMoved(const SDL_MouseMotionEvent &sEvent)
|
||||
}
|
||||
}
|
||||
|
||||
void CBattleHex::clickLeft(boost::logic::tribool down)
|
||||
void CBattleHex::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(!down && hovered && strictHovered) //we've been really clicked!
|
||||
{
|
||||
@ -2514,7 +2513,7 @@ void CBattleHex::clickLeft(boost::logic::tribool down)
|
||||
}
|
||||
}
|
||||
|
||||
void CBattleHex::clickRight(boost::logic::tribool down)
|
||||
void CBattleHex::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
int stID = LOCPLINT->cb->battleGetStack(myNumber); //id of stack being on this tile
|
||||
if(hovered && strictHovered && stID!=-1)
|
||||
|
@ -31,7 +31,7 @@ struct BattleAction;
|
||||
|
||||
class CBattleInterface;
|
||||
|
||||
class CBattleHero : public IShowable, public ClickableL
|
||||
class CBattleHero : public CIntObject
|
||||
{
|
||||
public:
|
||||
bool flip; //false if it's attacking hero, true otherwise
|
||||
@ -46,12 +46,12 @@ public:
|
||||
void activate();
|
||||
void deactivate();
|
||||
void setPhase(int newPhase); //sets phase of hero animation
|
||||
void clickLeft(boost::logic::tribool down); //call-in
|
||||
void clickLeft(tribool down, bool previousState); //call-in
|
||||
CBattleHero(const std::string & defName, int phaseG, int imageG, bool filpG, unsigned char player, const CGHeroInstance * hero, const CBattleInterface * owner); //c-tor
|
||||
~CBattleHero(); //d-tor
|
||||
};
|
||||
|
||||
class CBattleHex : public Hoverable, public MotionInterested, public ClickableL, public ClickableR
|
||||
class CBattleHex : public CIntObject
|
||||
{
|
||||
private:
|
||||
bool setAlterText; //if true, this hex has set alternative text in console and will clean it
|
||||
@ -67,8 +67,8 @@ public:
|
||||
void activate();
|
||||
void deactivate();
|
||||
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
|
||||
void clickLeft(boost::logic::tribool down);
|
||||
void clickRight(boost::logic::tribool down);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
CBattleHex();
|
||||
};
|
||||
|
||||
@ -77,7 +77,7 @@ class CBattleObstacle
|
||||
std::vector<int> lockedHexes;
|
||||
};
|
||||
|
||||
class CBattleConsole : public IShowable, public CIntObject
|
||||
class CBattleConsole : public CIntObject
|
||||
{
|
||||
private:
|
||||
std::vector< std::string > texts; //a place where texts are stored
|
||||
@ -96,7 +96,7 @@ public:
|
||||
void scrollDown(unsigned int by = 1); //scrolls console up by 'by' positions
|
||||
};
|
||||
|
||||
class CBattleResultWindow : public IShowActivable, public CIntObject
|
||||
class CBattleResultWindow : public CIntObject
|
||||
{
|
||||
private:
|
||||
SDL_Surface * background;
|
||||
@ -112,7 +112,7 @@ public:
|
||||
void show(SDL_Surface * to = 0);
|
||||
};
|
||||
|
||||
class CBattleOptionsWindow : public IShowActivable, public CIntObject
|
||||
class CBattleOptionsWindow : public CIntObject
|
||||
{
|
||||
private:
|
||||
CBattleInterface * myInt;
|
||||
@ -153,7 +153,7 @@ struct BattleSettings
|
||||
}
|
||||
};
|
||||
|
||||
class CBattleInterface : public CMainInterface, public MotionInterested, public KeyInterested, public ClickableR
|
||||
class CBattleInterface : public CIntObject
|
||||
{
|
||||
private:
|
||||
SDL_Surface * background, * menu, * amountNormal, * amountNegative, * amountPositive, * amountEffNeutral, * cellBorders, * backgroundWithHexes;
|
||||
@ -265,7 +265,7 @@ public:
|
||||
void show(SDL_Surface * to);
|
||||
void keyPressed(const SDL_KeyboardEvent & key);
|
||||
void mouseMoved(const SDL_MouseMotionEvent &sEvent);
|
||||
void clickRight(boost::logic::tribool down);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
|
||||
bool reverseCreature(int number, int hex, bool wideTrick = false); //reverses animation of given creature playing animation of reversing
|
||||
void handleStartMoving(int number); //animation of starting move; some units don't have this animation (ie. halberdier)
|
||||
|
@ -88,18 +88,18 @@ CBuildingRect::~CBuildingRect()
|
||||
}
|
||||
void CBuildingRect::activate()
|
||||
{
|
||||
Hoverable::activate();
|
||||
ClickableL::activate();
|
||||
ClickableR::activate();
|
||||
activateHover();
|
||||
activateLClick();
|
||||
activateRClick();
|
||||
|
||||
}
|
||||
void CBuildingRect::deactivate()
|
||||
{
|
||||
Hoverable::deactivate();
|
||||
ClickableL::deactivate();
|
||||
ClickableR::deactivate();
|
||||
deactivateHover();
|
||||
deactivateLClick();
|
||||
deactivateRClick();
|
||||
if(moi)
|
||||
MotionInterested::deactivate();
|
||||
deactivateMouseMove();
|
||||
moi=false;
|
||||
}
|
||||
bool CBuildingRect::operator<(const CBuildingRect & p2) const
|
||||
@ -111,17 +111,17 @@ bool CBuildingRect::operator<(const CBuildingRect & p2) const
|
||||
}
|
||||
void CBuildingRect::hover(bool on)
|
||||
{
|
||||
Hoverable::hover(on);
|
||||
//Hoverable::hover(on);
|
||||
if(on)
|
||||
{
|
||||
if(!moi)
|
||||
MotionInterested::activate();
|
||||
activateMouseMove();
|
||||
moi = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(moi)
|
||||
MotionInterested::deactivate();
|
||||
deactivateMouseMove();
|
||||
moi = false;
|
||||
if(LOCPLINT->castleInt->hBuild == this)
|
||||
{
|
||||
@ -134,20 +134,16 @@ void CBuildingRect::hover(bool on)
|
||||
}
|
||||
}
|
||||
}
|
||||
void CBuildingRect::clickLeft (tribool down)
|
||||
void CBuildingRect::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
|
||||
if(area && (LOCPLINT->castleInt->hBuild==this) && !(indeterminate(down)) && (CSDL_Ext::SDL_GetPixel(area,GH.current->motion.x-pos.x,GH.current->motion.y-pos.y) != 0)) //na polu
|
||||
{
|
||||
if(pressedL && !down)
|
||||
if(previousState && !down)
|
||||
LOCPLINT->castleInt->buildingClicked(str->ID);
|
||||
ClickableL::clickLeft(down);
|
||||
//ClickableL::clickLeft(down);
|
||||
}
|
||||
|
||||
|
||||
//todo - handle
|
||||
}
|
||||
void CBuildingRect::clickRight (tribool down)
|
||||
void CBuildingRect::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if((!area) || (!((bool)down)) || (this!=LOCPLINT->castleInt->hBuild))
|
||||
return;
|
||||
@ -254,12 +250,11 @@ void CHeroGSlot::hover (bool on)
|
||||
LOCPLINT->statusbar->print(temp);
|
||||
}
|
||||
|
||||
void CHeroGSlot::clickRight (boost::logic::tribool down)
|
||||
void CHeroGSlot::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CHeroGSlot::clickLeft(boost::logic::tribool down)
|
||||
void CHeroGSlot::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
CHeroGSlot *other = upg ? &owner->hslotup : &owner->hslotdown;
|
||||
if(!down)
|
||||
@ -310,17 +305,17 @@ void CHeroGSlot::clickLeft(boost::logic::tribool down)
|
||||
|
||||
void CHeroGSlot::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
ClickableR::activate();
|
||||
Hoverable::activate();
|
||||
activateLClick();
|
||||
activateRClick();
|
||||
activateHover();
|
||||
}
|
||||
|
||||
void CHeroGSlot::deactivate()
|
||||
{
|
||||
highlight = false;
|
||||
ClickableL::deactivate();
|
||||
ClickableR::deactivate();
|
||||
Hoverable::deactivate();
|
||||
deactivateLClick();
|
||||
deactivateRClick();
|
||||
deactivateHover();
|
||||
}
|
||||
|
||||
void CHeroGSlot::show(SDL_Surface * to)
|
||||
@ -793,7 +788,7 @@ void CCastleInterface::activate()
|
||||
}
|
||||
hslotdown.activate();
|
||||
hslotup.activate();
|
||||
KeyInterested::activate();
|
||||
activateKeys();
|
||||
}
|
||||
|
||||
void CCastleInterface::deactivate()
|
||||
@ -809,7 +804,7 @@ void CCastleInterface::deactivate()
|
||||
}
|
||||
hslotdown.deactivate();
|
||||
hslotup.deactivate();
|
||||
KeyInterested::deactivate();
|
||||
deactivateKeys();
|
||||
}
|
||||
|
||||
void CCastleInterface::addBuilding(int bid)
|
||||
@ -1028,7 +1023,7 @@ void CCastleInterface::keyPressed( const SDL_KeyboardEvent & key )
|
||||
|
||||
void CHallInterface::CBuildingBox::hover(bool on)
|
||||
{
|
||||
Hoverable::hover(on);
|
||||
//Hoverable::hover(on);
|
||||
if(on)
|
||||
{
|
||||
std::string toPrint;
|
||||
@ -1043,21 +1038,21 @@ void CHallInterface::CBuildingBox::hover(bool on)
|
||||
else
|
||||
LOCPLINT->statusbar->clear();
|
||||
}
|
||||
void CHallInterface::CBuildingBox::clickLeft (tribool down)
|
||||
void CHallInterface::CBuildingBox::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(pressedL && (!down))
|
||||
if(previousState && (!down))
|
||||
{
|
||||
GH.pushInt(new CHallInterface::CBuildWindow(LOCPLINT->castleInt->town->subID,BID,state,0));
|
||||
}
|
||||
ClickableL::clickLeft(down);
|
||||
//ClickableL::clickLeft(down);
|
||||
}
|
||||
void CHallInterface::CBuildingBox::clickRight (tribool down)
|
||||
void CHallInterface::CBuildingBox::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(down)
|
||||
{
|
||||
GH.pushInt(new CHallInterface::CBuildWindow(LOCPLINT->castleInt->town->subID,BID,state,1));
|
||||
}
|
||||
ClickableR::clickRight(down);
|
||||
//ClickableR::clickRight(down);
|
||||
}
|
||||
void CHallInterface::CBuildingBox::show(SDL_Surface * to)
|
||||
{
|
||||
@ -1092,15 +1087,15 @@ void CHallInterface::CBuildingBox::show(SDL_Surface * to)
|
||||
}
|
||||
void CHallInterface::CBuildingBox::activate()
|
||||
{
|
||||
Hoverable::activate();
|
||||
ClickableL::activate();
|
||||
ClickableR::activate();
|
||||
activateHover();
|
||||
activateLClick();
|
||||
activateRClick();
|
||||
}
|
||||
void CHallInterface::CBuildingBox::deactivate()
|
||||
{
|
||||
Hoverable::deactivate();
|
||||
ClickableL::deactivate();
|
||||
ClickableR::deactivate();
|
||||
deactivateHover();
|
||||
deactivateLClick();
|
||||
deactivateRClick();
|
||||
}
|
||||
CHallInterface::CBuildingBox::~CBuildingBox()
|
||||
{
|
||||
@ -1236,7 +1231,7 @@ void CHallInterface::deactivate()
|
||||
|
||||
void CHallInterface::CBuildWindow::activate()
|
||||
{
|
||||
ClickableR::activate();
|
||||
activateRClick();
|
||||
if(mode)
|
||||
return;
|
||||
if(state==7)
|
||||
@ -1246,7 +1241,7 @@ void CHallInterface::CBuildWindow::activate()
|
||||
|
||||
void CHallInterface::CBuildWindow::deactivate()
|
||||
{
|
||||
ClickableR::deactivate();
|
||||
deactivateRClick();
|
||||
if(mode)
|
||||
return;
|
||||
if(state==7)
|
||||
@ -1266,7 +1261,7 @@ void CHallInterface::CBuildWindow::close()
|
||||
GH.popIntTotally(this);
|
||||
}
|
||||
|
||||
void CHallInterface::CBuildWindow::clickRight (tribool down)
|
||||
void CHallInterface::CBuildWindow::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if((!down || indeterminate(down)) && mode)
|
||||
close();
|
||||
@ -1558,28 +1553,28 @@ void CFortScreen::draw( CCastleInterface * owner, bool first)
|
||||
}
|
||||
SDL_FreeSurface(icons);
|
||||
}
|
||||
void CFortScreen::RecArea::clickLeft (tribool down)
|
||||
void CFortScreen::RecArea::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(!down && pressedL)
|
||||
if(!down && previousState)
|
||||
{
|
||||
LOCPLINT->castleInt->showRecruitmentWindow(bid);
|
||||
}
|
||||
ClickableL::clickLeft(down);
|
||||
//ClickableL::clickLeft(down);
|
||||
}
|
||||
void CFortScreen::RecArea::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
ClickableR::activate();
|
||||
activateLClick();
|
||||
activateRClick();
|
||||
}
|
||||
void CFortScreen::RecArea::deactivate()
|
||||
{
|
||||
ClickableL::deactivate();
|
||||
ClickableR::deactivate();
|
||||
deactivateLClick();
|
||||
deactivateRClick();
|
||||
}
|
||||
|
||||
void CFortScreen::RecArea::clickRight( tribool down )
|
||||
void CFortScreen::RecArea::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
clickLeft(down);; //r-click does same as l-click - opens recr. window
|
||||
clickLeft(down, false); //r-click does same as l-click - opens recr. window
|
||||
}
|
||||
CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner)
|
||||
{
|
||||
@ -1664,7 +1659,7 @@ void CMageGuildScreen::deactivate()
|
||||
}
|
||||
}
|
||||
|
||||
void CMageGuildScreen::Scroll::clickLeft (tribool down)
|
||||
void CMageGuildScreen::Scroll::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(down)
|
||||
{
|
||||
@ -1675,7 +1670,7 @@ void CMageGuildScreen::Scroll::clickLeft (tribool down)
|
||||
}
|
||||
}
|
||||
|
||||
void CMageGuildScreen::Scroll::clickRight (tribool down)
|
||||
void CMageGuildScreen::Scroll::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(down)
|
||||
{
|
||||
@ -1693,7 +1688,7 @@ void CMageGuildScreen::Scroll::clickRight (tribool down)
|
||||
|
||||
void CMageGuildScreen::Scroll::hover(bool on)
|
||||
{
|
||||
Hoverable::hover(on);
|
||||
//Hoverable::hover(on);
|
||||
if(on)
|
||||
LOCPLINT->statusbar->print(spell->name);
|
||||
else
|
||||
@ -1703,16 +1698,16 @@ void CMageGuildScreen::Scroll::hover(bool on)
|
||||
|
||||
void CMageGuildScreen::Scroll::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
ClickableR::activate();
|
||||
Hoverable::activate();
|
||||
activateLClick();
|
||||
activateRClick();
|
||||
activateHover();
|
||||
}
|
||||
|
||||
void CMageGuildScreen::Scroll::deactivate()
|
||||
{
|
||||
ClickableL::deactivate();
|
||||
ClickableR::deactivate();
|
||||
Hoverable::deactivate();
|
||||
deactivateLClick();
|
||||
deactivateRClick();
|
||||
deactivateHover();
|
||||
}
|
||||
|
||||
CBlacksmithDialog::CBlacksmithDialog(bool possible, int creMachineID, int aid, int hid)
|
||||
|
@ -31,7 +31,7 @@ class CMinorResDataBar;
|
||||
*
|
||||
*/
|
||||
|
||||
class CBuildingRect : public Hoverable, public MotionInterested, public ClickableL, public ClickableR//, public TimeInterested
|
||||
class CBuildingRect : public CIntObject
|
||||
{
|
||||
public:
|
||||
bool moi; //motion interested is active
|
||||
@ -46,11 +46,11 @@ public:
|
||||
void deactivate();
|
||||
bool operator<(const CBuildingRect & p2) const;
|
||||
void hover(bool on);
|
||||
void clickLeft (boost::logic::tribool down);
|
||||
void clickRight (boost::logic::tribool down);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void mouseMoved (const SDL_MouseMotionEvent & sEvent);
|
||||
};
|
||||
class CHeroGSlot : public ClickableL, public ClickableR, public Hoverable
|
||||
class CHeroGSlot : public CIntObject
|
||||
{
|
||||
public:
|
||||
CCastleInterface *owner;
|
||||
@ -59,8 +59,8 @@ public:
|
||||
bool highlight; //indicates id the slot is highlighted
|
||||
|
||||
void hover (bool on);
|
||||
void clickRight (boost::logic::tribool down);
|
||||
void clickLeft(boost::logic::tribool down);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void activate();
|
||||
void deactivate();
|
||||
void show(SDL_Surface * to);
|
||||
@ -68,7 +68,7 @@ public:
|
||||
~CHeroGSlot(); //d-tor
|
||||
};
|
||||
|
||||
class CCastleInterface : public CWindowWithGarrison, public KeyInterested
|
||||
class CCastleInterface : public CWindowWithGarrison
|
||||
{
|
||||
public:
|
||||
SDL_Rect pos; //why not inherit this member from CIntObject ?
|
||||
@ -121,15 +121,15 @@ public:
|
||||
CMinorResDataBar * resdatabar;
|
||||
SDL_Rect pos;
|
||||
|
||||
class CBuildingBox : public Hoverable, public ClickableL, public ClickableR
|
||||
class CBuildingBox : public CIntObject
|
||||
{
|
||||
public:
|
||||
int BID;
|
||||
int state;// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
|
||||
//(-1) - forbidden in this town, 0 - possible, 1 - lack of res, 2 - requirements/buildings per turn limit, (3) - already exists
|
||||
void hover(bool on);
|
||||
void clickLeft (boost::logic::tribool down);
|
||||
void clickRight (boost::logic::tribool down);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void show(SDL_Surface * to);
|
||||
void activate();
|
||||
void deactivate();
|
||||
@ -138,7 +138,7 @@ public:
|
||||
~CBuildingBox(); //d-tor
|
||||
};
|
||||
|
||||
class CBuildWindow: public IShowActivable, public ClickableR
|
||||
class CBuildWindow: public CIntObject
|
||||
{
|
||||
public:
|
||||
int tid, bid, state; //town id, building id, state
|
||||
@ -149,7 +149,7 @@ public:
|
||||
void activate();
|
||||
void deactivate();
|
||||
std::string getTextForState(int state);
|
||||
void clickRight (boost::logic::tribool down);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void show(SDL_Surface * to);
|
||||
void Buy();
|
||||
void close();
|
||||
@ -172,15 +172,15 @@ public:
|
||||
void deactivate();
|
||||
};
|
||||
|
||||
class CFortScreen : public IShowActivable, public CIntObject
|
||||
class CFortScreen : public CIntObject
|
||||
{
|
||||
class RecArea : public ClickableL, public ClickableR
|
||||
class RecArea : public CIntObject
|
||||
{
|
||||
public:
|
||||
int bid;
|
||||
RecArea(int BID):bid(BID){}; //c-tor
|
||||
void clickLeft (boost::logic::tribool down);
|
||||
void clickRight (boost::logic::tribool down);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void activate();
|
||||
void deactivate();
|
||||
};
|
||||
@ -202,17 +202,17 @@ public:
|
||||
void deactivate();
|
||||
};
|
||||
|
||||
class CMageGuildScreen : public IShowActivable, public CIntObject
|
||||
class CMageGuildScreen : public CIntObject
|
||||
{
|
||||
public:
|
||||
class Scroll : public ClickableL, public Hoverable, public ClickableR
|
||||
class Scroll : public CIntObject
|
||||
{
|
||||
public:
|
||||
CSpell *spell;
|
||||
|
||||
Scroll(CSpell *Spell):spell(Spell){};
|
||||
void clickLeft (boost::logic::tribool down);
|
||||
void clickRight (boost::logic::tribool down);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void hover(bool on);
|
||||
void activate();
|
||||
void deactivate();
|
||||
@ -234,7 +234,7 @@ public:
|
||||
void deactivate();
|
||||
};
|
||||
|
||||
class CBlacksmithDialog : public IShowActivable, public CIntObject
|
||||
class CBlacksmithDialog : public CIntObject
|
||||
{
|
||||
public:
|
||||
AdventureMapButton *buy, *cancel;
|
||||
|
@ -27,7 +27,7 @@ class CArtifactsOfHero;
|
||||
|
||||
|
||||
|
||||
class CHeroWindow: public CWindowWithGarrison, public virtual CIntObject
|
||||
class CHeroWindow: public CWindowWithGarrison
|
||||
{
|
||||
SDL_Surface * background, * curBack;
|
||||
CStatusBar * ourBar; //heroWindow's statusBar
|
||||
@ -70,7 +70,7 @@ public:
|
||||
void switchHero(); //changes displayed hero
|
||||
|
||||
//friends
|
||||
friend void CArtPlace::clickLeft(tribool down);
|
||||
friend void CArtPlace::clickLeft(tribool down, bool previousState);
|
||||
friend class CPlayerInterface;
|
||||
};
|
||||
|
||||
|
@ -443,11 +443,6 @@ void dispose()
|
||||
|
||||
static void setScreenRes(int w, int h, int bpp, bool fullscreen)
|
||||
{
|
||||
if(screen) //screen has been already initialized
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
// VCMI will only work with 3 or 4 bytes per pixel
|
||||
if (bpp < 24) bpp = 24;
|
||||
if (bpp > 32) bpp = 32;
|
||||
@ -456,14 +451,22 @@ static void setScreenRes(int w, int h, int bpp, bool fullscreen)
|
||||
int suggestedBpp = SDL_VideoModeOK(w, h, bpp, SDL_SWSURFACE|(fullscreen?SDL_FULLSCREEN:0));
|
||||
if(suggestedBpp == 0)
|
||||
{
|
||||
tlog2 << "Warning: SDL says that " << w << "x" << h << " resolution is not available!\n";
|
||||
suggestedBpp = bpp;
|
||||
tlog1 << "Error: SDL says that " << w << "x" << h << " resolution is not available!\n";
|
||||
return;
|
||||
}
|
||||
else if(suggestedBpp != bpp)
|
||||
|
||||
if(suggestedBpp != bpp)
|
||||
{
|
||||
tlog2 << "Warning: SDL says that " << bpp << "bpp is wrong and suggests " << suggestedBpp << std::endl;
|
||||
}
|
||||
|
||||
if(screen) //screen has been already initialized
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
|
||||
|
||||
|
||||
if((screen = SDL_SetVideoMode(w, h, suggestedBpp, SDL_SWSURFACE|(fullscreen?SDL_FULLSCREEN:0))) == NULL)
|
||||
{
|
||||
|
@ -170,7 +170,7 @@ void CPlayerInterface::yourTurn()
|
||||
|
||||
adventureInt->showAll(screen);
|
||||
GH.pushInt(adventureInt);
|
||||
adventureInt->KeyInterested::activate();
|
||||
adventureInt->activateKeys();
|
||||
|
||||
while(makingTurn) // main loop
|
||||
{
|
||||
@ -201,7 +201,7 @@ void CPlayerInterface::yourTurn()
|
||||
SDL_framerateDelay(mainFPSmng);
|
||||
}
|
||||
|
||||
adventureInt->KeyInterested::deactivate();
|
||||
adventureInt->deactivateKeys();
|
||||
GH.popInt(adventureInt);
|
||||
|
||||
cb->endTurn();
|
||||
@ -1269,7 +1269,7 @@ void CPlayerInterface::showBlockingDialog( const std::string &text, const std::v
|
||||
|
||||
CSelWindow * temp = new CSelWindow(text,playerID,35,intComps,pom,askID);
|
||||
GH.pushInt(temp);
|
||||
intComps[0]->clickLeft(true);
|
||||
intComps[0]->clickLeft(true, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ SpellbookInteractiveArea::SpellbookInteractiveArea(const SDL_Rect & myRect, boos
|
||||
onHoverOff = funcHoff;
|
||||
}
|
||||
|
||||
void SpellbookInteractiveArea::clickLeft(boost::logic::tribool down)
|
||||
void SpellbookInteractiveArea::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(!down)
|
||||
{
|
||||
@ -45,14 +45,14 @@ void SpellbookInteractiveArea::clickLeft(boost::logic::tribool down)
|
||||
}
|
||||
}
|
||||
|
||||
void SpellbookInteractiveArea::clickRight(boost::logic::tribool down)
|
||||
void SpellbookInteractiveArea::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
LOCPLINT->adventureInt->handleRightClick(textOnRclick, down, this);
|
||||
}
|
||||
|
||||
void SpellbookInteractiveArea::hover(bool on)
|
||||
{
|
||||
Hoverable::hover(on);
|
||||
//Hoverable::hover(on);
|
||||
if(on)
|
||||
{
|
||||
onHoverOn();
|
||||
@ -65,16 +65,16 @@ void SpellbookInteractiveArea::hover(bool on)
|
||||
|
||||
void SpellbookInteractiveArea::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
ClickableR::activate();
|
||||
Hoverable::activate();
|
||||
activateLClick();
|
||||
activateRClick();
|
||||
activateHover();
|
||||
|
||||
}
|
||||
void SpellbookInteractiveArea::deactivate()
|
||||
{
|
||||
ClickableL::deactivate();
|
||||
ClickableR::deactivate();
|
||||
Hoverable::deactivate();
|
||||
deactivateLClick();
|
||||
deactivateRClick();
|
||||
deactivateHover();
|
||||
}
|
||||
|
||||
CSpellWindow::CSpellWindow(const SDL_Rect & myRect, const CGHeroInstance * _myHero, bool openOnBattleSpells):
|
||||
@ -581,7 +581,7 @@ void CSpellWindow::computeSpellsPerArea()
|
||||
|
||||
void CSpellWindow::activate()
|
||||
{
|
||||
KeyInterested::activate();
|
||||
activateKeys();
|
||||
exitBtn->activate();
|
||||
battleSpells->activate();
|
||||
adventureSpells->activate();
|
||||
@ -604,7 +604,7 @@ void CSpellWindow::activate()
|
||||
|
||||
void CSpellWindow::deactivate()
|
||||
{
|
||||
KeyInterested::deactivate();
|
||||
deactivateKeys();
|
||||
exitBtn->deactivate();
|
||||
battleSpells->deactivate();
|
||||
adventureSpells->deactivate();
|
||||
@ -647,7 +647,7 @@ CSpellWindow::SpellArea::SpellArea(SDL_Rect pos, CSpellWindow * owner)
|
||||
this->owner = owner;
|
||||
}
|
||||
|
||||
void CSpellWindow::SpellArea::clickLeft(boost::logic::tribool down)
|
||||
void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(!down && mySpell!=-1)
|
||||
{
|
||||
@ -660,7 +660,7 @@ void CSpellWindow::SpellArea::clickLeft(boost::logic::tribool down)
|
||||
}
|
||||
}
|
||||
|
||||
void CSpellWindow::SpellArea::clickRight(boost::logic::tribool down)
|
||||
void CSpellWindow::SpellArea::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(down && mySpell != -1)
|
||||
{
|
||||
@ -678,7 +678,7 @@ void CSpellWindow::SpellArea::clickRight(boost::logic::tribool down)
|
||||
|
||||
void CSpellWindow::SpellArea::hover(bool on)
|
||||
{
|
||||
Hoverable::hover(on);
|
||||
//Hoverable::hover(on);
|
||||
if(mySpell != -1)
|
||||
{
|
||||
if(on)
|
||||
@ -696,14 +696,14 @@ void CSpellWindow::SpellArea::hover(bool on)
|
||||
|
||||
void CSpellWindow::SpellArea::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
ClickableR::activate();
|
||||
Hoverable::activate();
|
||||
activateLClick();
|
||||
activateRClick();
|
||||
activateHover();
|
||||
}
|
||||
|
||||
void CSpellWindow::SpellArea::deactivate()
|
||||
{
|
||||
ClickableL::deactivate();
|
||||
ClickableR::deactivate();
|
||||
Hoverable::deactivate();
|
||||
deactivateLClick();
|
||||
deactivateRClick();
|
||||
deactivateHover();
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ struct SDL_Rect;
|
||||
class CGHeroInstance;
|
||||
class CStatusBar;
|
||||
|
||||
class SpellbookInteractiveArea : public ClickableL, public ClickableR, public Hoverable
|
||||
class SpellbookInteractiveArea : public CIntObject
|
||||
{
|
||||
private:
|
||||
boost::function<void()> onLeft;
|
||||
@ -30,8 +30,8 @@ private:
|
||||
boost::function<void()> onHoverOn;
|
||||
boost::function<void()> onHoverOff;
|
||||
public:
|
||||
void clickLeft(boost::logic::tribool down);
|
||||
void clickRight(boost::logic::tribool down);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void hover(bool on);
|
||||
void activate();
|
||||
void deactivate();
|
||||
@ -39,18 +39,18 @@ public:
|
||||
SpellbookInteractiveArea(const SDL_Rect & myRect, boost::function<void()> funcL, const std::string & textR, boost::function<void()> funcHon, boost::function<void()> funcHoff);//c-tor
|
||||
};
|
||||
|
||||
class CSpellWindow : public IShowActivable, public KeyInterested
|
||||
class CSpellWindow : public CIntObject
|
||||
{
|
||||
private:
|
||||
class SpellArea : public ClickableL, public ClickableR, public Hoverable
|
||||
class SpellArea : public CIntObject
|
||||
{
|
||||
public:
|
||||
int mySpell;
|
||||
CSpellWindow * owner;
|
||||
|
||||
SpellArea(SDL_Rect pos, CSpellWindow * owner);
|
||||
void clickLeft(boost::logic::tribool down);
|
||||
void clickRight(boost::logic::tribool down);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void hover(bool on);
|
||||
void activate();
|
||||
void deactivate();
|
||||
|
@ -24,9 +24,9 @@ void KeyShortcut::keyPressed(const SDL_KeyboardEvent & key)
|
||||
if(vstd::contains(assignedKeys,key.keysym.sym))
|
||||
{
|
||||
if(key.state == SDL_PRESSED)
|
||||
clickLeft(true);
|
||||
clickLeft(true, pressedL);
|
||||
else
|
||||
clickLeft(false);
|
||||
clickLeft(false, pressedL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,108 +67,6 @@ void CButtonBase::show(SDL_Surface * to)
|
||||
}
|
||||
}
|
||||
|
||||
ClickableL::ClickableL()
|
||||
{
|
||||
pressedL=false;
|
||||
}
|
||||
|
||||
ClickableL::~ClickableL()
|
||||
{
|
||||
}
|
||||
|
||||
void ClickableL::clickLeft(boost::logic::tribool down)
|
||||
{
|
||||
if (down)
|
||||
pressedL=true;
|
||||
else
|
||||
pressedL=false;
|
||||
}
|
||||
void ClickableL::activate()
|
||||
{
|
||||
GH.lclickable.push_front(this);
|
||||
}
|
||||
void ClickableL::deactivate()
|
||||
{
|
||||
GH.lclickable.erase(std::find(GH.lclickable.begin(),GH.lclickable.end(),this));
|
||||
}
|
||||
|
||||
ClickableR::ClickableR()
|
||||
{
|
||||
pressedR=false;
|
||||
}
|
||||
|
||||
ClickableR::~ClickableR()
|
||||
{}
|
||||
|
||||
void ClickableR::clickRight(boost::logic::tribool down)
|
||||
{
|
||||
if (down)
|
||||
pressedR=true;
|
||||
else
|
||||
pressedR=false;
|
||||
}
|
||||
void ClickableR::activate()
|
||||
{
|
||||
GH.rclickable.push_front(this);
|
||||
}
|
||||
void ClickableR::deactivate()
|
||||
{
|
||||
GH.rclickable.erase(std::find(GH.rclickable.begin(),GH.rclickable.end(),this));
|
||||
}
|
||||
//ClickableR
|
||||
|
||||
Hoverable::~Hoverable()
|
||||
{}
|
||||
|
||||
void Hoverable::activate()
|
||||
{
|
||||
GH.hoverable.push_front(this);
|
||||
}
|
||||
|
||||
void Hoverable::deactivate()
|
||||
{
|
||||
GH.hoverable.erase(std::find(GH.hoverable.begin(),GH.hoverable.end(),this));
|
||||
}
|
||||
void Hoverable::hover(bool on)
|
||||
{
|
||||
hovered=on;
|
||||
}
|
||||
//Hoverable
|
||||
|
||||
KeyInterested::~KeyInterested()
|
||||
{}
|
||||
|
||||
void KeyInterested::activate()
|
||||
{
|
||||
GH.keyinterested.push_front(this);
|
||||
}
|
||||
|
||||
void KeyInterested::deactivate()
|
||||
{
|
||||
GH.keyinterested.erase(std::find(GH.keyinterested.begin(),GH.keyinterested.end(),this));
|
||||
}
|
||||
//KeyInterested
|
||||
|
||||
void MotionInterested::activate()
|
||||
{
|
||||
GH.motioninterested.push_front(this);
|
||||
}
|
||||
|
||||
void MotionInterested::deactivate()
|
||||
{
|
||||
GH.motioninterested.erase(std::find(GH.motioninterested.begin(),GH.motioninterested.end(),this));
|
||||
}
|
||||
|
||||
void TimeInterested::activate()
|
||||
{
|
||||
GH.timeinterested.push_back(this);
|
||||
}
|
||||
|
||||
void TimeInterested::deactivate()
|
||||
{
|
||||
GH.timeinterested.erase(std::find(GH.timeinterested.begin(),GH.timeinterested.end(),this));
|
||||
}
|
||||
|
||||
void CGuiHandler::popInt( IShowActivable *top )
|
||||
{
|
||||
assert(listInt.front() == top);
|
||||
@ -238,8 +136,8 @@ void CGuiHandler::totalRedraw()
|
||||
void CGuiHandler::updateTime()
|
||||
{
|
||||
int tv = th.getDif();
|
||||
std::list<TimeInterested*> hlp = timeinterested;
|
||||
for (std::list<TimeInterested*>::iterator i=hlp.begin(); i != hlp.end();i++)
|
||||
std::list<CIntObject*> hlp = timeinterested;
|
||||
for (std::list<CIntObject*>::iterator i=hlp.begin(); i != hlp.end();i++)
|
||||
{
|
||||
if(!vstd::contains(timeinterested,*i)) continue;
|
||||
if ((*i)->toNextTick>=0)
|
||||
@ -274,6 +172,7 @@ void CGuiHandler::handleEvents()
|
||||
void CGuiHandler::handleEvent(SDL_Event *sEvent)
|
||||
{
|
||||
current = sEvent;
|
||||
bool prev;
|
||||
|
||||
if (sEvent->type==SDL_KEYDOWN || sEvent->type==SDL_KEYUP)
|
||||
{
|
||||
@ -290,7 +189,7 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent)
|
||||
}
|
||||
|
||||
bool keysCaptured = false;
|
||||
for(std::list<KeyInterested*>::iterator i=keyinterested.begin(); i != keyinterested.end();i++)
|
||||
for(std::list<CIntObject*>::iterator i=keyinterested.begin(); i != keyinterested.end();i++)
|
||||
{
|
||||
if((*i)->captureAllKeys)
|
||||
{
|
||||
@ -299,8 +198,8 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent)
|
||||
}
|
||||
}
|
||||
|
||||
std::list<KeyInterested*> miCopy = keyinterested;
|
||||
for(std::list<KeyInterested*>::iterator i=miCopy.begin(); i != miCopy.end();i++)
|
||||
std::list<CIntObject*> miCopy = keyinterested;
|
||||
for(std::list<CIntObject*>::iterator i=miCopy.begin(); i != miCopy.end();i++)
|
||||
if(vstd::contains(keyinterested,*i) && (!keysCaptured || (*i)->captureAllKeys))
|
||||
(**i).keyPressed(key);
|
||||
}
|
||||
@ -311,54 +210,62 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent)
|
||||
}
|
||||
else if ((sEvent->type==SDL_MOUSEBUTTONDOWN) && (sEvent->button.button == SDL_BUTTON_LEFT))
|
||||
{
|
||||
std::list<ClickableL*> hlp = lclickable;
|
||||
for(std::list<ClickableL*>::iterator i=hlp.begin(); i != hlp.end();i++)
|
||||
std::list<CIntObject*> hlp = lclickable;
|
||||
for(std::list<CIntObject*>::iterator i=hlp.begin(); i != hlp.end();i++)
|
||||
{
|
||||
if(!vstd::contains(lclickable,*i)) continue;
|
||||
if (isItIn(&(*i)->pos,sEvent->motion.x,sEvent->motion.y))
|
||||
{
|
||||
(*i)->clickLeft(true);
|
||||
prev = (*i)->pressedL;
|
||||
(*i)->pressedL = true;
|
||||
(*i)->clickLeft(true, prev);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((sEvent->type==SDL_MOUSEBUTTONUP) && (sEvent->button.button == SDL_BUTTON_LEFT))
|
||||
{
|
||||
std::list<ClickableL*> hlp = lclickable;
|
||||
for(std::list<ClickableL*>::iterator i=hlp.begin(); i != hlp.end();i++)
|
||||
std::list<CIntObject*> hlp = lclickable;
|
||||
for(std::list<CIntObject*>::iterator i=hlp.begin(); i != hlp.end();i++)
|
||||
{
|
||||
if(!vstd::contains(lclickable,*i)) continue;
|
||||
prev = (*i)->pressedL;
|
||||
(*i)->pressedL = false;
|
||||
if (isItIn(&(*i)->pos,sEvent->motion.x,sEvent->motion.y))
|
||||
{
|
||||
(*i)->clickLeft(false);
|
||||
(*i)->clickLeft(false, prev);
|
||||
}
|
||||
else
|
||||
(*i)->clickLeft(boost::logic::indeterminate);
|
||||
(*i)->clickLeft(boost::logic::indeterminate, prev);
|
||||
}
|
||||
}
|
||||
else if ((sEvent->type==SDL_MOUSEBUTTONDOWN) && (sEvent->button.button == SDL_BUTTON_RIGHT))
|
||||
{
|
||||
std::list<ClickableR*> hlp = rclickable;
|
||||
for(std::list<ClickableR*>::iterator i=hlp.begin(); i != hlp.end();i++)
|
||||
std::list<CIntObject*> hlp = rclickable;
|
||||
for(std::list<CIntObject*>::iterator i=hlp.begin(); i != hlp.end();i++)
|
||||
{
|
||||
if(!vstd::contains(rclickable,*i)) continue;
|
||||
if (isItIn(&(*i)->pos,sEvent->motion.x,sEvent->motion.y))
|
||||
{
|
||||
(*i)->clickRight(true);
|
||||
prev = (*i)->pressedR;
|
||||
(*i)->pressedR = true;
|
||||
(*i)->clickRight(true, prev);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((sEvent->type==SDL_MOUSEBUTTONUP) && (sEvent->button.button == SDL_BUTTON_RIGHT))
|
||||
{
|
||||
std::list<ClickableR*> hlp = rclickable;
|
||||
for(std::list<ClickableR*>::iterator i=hlp.begin(); i != hlp.end();i++)
|
||||
std::list<CIntObject*> hlp = rclickable;
|
||||
for(std::list<CIntObject*>::iterator i=hlp.begin(); i != hlp.end();i++)
|
||||
{
|
||||
if(!vstd::contains(rclickable,*i)) continue;
|
||||
prev = (*i)->pressedR;
|
||||
(*i)->pressedR = false;
|
||||
if (isItIn(&(*i)->pos,sEvent->motion.x,sEvent->motion.y))
|
||||
{
|
||||
(*i)->clickRight(false);
|
||||
(*i)->clickRight(false, prev);
|
||||
}
|
||||
else
|
||||
(*i)->clickRight(boost::logic::indeterminate);
|
||||
(*i)->clickRight(boost::logic::indeterminate, prev);
|
||||
}
|
||||
}
|
||||
current = NULL;
|
||||
@ -368,8 +275,8 @@ void CGuiHandler::handleEvent(SDL_Event *sEvent)
|
||||
void CGuiHandler::handleMouseMotion(SDL_Event *sEvent)
|
||||
{
|
||||
//sending active, hovered hoverable objects hover() call
|
||||
std::vector<Hoverable*> hlp;
|
||||
for(std::list<Hoverable*>::iterator i=hoverable.begin(); i != hoverable.end();i++)
|
||||
std::vector<CIntObject*> hlp;
|
||||
for(std::list<CIntObject*>::iterator i=hoverable.begin(); i != hoverable.end();i++)
|
||||
{
|
||||
if (isItIn(&(*i)->pos,sEvent->motion.x,sEvent->motion.y))
|
||||
{
|
||||
@ -379,14 +286,19 @@ void CGuiHandler::handleMouseMotion(SDL_Event *sEvent)
|
||||
else if ((*i)->hovered)
|
||||
{
|
||||
(*i)->hover(false);
|
||||
(*i)->hovered = false;
|
||||
}
|
||||
}
|
||||
for(int i=0; i<hlp.size();i++)
|
||||
{
|
||||
hlp[i]->hover(true);
|
||||
hlp[i]->hovered = true;
|
||||
}
|
||||
|
||||
|
||||
//sending active, MotionInterested objects mouseMoved() call
|
||||
std::list<MotionInterested*> miCopy = motioninterested;
|
||||
for(std::list<MotionInterested*>::iterator i=miCopy.begin(); i != miCopy.end();i++)
|
||||
std::list<CIntObject*> miCopy = motioninterested;
|
||||
for(std::list<CIntObject*>::iterator i=miCopy.begin(); i != miCopy.end();i++)
|
||||
{
|
||||
if ((*i)->strongInterest || isItIn(&(*i)->pos,sEvent->motion.x,sEvent->motion.y))
|
||||
{
|
||||
@ -402,3 +314,131 @@ void CGuiHandler::simpleRedraw()
|
||||
blitAt(screen2,0,0,screen); //blit background
|
||||
objsToBlit.back()->show(screen); //blit active interface/window
|
||||
}
|
||||
|
||||
void CIntObject::activateLClick()
|
||||
{
|
||||
GH.lclickable.push_front(this);
|
||||
active |= LCLICK;
|
||||
}
|
||||
|
||||
void CIntObject::deactivateLClick()
|
||||
{
|
||||
std::list<CIntObject*>::iterator hlp = std::find(GH.lclickable.begin(),GH.lclickable.end(),this);
|
||||
assert(hlp != GH.lclickable.end());
|
||||
GH.lclickable.erase(hlp);
|
||||
active &= ~LCLICK;
|
||||
}
|
||||
|
||||
void CIntObject::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
}
|
||||
|
||||
void CIntObject::activateRClick()
|
||||
{
|
||||
GH.rclickable.push_front(this);
|
||||
active |= RCLICK;
|
||||
}
|
||||
|
||||
void CIntObject::deactivateRClick()
|
||||
{
|
||||
std::list<CIntObject*>::iterator hlp = std::find(GH.rclickable.begin(),GH.rclickable.end(),this);
|
||||
assert(hlp != GH.rclickable.end());
|
||||
GH.rclickable.erase(hlp);
|
||||
active &= ~RCLICK;
|
||||
}
|
||||
|
||||
void CIntObject::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
}
|
||||
|
||||
void CIntObject::activateHover()
|
||||
{
|
||||
GH.hoverable.push_front(this);
|
||||
active |= HOVER;
|
||||
}
|
||||
|
||||
void CIntObject::deactivateHover()
|
||||
{
|
||||
std::list<CIntObject*>::iterator hlp = std::find(GH.hoverable.begin(),GH.hoverable.end(),this);
|
||||
assert(hlp != GH.hoverable.end());
|
||||
GH.hoverable.erase(hlp);
|
||||
active &= ~HOVER;
|
||||
}
|
||||
|
||||
void CIntObject::hover( bool on )
|
||||
{
|
||||
}
|
||||
|
||||
void CIntObject::activateKeys()
|
||||
{
|
||||
GH.keyinterested.push_front(this);
|
||||
active |= KEYBOARD;
|
||||
}
|
||||
|
||||
void CIntObject::deactivateKeys()
|
||||
{
|
||||
std::list<CIntObject*>::iterator hlp = std::find(GH.keyinterested.begin(),GH.keyinterested.end(),this);
|
||||
assert(hlp != GH.keyinterested.end());
|
||||
GH.keyinterested.erase(hlp);
|
||||
active &= ~KEYBOARD;
|
||||
}
|
||||
|
||||
void CIntObject::keyPressed( const SDL_KeyboardEvent & key )
|
||||
{
|
||||
}
|
||||
|
||||
void CIntObject::activateMouseMove()
|
||||
{
|
||||
GH.motioninterested.push_front(this);
|
||||
active |= MOVE;
|
||||
}
|
||||
|
||||
void CIntObject::deactivateMouseMove()
|
||||
{
|
||||
std::list<CIntObject*>::iterator hlp = std::find(GH.motioninterested.begin(),GH.motioninterested.end(),this);
|
||||
assert(hlp != GH.motioninterested.end());
|
||||
GH.motioninterested.erase(hlp);
|
||||
active &= ~MOVE;
|
||||
}
|
||||
|
||||
void CIntObject::mouseMoved( const SDL_MouseMotionEvent & sEvent )
|
||||
{
|
||||
}
|
||||
|
||||
void CIntObject::activateTimer()
|
||||
{
|
||||
GH.timeinterested.push_back(this);
|
||||
active |= TIME;
|
||||
}
|
||||
|
||||
void CIntObject::deactivateTimer()
|
||||
{
|
||||
std::list<CIntObject*>::iterator hlp = std::find(GH.timeinterested.begin(),GH.timeinterested.end(),this);
|
||||
assert(hlp != GH.timeinterested.end());
|
||||
GH.timeinterested.erase(hlp);
|
||||
active &= ~TIME;
|
||||
}
|
||||
|
||||
void CIntObject::tick()
|
||||
{
|
||||
}
|
||||
|
||||
CIntObject::CIntObject()
|
||||
{
|
||||
pressedL = pressedR = hovered = captureAllKeys = strongInterest = toNextTick = active = defActivation = 0;
|
||||
}
|
||||
|
||||
void CIntObject::show( SDL_Surface * to )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CIntObject::activate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CIntObject::deactivate()
|
||||
{
|
||||
|
||||
}
|
181
client/GUIBase.h
181
client/GUIBase.h
@ -258,31 +258,87 @@ public:
|
||||
virtual ~IShowActivable(){}; //d-tor
|
||||
};
|
||||
|
||||
class CWindowWithGarrison : public IShowActivable
|
||||
class CIntObject : public IShowActivable //interface object
|
||||
{
|
||||
public:
|
||||
CIntObject *parent; //parent object
|
||||
std::vector<CIntObject *> children;
|
||||
|
||||
Rect pos, //position of object on the screen
|
||||
posRelative; //position of object in the parent (not used if no parent)
|
||||
|
||||
int ID; //object ID, rarely used by some classes for identification / internal info
|
||||
|
||||
CIntObject();
|
||||
virtual ~CIntObject(){}; //d-tor
|
||||
|
||||
//l-clicks handling
|
||||
bool pressedL; //for determining if object is L-pressed
|
||||
void activateLClick();
|
||||
void deactivateLClick();
|
||||
virtual void clickLeft(tribool down, bool previousState);
|
||||
|
||||
//r-clicks handling
|
||||
bool pressedR; //for determining if object is R-pressed
|
||||
void activateRClick();
|
||||
void deactivateRClick();
|
||||
virtual void clickRight(tribool down, bool previousState);
|
||||
|
||||
//hover handling
|
||||
bool hovered; //for determining if object is hovered
|
||||
void activateHover();
|
||||
void deactivateHover();
|
||||
virtual void hover (bool on);
|
||||
|
||||
//keyboard handling
|
||||
bool captureAllKeys; //if true, only this object should get info about pressed keys
|
||||
void activateKeys();
|
||||
void deactivateKeys();
|
||||
virtual void keyPressed(const SDL_KeyboardEvent & key);
|
||||
|
||||
//mouse movement handling
|
||||
bool strongInterest; //if true - report all mouse movements, if not - only when hovered
|
||||
void activateMouseMove();
|
||||
void deactivateMouseMove();
|
||||
virtual void mouseMoved (const SDL_MouseMotionEvent & sEvent);
|
||||
|
||||
//time handling
|
||||
int toNextTick;
|
||||
void activateTimer();
|
||||
void deactivateTimer();
|
||||
virtual void tick();
|
||||
|
||||
enum {LCLICK=1, RCLICK=2, HOVER=4, MOVE=8, KEYBOARD=16, TIME=32};
|
||||
ui8 active;
|
||||
ui8 defActivation;
|
||||
|
||||
void defActivate();
|
||||
void defDeactivate();
|
||||
void activate();
|
||||
void deactivate();
|
||||
void show(SDL_Surface * to);
|
||||
};
|
||||
|
||||
//class for binding keys to left mouse button clicks
|
||||
//classes wanting use it should have it as one of their base classes
|
||||
class KeyShortcut : public virtual CIntObject
|
||||
{
|
||||
public:
|
||||
std::set<int> assignedKeys;
|
||||
KeyShortcut(){}; //c-tor
|
||||
KeyShortcut(int key){assignedKeys.insert(key);}; //c-tor
|
||||
KeyShortcut(std::set<int> Keys):assignedKeys(Keys){}; //c-tor
|
||||
virtual void keyPressed(const SDL_KeyboardEvent & key); //call-in
|
||||
};
|
||||
|
||||
class CWindowWithGarrison : public CIntObject
|
||||
{
|
||||
public:
|
||||
CGarrisonInt *garr;
|
||||
CWindowWithGarrison();
|
||||
};
|
||||
|
||||
class CMainInterface : public IShowActivable
|
||||
{
|
||||
public:
|
||||
IShowActivable *subInt;
|
||||
};
|
||||
class CIntObject //interface object
|
||||
{
|
||||
public:
|
||||
Rect pos; //position of object on the screen
|
||||
int ID; //object unique ID, rarely (if at all) used
|
||||
|
||||
//virtual bool isIn(int x, int y)
|
||||
//{
|
||||
// return pos.isIn(x,y);
|
||||
//}
|
||||
virtual ~CIntObject(){}; //d-tor
|
||||
};
|
||||
class CSimpleWindow : public IShowActivable, public virtual CIntObject
|
||||
class CSimpleWindow : public CIntObject
|
||||
{
|
||||
public:
|
||||
SDL_Surface * bitmap; //background
|
||||
@ -293,7 +349,8 @@ public:
|
||||
void activate(){};
|
||||
void deactivate(){};
|
||||
};
|
||||
class CButtonBase : public virtual CIntObject, public IShowable, public IActivable //basic buttton class
|
||||
|
||||
class CButtonBase : public KeyShortcut//basic buttton class
|
||||
{
|
||||
public:
|
||||
int bitmapOffset; //TODO: comment me
|
||||
@ -311,78 +368,6 @@ public:
|
||||
CButtonBase(); //c-tor
|
||||
virtual ~CButtonBase(); //d-tor
|
||||
};
|
||||
class ClickableL : public virtual CIntObject //for left-clicks
|
||||
{
|
||||
public:
|
||||
bool pressedL; //for determining if object is L-pressed
|
||||
ClickableL(); //c-tor
|
||||
virtual ~ClickableL();//{};//d-tor
|
||||
virtual void clickLeft (boost::logic::tribool down)=0;
|
||||
virtual void activate();
|
||||
virtual void deactivate();
|
||||
};
|
||||
class ClickableR : public virtual CIntObject //for right-clicks
|
||||
{
|
||||
public:
|
||||
bool pressedR; //for determining if object is R-pressed
|
||||
ClickableR(); //c-tor
|
||||
virtual ~ClickableR();//{};//d-tor
|
||||
virtual void clickRight (boost::logic::tribool down)=0;
|
||||
virtual void activate()=0;
|
||||
virtual void deactivate()=0;
|
||||
};
|
||||
class Hoverable : public virtual CIntObject
|
||||
{
|
||||
public:
|
||||
Hoverable() : hovered(false){} //c-tor
|
||||
virtual ~Hoverable();//{}; //d-tor
|
||||
bool hovered; //for determining if object is hovered
|
||||
virtual void hover (bool on)=0;
|
||||
virtual void activate()=0;
|
||||
virtual void deactivate()=0;
|
||||
};
|
||||
class KeyInterested : public virtual CIntObject
|
||||
{
|
||||
public:
|
||||
bool captureAllKeys; //if true, only this object should get info about pressed keys
|
||||
KeyInterested(): captureAllKeys(false){}
|
||||
virtual ~KeyInterested();//{};//d-tor
|
||||
virtual void keyPressed(const SDL_KeyboardEvent & key)=0;
|
||||
virtual void activate()=0;
|
||||
virtual void deactivate()=0;
|
||||
};
|
||||
|
||||
//class for binding keys to left mouse button clicks
|
||||
//classes wanting use it should have it as one of their base classes
|
||||
class KeyShortcut : public KeyInterested, public ClickableL
|
||||
{
|
||||
public:
|
||||
std::set<int> assignedKeys;
|
||||
KeyShortcut(){}; //c-tor
|
||||
KeyShortcut(int key){assignedKeys.insert(key);}; //c-tor
|
||||
KeyShortcut(std::set<int> Keys):assignedKeys(Keys){}; //c-tor
|
||||
virtual void keyPressed(const SDL_KeyboardEvent & key); //call-in
|
||||
};
|
||||
|
||||
class MotionInterested: public virtual CIntObject
|
||||
{
|
||||
public:
|
||||
bool strongInterest; //if true - report all mouse movements, if not - only when hovered
|
||||
MotionInterested(){strongInterest=false;};
|
||||
virtual ~MotionInterested(){};//d-tor
|
||||
virtual void mouseMoved (const SDL_MouseMotionEvent & sEvent)=0;
|
||||
virtual void activate()=0;
|
||||
virtual void deactivate()=0;
|
||||
};
|
||||
class TimeInterested: public virtual CIntObject
|
||||
{
|
||||
public:
|
||||
virtual ~TimeInterested(){}; //d-tor
|
||||
int toNextTick;
|
||||
virtual void tick()=0;
|
||||
virtual void activate();
|
||||
virtual void deactivate();
|
||||
};
|
||||
|
||||
class CGuiHandler
|
||||
{
|
||||
@ -391,12 +376,12 @@ public:
|
||||
std::list<IShowActivable *> listInt; //list of interfaces - front=foreground; back = background (includes adventure map, window interfaces, all kind of active dialogs, and so on)
|
||||
|
||||
//active GUI elements (listening for events
|
||||
std::list<ClickableL*> lclickable;
|
||||
std::list<ClickableR*> rclickable;
|
||||
std::list<Hoverable*> hoverable;
|
||||
std::list<KeyInterested*> keyinterested;
|
||||
std::list<MotionInterested*> motioninterested;
|
||||
std::list<TimeInterested*> timeinterested;
|
||||
std::list<CIntObject*> lclickable;
|
||||
std::list<CIntObject*> rclickable;
|
||||
std::list<CIntObject*> hoverable;
|
||||
std::list<CIntObject*> keyinterested;
|
||||
std::list<CIntObject*> motioninterested;
|
||||
std::list<CIntObject*> timeinterested;
|
||||
|
||||
//objs to blit
|
||||
std::vector<IShowable*> objsToBlit;
|
||||
|
@ -82,7 +82,7 @@ static StackState* getStackState(const CGObjectInstance *obj, int pos, bool town
|
||||
|
||||
void CGarrisonSlot::hover (bool on)
|
||||
{
|
||||
Hoverable::hover(on);
|
||||
////Hoverable::hover(on);
|
||||
if(on)
|
||||
{
|
||||
std::string temp;
|
||||
@ -166,7 +166,7 @@ const CArmedInstance * CGarrisonSlot::getObj()
|
||||
return (!upg)?(owner->oup):(owner->odown);
|
||||
}
|
||||
|
||||
void CGarrisonSlot::clickRight (tribool down)
|
||||
void CGarrisonSlot::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
StackState *pom = getStackState(getObj(),ID, GH.topInt() == LOCPLINT->castleInt);
|
||||
if(down && creature)
|
||||
@ -175,7 +175,7 @@ void CGarrisonSlot::clickRight (tribool down)
|
||||
}
|
||||
delete pom;
|
||||
}
|
||||
void CGarrisonSlot::clickLeft(tribool down)
|
||||
void CGarrisonSlot::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(owner->ignoreEvent)
|
||||
{
|
||||
@ -277,17 +277,17 @@ void CGarrisonSlot::activate()
|
||||
{
|
||||
if(!active) active=true;
|
||||
else return;
|
||||
ClickableL::activate();
|
||||
ClickableR::activate();
|
||||
Hoverable::activate();
|
||||
activateLClick();
|
||||
activateRClick();
|
||||
activateHover();
|
||||
}
|
||||
void CGarrisonSlot::deactivate()
|
||||
{
|
||||
if(active) active=false;
|
||||
else return;
|
||||
ClickableL::deactivate();
|
||||
ClickableR::deactivate();
|
||||
Hoverable::deactivate();
|
||||
deactivateLClick();
|
||||
deactivateRClick();
|
||||
deactivateHover();
|
||||
}
|
||||
CGarrisonSlot::CGarrisonSlot(CGarrisonInt *Owner, int x, int y, int IID, int Upg, const CCreature * Creature, int Count)
|
||||
{
|
||||
@ -636,7 +636,7 @@ void CInfoWindow::deactivate()
|
||||
for(int i=0;i<buttons.size();i++)
|
||||
buttons[i]->deactivate();
|
||||
}
|
||||
void CRClickPopup::clickRight (tribool down)
|
||||
void CRClickPopup::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(down)
|
||||
return;
|
||||
@ -645,12 +645,12 @@ void CRClickPopup::clickRight (tribool down)
|
||||
|
||||
void CRClickPopup::activate()
|
||||
{
|
||||
ClickableR::activate();
|
||||
activateRClick();
|
||||
}
|
||||
|
||||
void CRClickPopup::deactivate()
|
||||
{
|
||||
ClickableR::deactivate();
|
||||
deactivateRClick();
|
||||
}
|
||||
|
||||
void CRClickPopup::close()
|
||||
@ -815,21 +815,21 @@ SDL_Surface * SComponent::getImg()
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
void SComponent::clickRight (tribool down)
|
||||
void SComponent::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(description.size())
|
||||
LOCPLINT->adventureInt->handleRightClick(description,down,this);
|
||||
}
|
||||
void SComponent::activate()
|
||||
{
|
||||
ClickableR::activate();
|
||||
activateRClick();
|
||||
}
|
||||
void SComponent::deactivate()
|
||||
{
|
||||
ClickableR::deactivate();
|
||||
deactivateRClick();
|
||||
}
|
||||
|
||||
void CSelectableComponent::clickLeft(tribool down)
|
||||
void CSelectableComponent::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if (down)
|
||||
{
|
||||
@ -885,15 +885,15 @@ CSelectableComponent::~CSelectableComponent()
|
||||
}
|
||||
void CSelectableComponent::activate()
|
||||
{
|
||||
KeyInterested::activate();
|
||||
activateKeys();
|
||||
SComponent::activate();
|
||||
ClickableL::activate();
|
||||
activateLClick();
|
||||
}
|
||||
void CSelectableComponent::deactivate()
|
||||
{
|
||||
KeyInterested::deactivate();
|
||||
deactivateKeys();
|
||||
SComponent::deactivate();
|
||||
ClickableL::deactivate();
|
||||
deactivateLClick();
|
||||
}
|
||||
SDL_Surface * CSelectableComponent::getImg()
|
||||
{
|
||||
@ -1042,23 +1042,23 @@ std::string CStatusBar::getCurrent()
|
||||
|
||||
void CList::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
ClickableR::activate();
|
||||
Hoverable::activate();
|
||||
KeyInterested::activate();
|
||||
MotionInterested::activate();
|
||||
activateLClick();
|
||||
activateRClick();
|
||||
activateHover();
|
||||
activateKeys();
|
||||
activateMouseMove();
|
||||
};
|
||||
|
||||
void CList::deactivate()
|
||||
{
|
||||
ClickableL::deactivate();
|
||||
ClickableR::deactivate();
|
||||
Hoverable::deactivate();
|
||||
KeyInterested::deactivate();
|
||||
MotionInterested::deactivate();
|
||||
deactivateLClick();
|
||||
deactivateRClick();
|
||||
deactivateHover();
|
||||
deactivateKeys();
|
||||
deactivateMouseMove();
|
||||
};
|
||||
|
||||
void CList::clickLeft(tribool down)
|
||||
void CList::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
};
|
||||
|
||||
@ -1130,7 +1130,7 @@ void CHeroList::select(int which)
|
||||
LOCPLINT->adventureInt->select(heroes[which]);
|
||||
}
|
||||
|
||||
void CHeroList::clickLeft(tribool down)
|
||||
void CHeroList::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if (down)
|
||||
{
|
||||
@ -1234,7 +1234,7 @@ void CHeroList::mouseMoved (const SDL_MouseMotionEvent & sEvent)
|
||||
//select(ny+from);
|
||||
}
|
||||
|
||||
void CHeroList::clickRight(tribool down)
|
||||
void CHeroList::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if (down)
|
||||
{
|
||||
@ -1357,6 +1357,10 @@ int CHeroList::getPosOfHero(const CGHeroInstance* h)
|
||||
return vstd::findPos(heroes, h, std::equal_to<const CGHeroInstance*>());
|
||||
}
|
||||
|
||||
void CHeroList::show( SDL_Surface * to )
|
||||
{
|
||||
|
||||
}
|
||||
CTownList::~CTownList()
|
||||
{
|
||||
delete arrup;
|
||||
@ -1439,7 +1443,7 @@ void CTownList::mouseMoved (const SDL_MouseMotionEvent & sEvent)
|
||||
LOCPLINT->statusbar->print(items[from+ny]->name);
|
||||
}
|
||||
|
||||
void CTownList::clickLeft(tribool down)
|
||||
void CTownList::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if (down)
|
||||
{
|
||||
@ -1513,7 +1517,7 @@ void CTownList::clickLeft(tribool down)
|
||||
}
|
||||
}
|
||||
|
||||
void CTownList::clickRight(tribool down)
|
||||
void CTownList::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if (down)
|
||||
{
|
||||
@ -1588,6 +1592,10 @@ void CTownList::draw(SDL_Surface * to)
|
||||
blitAt(arrdo->ourImages[2].bitmap,arrdop.x,arrdop.y,to);
|
||||
}
|
||||
|
||||
void CTownList::show( SDL_Surface * to )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CCreaturePic::CCreaturePic(const CCreature *cre, bool Big)
|
||||
:c(cre),big(Big)
|
||||
@ -1665,7 +1673,7 @@ void CRecruitmentWindow::sliderMoved(int to)
|
||||
{
|
||||
buy->block(!to);
|
||||
}
|
||||
void CRecruitmentWindow::clickLeft(tribool down)
|
||||
void CRecruitmentWindow::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
int curx = 192 + 51 - (CREATURE_WIDTH*creatures.size()/2) - (SPACE_BETWEEN*(creatures.size()-1)/2);
|
||||
for(int i=0;i<creatures.size();i++)
|
||||
@ -1694,7 +1702,7 @@ void CRecruitmentWindow::clickLeft(tribool down)
|
||||
curx += TOTAL_CREATURE_WIDTH;
|
||||
}
|
||||
}
|
||||
void CRecruitmentWindow::clickRight( boost::logic::tribool down )
|
||||
void CRecruitmentWindow::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(down)
|
||||
{
|
||||
@ -1715,8 +1723,8 @@ void CRecruitmentWindow::clickRight( boost::logic::tribool down )
|
||||
|
||||
void CRecruitmentWindow::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
ClickableR::activate();
|
||||
activateLClick();
|
||||
activateRClick();
|
||||
buy->activate();
|
||||
max->activate();
|
||||
cancel->activate();
|
||||
@ -1726,8 +1734,8 @@ void CRecruitmentWindow::activate()
|
||||
|
||||
void CRecruitmentWindow::deactivate()
|
||||
{
|
||||
ClickableL::deactivate();
|
||||
ClickableR::deactivate();
|
||||
deactivateLClick();
|
||||
deactivateRClick();
|
||||
buy->deactivate();
|
||||
max->deactivate();
|
||||
cancel->deactivate();
|
||||
@ -1917,8 +1925,8 @@ CSplitWindow::~CSplitWindow() //d-tor
|
||||
|
||||
void CSplitWindow::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
KeyInterested::activate();
|
||||
activateLClick();
|
||||
activateKeys();
|
||||
ok->activate();
|
||||
cancel->activate();
|
||||
slider->activate();
|
||||
@ -1926,8 +1934,8 @@ void CSplitWindow::activate()
|
||||
|
||||
void CSplitWindow::deactivate()
|
||||
{
|
||||
ClickableL::deactivate();
|
||||
KeyInterested::deactivate();
|
||||
deactivateLClick();
|
||||
deactivateKeys();
|
||||
ok->deactivate();
|
||||
cancel->deactivate();
|
||||
slider->deactivate();
|
||||
@ -1998,7 +2006,7 @@ void CSplitWindow::keyPressed (const SDL_KeyboardEvent & key)
|
||||
slider->moveTo(which ? ncur : a1+a2-ncur);
|
||||
}
|
||||
|
||||
void CSplitWindow::clickLeft( boost::logic::tribool down )
|
||||
void CSplitWindow::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(down)
|
||||
{
|
||||
@ -2230,7 +2238,7 @@ void CCreInfoWindow::activate()
|
||||
//if(active) return;
|
||||
//active = true;
|
||||
if(!type)
|
||||
ClickableR::activate();
|
||||
activateRClick();
|
||||
if(ok)
|
||||
ok->activate();
|
||||
if(dismiss)
|
||||
@ -2244,7 +2252,7 @@ void CCreInfoWindow::close()
|
||||
GH.popIntTotally(this);
|
||||
}
|
||||
|
||||
void CCreInfoWindow::clickRight(boost::logic::tribool down)
|
||||
void CCreInfoWindow::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(down)
|
||||
return;
|
||||
@ -2265,7 +2273,7 @@ void CCreInfoWindow::deactivate()
|
||||
//if(!active) return;
|
||||
//active = false;
|
||||
if(!type)
|
||||
ClickableR::deactivate();
|
||||
deactivateRClick();
|
||||
if(ok)
|
||||
ok->deactivate();
|
||||
if(dismiss)
|
||||
@ -2452,7 +2460,7 @@ void CMarketplaceWindow::CTradeableItem::show(SDL_Surface * to)
|
||||
blitAt(hlp,pos.x+19,pos.y+9,to);
|
||||
}
|
||||
|
||||
void CMarketplaceWindow::CTradeableItem::clickLeft( boost::logic::tribool down )
|
||||
void CMarketplaceWindow::CTradeableItem::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
CMarketplaceWindow *mw = dynamic_cast<CMarketplaceWindow *>(GH.topInt());
|
||||
assert(mw);
|
||||
@ -2478,12 +2486,12 @@ void CMarketplaceWindow::CTradeableItem::clickLeft( boost::logic::tribool down )
|
||||
|
||||
void CMarketplaceWindow::CTradeableItem::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
activateLClick();
|
||||
}
|
||||
|
||||
void CMarketplaceWindow::CTradeableItem::deactivate()
|
||||
{
|
||||
ClickableL::deactivate();
|
||||
deactivateLClick();
|
||||
}
|
||||
|
||||
SDL_Surface * CMarketplaceWindow::CTradeableItem::getSurface()
|
||||
@ -2965,25 +2973,25 @@ void CTavernWindow::show(SDL_Surface * to)
|
||||
}
|
||||
}
|
||||
|
||||
void CTavernWindow::HeroPortrait::clickLeft(boost::logic::tribool down)
|
||||
void CTavernWindow::HeroPortrait::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(pressedL && !down)
|
||||
if(previousState && !down)
|
||||
as();
|
||||
ClickableL::clickLeft(down);
|
||||
//ClickableL::clickLeft(down);
|
||||
}
|
||||
void CTavernWindow::HeroPortrait::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
ClickableR::activate();
|
||||
Hoverable::activate();
|
||||
activateLClick();
|
||||
activateRClick();
|
||||
activateHover();
|
||||
}
|
||||
void CTavernWindow::HeroPortrait::deactivate()
|
||||
{
|
||||
ClickableL::deactivate();
|
||||
ClickableR::deactivate();
|
||||
Hoverable::deactivate();
|
||||
deactivateLClick();
|
||||
deactivateRClick();
|
||||
deactivateHover();
|
||||
}
|
||||
void CTavernWindow::HeroPortrait::clickRight(boost::logic::tribool down)
|
||||
void CTavernWindow::HeroPortrait::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(down)
|
||||
{
|
||||
@ -3022,7 +3030,7 @@ void CTavernWindow::HeroPortrait::show(SDL_Surface * to)
|
||||
|
||||
void CTavernWindow::HeroPortrait::hover( bool on )
|
||||
{
|
||||
Hoverable::hover(on);
|
||||
//Hoverable::hover(on);
|
||||
if(on)
|
||||
LOCPLINT->statusbar->print(hoverName);
|
||||
else
|
||||
@ -3031,12 +3039,12 @@ void CTavernWindow::HeroPortrait::hover( bool on )
|
||||
|
||||
void CInGameConsole::activate()
|
||||
{
|
||||
KeyInterested::activate();
|
||||
activateKeys();
|
||||
}
|
||||
|
||||
void CInGameConsole::deactivate()
|
||||
{
|
||||
KeyInterested::deactivate();
|
||||
deactivateKeys();
|
||||
}
|
||||
|
||||
void CInGameConsole::show(SDL_Surface * to)
|
||||
@ -3325,16 +3333,16 @@ void CArtPlace::activate()
|
||||
{
|
||||
if(!active)
|
||||
{
|
||||
//ClickableL::activate();
|
||||
//activateLClick();
|
||||
LRClickableAreaWTextComp::activate();
|
||||
active = true;
|
||||
}
|
||||
}
|
||||
void CArtPlace::clickLeft(boost::logic::tribool down)
|
||||
void CArtPlace::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
//LRClickableAreaWTextComp::clickLeft(down);
|
||||
|
||||
if(ourArt && !down && pressedL) //we are spellbook
|
||||
if(ourArt && !down && previousState) //we are spellbook
|
||||
{
|
||||
if(ourArt->id == 0)
|
||||
{
|
||||
@ -3342,7 +3350,7 @@ void CArtPlace::clickLeft(boost::logic::tribool down)
|
||||
GH.pushInt(spellWindow);
|
||||
}
|
||||
}
|
||||
if(!down && !clicked && pressedL) //not clicked before
|
||||
if(!down && !clicked && previousState) //not clicked before
|
||||
{
|
||||
if(ourArt && ourArt->id == 0)
|
||||
return; //this is handled separately
|
||||
@ -3381,19 +3389,19 @@ void CArtPlace::clickLeft(boost::logic::tribool down)
|
||||
clicked = false;
|
||||
ourOwner->commonInfo->activeArtPlace = NULL;
|
||||
}
|
||||
ClickableL::clickLeft(down);
|
||||
//ClickableL::clickLeft(down);
|
||||
}
|
||||
void CArtPlace::clickRight(boost::logic::tribool down)
|
||||
void CArtPlace::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(text.size()) //if there is no description, do nothing ;]
|
||||
LRClickableAreaWTextComp::clickRight(down);
|
||||
LRClickableAreaWTextComp::clickRight(down, previousState);
|
||||
}
|
||||
void CArtPlace::deactivate()
|
||||
{
|
||||
if(active)
|
||||
{
|
||||
active = false;
|
||||
//ClickableL::deactivate();
|
||||
//deactivateLClick();
|
||||
LRClickableAreaWTextComp::deactivate();
|
||||
}
|
||||
}
|
||||
@ -3432,13 +3440,13 @@ CArtPlace::~CArtPlace()
|
||||
|
||||
void LClickableArea::activate()
|
||||
{
|
||||
ClickableL::activate();
|
||||
activateLClick();
|
||||
}
|
||||
void LClickableArea::deactivate()
|
||||
{
|
||||
ClickableL::deactivate();
|
||||
deactivateLClick();
|
||||
}
|
||||
void LClickableArea::clickLeft(boost::logic::tribool down)
|
||||
void LClickableArea::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
//if(!down)
|
||||
//{
|
||||
@ -3448,13 +3456,13 @@ void LClickableArea::clickLeft(boost::logic::tribool down)
|
||||
|
||||
void RClickableArea::activate()
|
||||
{
|
||||
ClickableR::activate();
|
||||
activateRClick();
|
||||
}
|
||||
void RClickableArea::deactivate()
|
||||
{
|
||||
ClickableR::deactivate();
|
||||
deactivateRClick();
|
||||
}
|
||||
void RClickableArea::clickRight(boost::logic::tribool down)
|
||||
void RClickableArea::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
//if(!down)
|
||||
//{
|
||||
@ -3462,15 +3470,15 @@ void RClickableArea::clickRight(boost::logic::tribool down)
|
||||
//}
|
||||
}
|
||||
|
||||
void LRClickableAreaWText::clickLeft(boost::logic::tribool down)
|
||||
void LRClickableAreaWText::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(!down && pressedL)
|
||||
if(!down && previousState)
|
||||
{
|
||||
LOCPLINT->showInfoDialog(text, std::vector<SComponent*>(), soundBase::sound_todo);
|
||||
}
|
||||
ClickableL::clickLeft(down);
|
||||
//ClickableL::clickLeft(down);
|
||||
}
|
||||
void LRClickableAreaWText::clickRight(boost::logic::tribool down)
|
||||
void LRClickableAreaWText::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
LOCPLINT->adventureInt->handleRightClick(text, down, this);
|
||||
}
|
||||
@ -3478,24 +3486,24 @@ void LRClickableAreaWText::activate()
|
||||
{
|
||||
LClickableArea::activate();
|
||||
RClickableArea::activate();
|
||||
Hoverable::activate();
|
||||
activateHover();
|
||||
}
|
||||
void LRClickableAreaWText::deactivate()
|
||||
{
|
||||
LClickableArea::deactivate();
|
||||
RClickableArea::deactivate();
|
||||
Hoverable::deactivate();
|
||||
deactivateHover();
|
||||
}
|
||||
void LRClickableAreaWText::hover(bool on)
|
||||
{
|
||||
Hoverable::hover(on);
|
||||
//Hoverable::hover(on);
|
||||
if (on)
|
||||
LOCPLINT->statusbar->print(hoverText);
|
||||
else if (LOCPLINT->statusbar->getCurrent()==hoverText)
|
||||
LOCPLINT->statusbar->clear();
|
||||
}
|
||||
|
||||
void LClickableAreaHero::clickLeft(boost::logic::tribool down)
|
||||
void LClickableAreaHero::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if(!down)
|
||||
{
|
||||
@ -3507,16 +3515,16 @@ void LClickableAreaHero::clickLeft(boost::logic::tribool down)
|
||||
}
|
||||
}
|
||||
|
||||
void LRClickableAreaWTextComp::clickLeft(boost::logic::tribool down)
|
||||
void LRClickableAreaWTextComp::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if((!down) && pressedL)
|
||||
if((!down) && previousState)
|
||||
{
|
||||
std::vector<SComponent*> comp(1, new SComponent(SComponent::Etype(baseType), type, bonus));
|
||||
LOCPLINT->showInfoDialog(text, comp, soundBase::sound_todo);
|
||||
}
|
||||
ClickableL::clickLeft(down);
|
||||
//ClickableL::clickLeft(down);
|
||||
}
|
||||
void LRClickableAreaWTextComp::clickRight(boost::logic::tribool down)
|
||||
void LRClickableAreaWTextComp::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
LOCPLINT->adventureInt->handleRightClick(text, down, this);
|
||||
}
|
||||
@ -3524,17 +3532,17 @@ void LRClickableAreaWTextComp::activate()
|
||||
{
|
||||
LClickableArea::activate();
|
||||
RClickableArea::activate();
|
||||
Hoverable::activate();
|
||||
activateHover();
|
||||
}
|
||||
void LRClickableAreaWTextComp::deactivate()
|
||||
{
|
||||
LClickableArea::deactivate();
|
||||
RClickableArea::deactivate();
|
||||
Hoverable::deactivate();
|
||||
deactivateHover();
|
||||
}
|
||||
void LRClickableAreaWTextComp::hover(bool on)
|
||||
{
|
||||
Hoverable::hover(on);
|
||||
//Hoverable::hover(on);
|
||||
if (on)
|
||||
LOCPLINT->statusbar->print(hoverText);
|
||||
else if (LOCPLINT->statusbar->getCurrent()==hoverText)
|
||||
|
@ -85,13 +85,13 @@ public:
|
||||
//notification - this class inherits important destructor from CInfoWindow
|
||||
};
|
||||
|
||||
class CRClickPopup : public IShowActivable, public ClickableR //popup displayed on R-click
|
||||
class CRClickPopup : public CIntObject //popup displayed on R-click
|
||||
{
|
||||
public:
|
||||
virtual void activate();
|
||||
virtual void deactivate();
|
||||
virtual void close();
|
||||
void clickRight (boost::logic::tribool down);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
virtual ~CRClickPopup(){}; //d-tor
|
||||
};
|
||||
|
||||
@ -118,7 +118,7 @@ public:
|
||||
~CInfoPopup(){}; //d-tor
|
||||
};
|
||||
|
||||
class SComponent : public ClickableR //common popup window component
|
||||
class SComponent : public virtual CIntObject //common popup window component
|
||||
{
|
||||
public:
|
||||
enum Etype
|
||||
@ -137,7 +137,7 @@ public:
|
||||
SComponent(){}; //c-tor
|
||||
virtual ~SComponent(){}; //d-tor
|
||||
|
||||
void clickRight (boost::logic::tribool down); //call-in
|
||||
void clickRight(tribool down, bool previousState); //call-in
|
||||
virtual SDL_Surface * getImg();
|
||||
virtual void show(SDL_Surface * to);
|
||||
virtual void activate();
|
||||
@ -163,7 +163,7 @@ public:
|
||||
SDL_Surface * border, *myBitmap;
|
||||
boost::function<void()> onSelect; //function called on selection change
|
||||
|
||||
void clickLeft(boost::logic::tribool down); //call-in
|
||||
void clickLeft(tribool down, bool previousState); //call-in
|
||||
void init(SDL_Surface * Border);
|
||||
CSelectableComponent(Etype Type, int Sub, int Val, boost::function<void()> OnSelect = 0, SDL_Surface * Border=NULL); //c-tor
|
||||
CSelectableComponent(const Component &c, boost::function<void()> OnSelect = 0, SDL_Surface * Border=NULL); //c-tor
|
||||
@ -175,7 +175,7 @@ public:
|
||||
SDL_Surface * getImg(); //returns myBitmap
|
||||
};
|
||||
class CGarrisonInt;
|
||||
class CGarrisonSlot : public ClickableL, public ClickableR, public Hoverable
|
||||
class CGarrisonSlot : public CIntObject
|
||||
{
|
||||
public:
|
||||
CGarrisonInt *owner;
|
||||
@ -186,8 +186,8 @@ public:
|
||||
|
||||
virtual void hover (bool on); //call-in
|
||||
const CArmedInstance * getObj();
|
||||
void clickRight (boost::logic::tribool down);
|
||||
void clickLeft(boost::logic::tribool down);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void activate();
|
||||
void deactivate();
|
||||
void show(SDL_Surface * to);
|
||||
@ -246,8 +246,7 @@ public:
|
||||
std::string getCurrent(); //getter for current
|
||||
};
|
||||
|
||||
class CList
|
||||
: public ClickableL, public ClickableR, public Hoverable, public KeyInterested, public virtual CIntObject, public MotionInterested
|
||||
class CList : public CIntObject
|
||||
{
|
||||
public:
|
||||
SDL_Surface * bg; //background bitmap
|
||||
@ -258,10 +257,10 @@ public:
|
||||
int selected, //id of selected position, <0 if none
|
||||
from;
|
||||
const int SIZE; //size of list
|
||||
boost::logic::tribool pressed; //true=up; false=down; indeterminate=none
|
||||
tribool pressed; //true=up; false=down; indeterminate=none
|
||||
|
||||
CList(int Size = 5); //c-tor
|
||||
void clickLeft(boost::logic::tribool down);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void activate();
|
||||
void deactivate();
|
||||
virtual void mouseMoved (const SDL_MouseMotionEvent & sEvent)=0; //call-in
|
||||
@ -282,13 +281,14 @@ public:
|
||||
void genList();
|
||||
void select(int which); //call-in
|
||||
void mouseMoved (const SDL_MouseMotionEvent & sEvent); //call-in
|
||||
void clickLeft(boost::logic::tribool down); //call-in
|
||||
void clickRight(boost::logic::tribool down); //call-in
|
||||
void clickLeft(tribool down, bool previousState); //call-in
|
||||
void clickRight(tribool down, bool previousState); //call-in
|
||||
void hover (bool on); //call-in
|
||||
void keyPressed (const SDL_KeyboardEvent & key); //call-in
|
||||
void updateHList(const CGHeroInstance *toRemove=NULL); //removes specific hero from the list or recreates it
|
||||
void updateMove(const CGHeroInstance* which); //draws move points bar
|
||||
void draw(SDL_Surface * to);
|
||||
void show(SDL_Surface * to);
|
||||
void init();
|
||||
};
|
||||
|
||||
@ -305,11 +305,12 @@ public:
|
||||
void genList();
|
||||
void select(int which); //call-in
|
||||
void mouseMoved (const SDL_MouseMotionEvent & sEvent); //call-in
|
||||
void clickLeft(boost::logic::tribool down); //call-in
|
||||
void clickRight(boost::logic::tribool down); //call-in
|
||||
void clickLeft(tribool down, bool previousState); //call-in
|
||||
void clickRight(tribool down, bool previousState); //call-in
|
||||
void hover (bool on); //call-in
|
||||
void keyPressed (const SDL_KeyboardEvent & key); //call-in
|
||||
void draw(SDL_Surface * to);
|
||||
void show(SDL_Surface * to);
|
||||
};
|
||||
|
||||
class CCreaturePic //draws picture with creature on background, use nextFrame=true to get animation
|
||||
@ -324,7 +325,7 @@ public:
|
||||
SDL_Surface * getPic(bool nextFrame); //returns frame of animation
|
||||
};
|
||||
|
||||
class CRecruitmentWindow : public IShowActivable, public ClickableL, public ClickableR
|
||||
class CRecruitmentWindow : public CIntObject
|
||||
{
|
||||
public:
|
||||
static const int SPACE_BETWEEN = 8;
|
||||
@ -356,8 +357,8 @@ public:
|
||||
void Buy();
|
||||
void Cancel();
|
||||
void sliderMoved(int to);
|
||||
void clickLeft(boost::logic::tribool down);
|
||||
void clickRight(boost::logic::tribool down);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void activate();
|
||||
void deactivate();
|
||||
void show(SDL_Surface * to);
|
||||
@ -367,7 +368,7 @@ public:
|
||||
~CRecruitmentWindow(); //d-tor
|
||||
};
|
||||
|
||||
class CSplitWindow : public IShowActivable, public KeyInterested, public ClickableL
|
||||
class CSplitWindow : public CIntObject
|
||||
{
|
||||
public:
|
||||
CGarrisonInt *gar;
|
||||
@ -386,12 +387,12 @@ public:
|
||||
void close();
|
||||
void deactivate();
|
||||
void show(SDL_Surface * to);
|
||||
void clickLeft(boost::logic::tribool down); //call-in
|
||||
void clickLeft(tribool down, bool previousState); //call-in
|
||||
void keyPressed (const SDL_KeyboardEvent & key); //call-in
|
||||
void sliderMoved(int to);
|
||||
};
|
||||
|
||||
class CCreInfoWindow : public IShowActivable, public KeyInterested, public ClickableR
|
||||
class CCreInfoWindow : public CIntObject
|
||||
{
|
||||
public:
|
||||
//bool active; //TODO: comment me
|
||||
@ -410,14 +411,14 @@ public:
|
||||
~CCreInfoWindow(); //d-tor
|
||||
void activate();
|
||||
void close();
|
||||
void clickRight(boost::logic::tribool down); //call-in
|
||||
void clickRight(tribool down, bool previousState); //call-in
|
||||
void dismissF();
|
||||
void keyPressed (const SDL_KeyboardEvent & key); //call-in
|
||||
void deactivate();
|
||||
void show(SDL_Surface * to);
|
||||
};
|
||||
|
||||
class CLevelWindow : public IShowActivable, public CIntObject
|
||||
class CLevelWindow : public CIntObject
|
||||
{
|
||||
public:
|
||||
int heroType;
|
||||
@ -435,7 +436,7 @@ public:
|
||||
void show(SDL_Surface * to);
|
||||
};
|
||||
|
||||
class CMinorResDataBar : public IShowable, public CIntObject
|
||||
class CMinorResDataBar : public CIntObject
|
||||
{
|
||||
public:
|
||||
SDL_Surface *bg; //background bitmap
|
||||
@ -444,10 +445,10 @@ public:
|
||||
~CMinorResDataBar(); //d-tor
|
||||
};
|
||||
|
||||
class CMarketplaceWindow : public IShowActivable, public CIntObject
|
||||
class CMarketplaceWindow : public CIntObject
|
||||
{
|
||||
public:
|
||||
class CTradeableItem : public ClickableL
|
||||
class CTradeableItem : public CIntObject
|
||||
{
|
||||
public:
|
||||
int type; //0 - res, 1 - artif big, 2 - artif small, 3 - player flag
|
||||
@ -458,7 +459,7 @@ public:
|
||||
void activate();
|
||||
void deactivate();
|
||||
void show(SDL_Surface * to);
|
||||
void clickLeft(boost::logic::tribool down);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
SDL_Surface *getSurface();
|
||||
CTradeableItem(int Type, int ID, bool Left);
|
||||
};
|
||||
@ -486,7 +487,7 @@ public:
|
||||
void clear();
|
||||
};
|
||||
|
||||
class CSystemOptionsWindow : public IShowActivable, public CIntObject
|
||||
class CSystemOptionsWindow : public CIntObject
|
||||
{
|
||||
private:
|
||||
SDL_Surface * background; //background of window
|
||||
@ -508,10 +509,10 @@ public:
|
||||
void show(SDL_Surface * to);
|
||||
};
|
||||
|
||||
class CTavernWindow : public IShowActivable, public CIntObject
|
||||
class CTavernWindow : public CIntObject
|
||||
{
|
||||
public:
|
||||
class HeroPortrait : public ClickableL, public ClickableR, public Hoverable
|
||||
class HeroPortrait : public CIntObject
|
||||
{
|
||||
public:
|
||||
std::string hoverName;
|
||||
@ -519,8 +520,8 @@ public:
|
||||
const CGHeroInstance *h;
|
||||
void activate();
|
||||
void deactivate();
|
||||
void clickLeft(boost::logic::tribool down);
|
||||
void clickRight(boost::logic::tribool down);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void hover (bool on);
|
||||
HeroPortrait(int &sel, int id, int x, int y, const CGHeroInstance *H);
|
||||
void show(SDL_Surface * to);
|
||||
@ -544,7 +545,7 @@ public:
|
||||
void show(SDL_Surface * to);
|
||||
};
|
||||
|
||||
class CInGameConsole : public IShowActivable, public KeyInterested
|
||||
class CInGameConsole : public CIntObject
|
||||
{
|
||||
private:
|
||||
std::list< std::pair< std::string, int > > texts; //<text to show, time of add>
|
||||
@ -569,18 +570,18 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class LClickableArea: public ClickableL
|
||||
class LClickableArea: public virtual CIntObject
|
||||
{
|
||||
public:
|
||||
virtual void clickLeft (boost::logic::tribool down);
|
||||
virtual void clickLeft(tribool down, bool previousState);
|
||||
virtual void activate();
|
||||
virtual void deactivate();
|
||||
};
|
||||
|
||||
class RClickableArea: public ClickableR
|
||||
class RClickableArea: public virtual CIntObject
|
||||
{
|
||||
public:
|
||||
virtual void clickRight (boost::logic::tribool down);
|
||||
virtual void clickRight(tribool down, bool previousState);
|
||||
virtual void activate();
|
||||
virtual void deactivate();
|
||||
};
|
||||
@ -590,21 +591,21 @@ class LClickableAreaHero : public LClickableArea
|
||||
public:
|
||||
int id;
|
||||
CHeroWindow * owner;
|
||||
virtual void clickLeft (boost::logic::tribool down);
|
||||
virtual void clickLeft(tribool down, bool previousState);
|
||||
};
|
||||
|
||||
class LRClickableAreaWText: public LClickableArea, public RClickableArea, public Hoverable
|
||||
class LRClickableAreaWText: public LClickableArea, public RClickableArea
|
||||
{
|
||||
public:
|
||||
std::string text, hoverText;
|
||||
virtual void activate();
|
||||
virtual void deactivate();
|
||||
virtual void clickLeft (boost::logic::tribool down);
|
||||
virtual void clickRight (boost::logic::tribool down);
|
||||
virtual void clickLeft(tribool down, bool previousState);
|
||||
virtual void clickRight(tribool down, bool previousState);
|
||||
virtual void hover(bool on);
|
||||
};
|
||||
|
||||
class LRClickableAreaWTextComp: public LClickableArea, public RClickableArea, public Hoverable
|
||||
class LRClickableAreaWTextComp: public LClickableArea, public RClickableArea
|
||||
{
|
||||
public:
|
||||
std::string text, hoverText;
|
||||
@ -612,12 +613,12 @@ public:
|
||||
int bonus, type;
|
||||
virtual void activate();
|
||||
virtual void deactivate();
|
||||
virtual void clickLeft (boost::logic::tribool down);
|
||||
virtual void clickRight (boost::logic::tribool down);
|
||||
virtual void clickLeft(tribool down, bool previousState);
|
||||
virtual void clickRight(tribool down, bool previousState);
|
||||
virtual void hover(bool on);
|
||||
};
|
||||
|
||||
class CArtPlace: public IShowable, public LRClickableAreaWTextComp
|
||||
class CArtPlace: public LRClickableAreaWTextComp
|
||||
{
|
||||
private:
|
||||
bool active;
|
||||
@ -631,8 +632,8 @@ public:
|
||||
CArtifactsOfHero * ourOwner;
|
||||
const CArtifact * ourArt;
|
||||
CArtPlace(const CArtifact * Art); //c-tor
|
||||
void clickLeft (boost::logic::tribool down);
|
||||
void clickRight (boost::logic::tribool down);
|
||||
void clickLeft(tribool down, bool previousState);
|
||||
void clickRight(tribool down, bool previousState);
|
||||
void activate();
|
||||
void deactivate();
|
||||
void show(SDL_Surface * to);
|
||||
@ -641,7 +642,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class CArtifactsOfHero : public IShowActivable, public CIntObject
|
||||
class CArtifactsOfHero : public CIntObject
|
||||
{
|
||||
const CGHeroInstance * curHero;
|
||||
|
||||
@ -672,7 +673,7 @@ public:
|
||||
friend class CArtPlace;
|
||||
};
|
||||
|
||||
class CGarrisonWindow : public CWindowWithGarrison, public CIntObject
|
||||
class CGarrisonWindow : public CWindowWithGarrison
|
||||
{
|
||||
public:
|
||||
SDL_Surface *bg; //background surface
|
||||
@ -686,7 +687,7 @@ public:
|
||||
~CGarrisonWindow(); //d-tor
|
||||
};
|
||||
|
||||
class CExchangeWindow : public CIntObject, public CWindowWithGarrison
|
||||
class CExchangeWindow : public CWindowWithGarrison
|
||||
{
|
||||
CStatusBar * ourBar; //internal statusbar
|
||||
|
||||
@ -715,7 +716,7 @@ public:
|
||||
~CExchangeWindow(); //d-tor
|
||||
};
|
||||
|
||||
class CShipyardWindow : public CIntObject, public IShowActivable
|
||||
class CShipyardWindow : public CIntObject
|
||||
{
|
||||
public:
|
||||
CStatusBar *bar;
|
||||
|
1
global.h
1
global.h
@ -3,6 +3,7 @@
|
||||
#include <iostream>
|
||||
#include <algorithm> //std::find
|
||||
#include <boost/logic/tribool.hpp>
|
||||
using boost::logic::tribool;
|
||||
#include <boost/cstdint.hpp>
|
||||
typedef boost::uint64_t ui64; //unsigned int 64 bits (8 bytes)
|
||||
typedef boost::uint32_t ui32; //unsigned int 32 bits (4 bytes)
|
||||
|
@ -24,7 +24,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
using boost::logic::tribool;
|
||||
class IGameCallback;
|
||||
struct BattleResult;
|
||||
class CCPPObjectScript;
|
||||
|
@ -1368,7 +1368,7 @@ bool CGameHandler::moveHero( si32 hid, int3 dst, ui8 instant, ui8 asker /*= 255*
|
||||
|
||||
if(obj->tempOwner==h->tempOwner)
|
||||
{
|
||||
heroExchange(h->id, dh->id);
|
||||
heroExchange(dh->id, h->id);
|
||||
return true;
|
||||
}
|
||||
//TODO: check for ally
|
||||
|
Loading…
Reference in New Issue
Block a user