1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

cleaned up spell window creation

This commit is contained in:
AlexVinS
2016-10-16 09:27:22 +03:00
parent 415bd8247a
commit 63cbf960df
8 changed files with 10 additions and 18 deletions

View File

@ -898,8 +898,7 @@ void CBattleInterface::bSpellf()
ESpellCastProblem::ESpellCastProblem spellCastProblem; ESpellCastProblem::ESpellCastProblem spellCastProblem;
if (curInt->cb->battleCanCastSpell(&spellCastProblem)) if (curInt->cb->battleCanCastSpell(&spellCastProblem))
{ {
auto spellWindow = new CSpellWindow(genRect(595, 620, (screen->w - 620)/2, (screen->h - 595)/2), myHero, curInt.get()); GH.pushInt(new CSpellWindow(myHero, curInt.get()));
GH.pushInt(spellWindow);
} }
else if(spellCastProblem == ESpellCastProblem::MAGIC_IS_BLOCKED) else if(spellCastProblem == ESpellCastProblem::MAGIC_IS_BLOCKED)
{ {

View File

@ -200,8 +200,7 @@ void CBattleHero::clickLeft(tribool down, bool previousState)
} }
CCS->curh->changeGraphic(ECursor::ADVENTURE, 0); CCS->curh->changeGraphic(ECursor::ADVENTURE, 0);
auto spellWindow = new CSpellWindow(genRect(595, 620, (screen->w - 620)/2, (screen->h - 595)/2), myHero, myOwner->getCurrentPlayerInterface()); GH.pushInt(new CSpellWindow(myHero, myOwner->getCurrentPlayerInterface()));
GH.pushInt(spellWindow);
} }
} }

View File

@ -123,10 +123,7 @@ void CArtPlace::clickLeft(tribool down, bool previousState)
if(ourArt && !down && previousState && !ourOwner->commonInfo->src.AOH) if(ourArt && !down && previousState && !ourOwner->commonInfo->src.AOH)
{ {
if(ourArt->artType->id == ArtifactID::SPELLBOOK) if(ourArt->artType->id == ArtifactID::SPELLBOOK)
{ GH.pushInt(new CSpellWindow(ourOwner->curHero, LOCPLINT, LOCPLINT->battleInt));
auto spellWindow = new CSpellWindow(genRect(595, 620, (screen->w - 620)/2, (screen->h - 595)/2), ourOwner->curHero, LOCPLINT, LOCPLINT->battleInt);
GH.pushInt(spellWindow);
}
} }
if (!down && previousState) if (!down && previousState)

View File

@ -714,8 +714,7 @@ void CAdvMapInt::fshowSpellbok()
centerOn(selection); centerOn(selection);
auto spellWindow = new CSpellWindow(genRect(595, 620, (screen->w - 620)/2, (screen->h - 595)/2), curHero(), LOCPLINT, false); GH.pushInt(new CSpellWindow(curHero(), LOCPLINT, false));
GH.pushInt(spellWindow);
} }
void CAdvMapInt::fadventureOPtions() void CAdvMapInt::fadventureOPtions()

View File

@ -4,7 +4,6 @@
#include "CAdvmapInterface.h" #include "CAdvmapInterface.h"
#include "CCreatureWindow.h" #include "CCreatureWindow.h"
#include "CKingdomInterface.h" #include "CKingdomInterface.h"
#include "CSpellWindow.h"
#include "GUIClasses.h" #include "GUIClasses.h"
#include "../CBitmapHandler.h" #include "../CBitmapHandler.h"

View File

@ -74,7 +74,7 @@ void CSpellWindow::InteractiveArea::hover(bool on)
owner->statusBar->clear(); owner->statusBar->clear();
} }
CSpellWindow::CSpellWindow(const SDL_Rect &, const CGHeroInstance * _myHero, CPlayerInterface * _myInt, bool openOnBattleSpells): CSpellWindow::CSpellWindow(const CGHeroInstance * _myHero, CPlayerInterface * _myInt, bool openOnBattleSpells):
CWindowObject(PLAYER_COLORED, "SpelBack"), CWindowObject(PLAYER_COLORED, "SpelBack"),
battleSpellsOnly(openOnBattleSpells), battleSpellsOnly(openOnBattleSpells),
selectedTab(4), selectedTab(4),

View File

@ -92,7 +92,7 @@ private:
public: public:
CSpellWindow(const SDL_Rect & myRect, const CGHeroInstance * _myHero, CPlayerInterface * _myInt, bool openOnBattleSpells = true); //c-tor CSpellWindow(const CGHeroInstance * _myHero, CPlayerInterface * _myInt, bool openOnBattleSpells = true); //c-tor
~CSpellWindow(); //d-tor ~CSpellWindow(); //d-tor
void fexitb(); void fexitb();

View File

@ -5,7 +5,6 @@
#include "CCastleInterface.h" #include "CCastleInterface.h"
#include "CCreatureWindow.h" #include "CCreatureWindow.h"
#include "CHeroWindow.h" #include "CHeroWindow.h"
#include "CSpellWindow.h"
#include "../CBitmapHandler.h" #include "../CBitmapHandler.h"
#include "../CGameInfo.h" #include "../CGameInfo.h"