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

* bug 1193 should be fixed

* minor refactoring
This commit is contained in:
mateuszb 2013-01-30 21:28:31 +00:00
parent 843f8f10c0
commit 5b0c6059e2
4 changed files with 24 additions and 24 deletions

View File

@ -42,8 +42,8 @@ class CSelectableSkill;
*
*/
CCreatureWindow::CCreatureWindow (const CStack &stack, int Type):
CWindowObject(PLAYER_COLORED | (Type == 0 ? RCLICK_POPUP : 0 ) ),
CCreatureWindow::CCreatureWindow (const CStack &stack, CreWinType Type):
CWindowObject(PLAYER_COLORED | (Type == OTHER ? RCLICK_POPUP : 0 ) ),
type(Type)
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
@ -57,8 +57,8 @@ CCreatureWindow::CCreatureWindow (const CStack &stack, int Type):
}
}
CCreatureWindow::CCreatureWindow (const CStackInstance &stack, int Type):
CWindowObject(PLAYER_COLORED | (Type == 0 ? RCLICK_POPUP : 0 ) ),
CCreatureWindow::CCreatureWindow (const CStackInstance &stack, CreWinType Type):
CWindowObject(PLAYER_COLORED | (Type == OTHER ? RCLICK_POPUP : 0 ) ),
type(Type)
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
@ -66,8 +66,8 @@ CCreatureWindow::CCreatureWindow (const CStackInstance &stack, int Type):
init(&stack, &stack, dynamic_cast<const CGHeroInstance*>(stack.armyObj));
}
CCreatureWindow::CCreatureWindow(int Cid, int Type, int creatureCount):
CWindowObject(PLAYER_COLORED | (Type == 0 ? RCLICK_POPUP : 0 ) ),
CCreatureWindow::CCreatureWindow(int Cid, CreWinType Type, int creatureCount):
CWindowObject(PLAYER_COLORED | (Type == OTHER ? RCLICK_POPUP : 0 ) ),
type(Type)
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
@ -77,8 +77,8 @@ CCreatureWindow::CCreatureWindow(int Cid, int Type, int creatureCount):
delete stack;
}
CCreatureWindow::CCreatureWindow(const CStackInstance &st, int Type, boost::function<void()> Upg, boost::function<void()> Dsm, UpgradeInfo *ui):
CWindowObject(PLAYER_COLORED | (Type == 0 ? RCLICK_POPUP : 0 ) ),
CCreatureWindow::CCreatureWindow(const CStackInstance &st, CreWinType Type, boost::function<void()> Upg, boost::function<void()> Dsm, UpgradeInfo *ui):
CWindowObject(PLAYER_COLORED | (Type == OTHER ? RCLICK_POPUP : 0 ) ),
type(Type),
dismiss(0),
upgrade(0),
@ -517,7 +517,7 @@ void CCreatureWindow::showAll(SDL_Surface * to)
if (stackNode->valOfBonuses(Bonus::SHOTS) && stackNode->hasBonusOfType(Bonus::SHOOTER))
{//only for shooting units - important with wog exp shooters
if (type == BATTLE)
printLine(2, CGI->generaltexth->allTexts[198], dynamic_cast<const CStack*>(stackNode)->shots);
printLine(2, CGI->generaltexth->allTexts[198], stackNode->valOfBonuses(Bonus::SHOTS), dynamic_cast<const CStack*>(stackNode)->shots);
else
printLine(2, CGI->generaltexth->allTexts[198], stackNode->valOfBonuses(Bonus::SHOTS));
}
@ -899,11 +899,11 @@ CIntObject * createCreWindow(
if(settings["general"]["classicCreatureWindow"].Bool())
return new CCreInfoWindow(*s, lclick);
else
return new CCreatureWindow(*s, lclick ? CCreatureWindow::BATTLE : CCreatureWindow::OTHER);
return new CCreatureWindow(*s, LOCPLINT->battleInt ? CCreatureWindow::BATTLE : CCreatureWindow::OTHER);
}
}
CIntObject * createCreWindow(int Cid, int Type, int creatureCount)
CIntObject * createCreWindow(int Cid, CCreatureWindow::CreWinType Type, int creatureCount)
{
if(settings["general"]["classicCreatureWindow"].Bool())
return new CCreInfoWindow(Cid, Type, creatureCount);
@ -911,10 +911,10 @@ CIntObject * createCreWindow(int Cid, int Type, int creatureCount)
return new CCreatureWindow(Cid, Type, creatureCount);
}
CIntObject * createCreWindow(const CStackInstance *s, int type, boost::function<void()> Upg, boost::function<void()> Dsm, UpgradeInfo *ui)
CIntObject * createCreWindow(const CStackInstance *s, CCreatureWindow::CreWinType type, boost::function<void()> Upg, boost::function<void()> Dsm, UpgradeInfo *ui)
{
if(settings["general"]["classicCreatureWindow"].Bool())
return new CCreInfoWindow(*s, type==3, Upg, Dsm, ui);
return new CCreInfoWindow(*s, type==CCreatureWindow::HERO, Upg, Dsm, ui);
else
return new CCreatureWindow(*s, type, Upg, Dsm, ui);
}

View File

@ -43,7 +43,7 @@ class CCreatureWindow : public CWindowObject, public CArtifactHolder
public:
enum CreWinType {OTHER = 0, BATTLE = 1, ARMY = 2, HERO = 3, COMMANDER = 4, COMMANDER_LEVEL_UP = 5, COMMANDER_BATTLE = 6}; // > 3 are opened permanently
//bool active; //TODO: comment me
int type;//0 - rclick popup; 1 - normal window
CreWinType type;
int bonusRows; //height of skill window
int displayedArtifact;
@ -86,12 +86,12 @@ public:
boost::function<void()> Upg; //upgrade button callback
boost::function<void(ui32)> levelUp; //choose commander skill to level up
CCreatureWindow(const CStack & stack, int type); //battle c-tor
CCreatureWindow (const CStackInstance &stack, int Type); //pop-up c-tor
CCreatureWindow(const CStackInstance &st, int Type, boost::function<void()> Upg, boost::function<void()> Dsm, UpgradeInfo *ui); //full garrison window
CCreatureWindow(const CStack & stack, CreWinType type); //battle c-tor
CCreatureWindow (const CStackInstance &stack, CreWinType Type); //pop-up c-tor
CCreatureWindow(const CStackInstance &st, CreWinType Type, boost::function<void()> Upg, boost::function<void()> Dsm, UpgradeInfo *ui); //full garrison window
CCreatureWindow(const CCommanderInstance * commander, const CStack * stack = NULL); //commander window
CCreatureWindow(std::vector<ui32> &skills, const CCommanderInstance * commander, boost::function<void(ui32)> callback);
CCreatureWindow(int Cid, int Type, int creatureCount); //c-tor
CCreatureWindow(int Cid, CreWinType Type, int creatureCount); //c-tor
void init(const CStackInstance *stack, const CBonusSystemNode *stackNode, const CGHeroInstance *heroOwner);
void showAll(SDL_Surface * to);
@ -159,5 +159,5 @@ public:
};
CIntObject *createCreWindow(const CStack *s, bool lclick = false);
CIntObject *createCreWindow(int Cid, int Type, int creatureCount);
CIntObject *createCreWindow(const CStackInstance *s, int type, boost::function<void()> Upg = 0, boost::function<void()> Dsm = 0, UpgradeInfo *ui = NULL);
CIntObject *createCreWindow(int Cid, CCreatureWindow::CreWinType Type, int creatureCount);
CIntObject *createCreWindow(const CStackInstance *s, CCreatureWindow::CreWinType type, boost::function<void()> Upg = 0, boost::function<void()> Dsm = 0, UpgradeInfo *ui = NULL);

View File

@ -303,7 +303,7 @@ void CGarrisonSlot::clickRight(tribool down, bool previousState)
{
if(down && creature)
{
GH.pushInt(createCreWindow(myStack, 2));
GH.pushInt(createCreWindow(myStack, CCreatureWindow::ARMY));
}
}
void CGarrisonSlot::clickLeft(tribool down, bool previousState)
@ -333,7 +333,7 @@ void CGarrisonSlot::clickLeft(tribool down, bool previousState)
redraw();
refr = true;
CIntObject *creWindow = createCreWindow(myStack, 3, upgr, dism, &pom);
CIntObject *creWindow = createCreWindow(myStack, CCreatureWindow::HERO, upgr, dism, &pom);
GH.pushInt(creWindow);
}
else
@ -1361,7 +1361,7 @@ void CRecruitmentWindow::CCreatureCard::clickLeft(tribool down, bool previousSta
void CRecruitmentWindow::CCreatureCard::clickRight(tribool down, bool previousState)
{
if (down)
GH.pushInt(createCreWindow(creature->idNumber, 0, 0));
GH.pushInt(createCreWindow(creature->idNumber, CCreatureWindow::OTHER, 0));
}
void CRecruitmentWindow::CCreatureCard::showAll(SDL_Surface * to)

View File

@ -24,7 +24,7 @@
#define CONSOLE_TEAL "\x1b[1;36m"
#else
#define WIN32_LEAN_AND_MEAN //excludes rarely used stuff from windows headers - delete this line if something is missing
#include <windows.h>
#include <Windows.h>
#ifndef __MINGW32__
#include <dbghelp.h>
#pragma comment(lib, "dbghelp.lib")