mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
* small changes
This commit is contained in:
@@ -905,50 +905,6 @@ void CCallback::calculatePaths( const CGHeroInstance *hero, CPathsInfo &out, int
|
|||||||
gs->calculatePaths(hero, out, src, movement);
|
gs->calculatePaths(hero, out, src, movement);
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoAboutHero::InfoAboutHero()
|
|
||||||
{
|
|
||||||
details = NULL;
|
|
||||||
hclass = NULL;
|
|
||||||
portrait = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
InfoAboutHero::~InfoAboutHero()
|
|
||||||
{
|
|
||||||
delete details;
|
|
||||||
}
|
|
||||||
|
|
||||||
void InfoAboutHero::initFromHero( const CGHeroInstance *h, bool detailed )
|
|
||||||
{
|
|
||||||
owner = h->tempOwner;
|
|
||||||
hclass = h->type->heroClass;
|
|
||||||
name = h->name;
|
|
||||||
portrait = h->portrait;
|
|
||||||
army = h->army;
|
|
||||||
|
|
||||||
if(detailed)
|
|
||||||
{
|
|
||||||
//include details about hero
|
|
||||||
details = new Details;
|
|
||||||
details->luck = h->getCurrentLuck();
|
|
||||||
details->morale = h->getCurrentMorale();
|
|
||||||
details->mana = h->mana;
|
|
||||||
details->primskills.resize(PRIMARY_SKILLS);
|
|
||||||
|
|
||||||
for (int i = 0; i < PRIMARY_SKILLS ; i++)
|
|
||||||
{
|
|
||||||
details->primskills[i] = h->getPrimSkillLevel(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//hide info about hero stacks counts using descriptives names ids
|
|
||||||
for(std::map<si32,std::pair<ui32,si32> >::iterator i = army.slots.begin(); i != army.slots.end(); ++i)
|
|
||||||
{
|
|
||||||
i->second.second = CCreature::getQuantityID(i->second.second);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
InfoAboutTown::InfoAboutTown()
|
InfoAboutTown::InfoAboutTown()
|
||||||
{
|
{
|
||||||
tType = NULL;
|
tType = NULL;
|
||||||
|
19
CCallback.h
19
CCallback.h
@@ -43,25 +43,6 @@ class CMapHeader;
|
|||||||
struct CGPathNode;
|
struct CGPathNode;
|
||||||
struct CGPath;
|
struct CGPath;
|
||||||
|
|
||||||
struct InfoAboutHero
|
|
||||||
{
|
|
||||||
struct Details
|
|
||||||
{
|
|
||||||
std::vector<int> primskills;
|
|
||||||
int mana, luck, morale;
|
|
||||||
} *details;
|
|
||||||
|
|
||||||
char owner;
|
|
||||||
const CHeroClass *hclass;
|
|
||||||
std::string name;
|
|
||||||
int portrait;
|
|
||||||
CCreatureSet army; //numbers of creatures are exact numbers if detailed else they are quantity ids (0 - a few, 1 - several and so on)
|
|
||||||
|
|
||||||
InfoAboutHero();
|
|
||||||
~InfoAboutHero();
|
|
||||||
void initFromHero(const CGHeroInstance *h, bool detailed);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct InfoAboutTown
|
struct InfoAboutTown
|
||||||
{
|
{
|
||||||
struct Details
|
struct Details
|
||||||
|
@@ -22,7 +22,7 @@ class CDefEssential;
|
|||||||
namespace config{struct ButtonInfo;}
|
namespace config{struct ButtonInfo;}
|
||||||
|
|
||||||
|
|
||||||
class CButtonBase : public KeyShortcut//basic buttton class
|
class CButtonBase : public KeyShortcut//basic button class
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct TextOverlay
|
struct TextOverlay
|
||||||
|
@@ -109,10 +109,10 @@ CHeroWindow::CHeroWindow(int playerColor):
|
|||||||
expArea->pos = genRect(42, 136, pos.x+83, pos.y + 236);
|
expArea->pos = genRect(42, 136, pos.x+83, pos.y + 236);
|
||||||
expArea->hoverText = CGI->generaltexth->heroscrn[9];
|
expArea->hoverText = CGI->generaltexth->heroscrn[9];
|
||||||
|
|
||||||
morale = new LRClickableAreaWTextComp();
|
morale = new MoraleLuckBox();
|
||||||
morale->pos = genRect(45,53,pos.x+240,pos.y+187);
|
morale->pos = genRect(45,53,pos.x+240,pos.y+187);
|
||||||
|
|
||||||
luck = new LRClickableAreaWTextComp();
|
luck = new MoraleLuckBox();
|
||||||
luck->pos = genRect(45,53,pos.x+298,pos.y+187);
|
luck->pos = genRect(45,53,pos.x+298,pos.y+187);
|
||||||
|
|
||||||
spellPointsArea = new LRClickableAreaWText();
|
spellPointsArea = new LRClickableAreaWText();
|
||||||
@@ -287,36 +287,8 @@ void CHeroWindow::setHero(const CGHeroInstance *hero)
|
|||||||
formations->select(hero->army.formation,true);
|
formations->select(hero->army.formation,true);
|
||||||
formations->onChange = boost::bind(&CCallback::setFormation, LOCPLINT->cb, hero, _1);
|
formations->onChange = boost::bind(&CCallback::setFormation, LOCPLINT->cb, hero, _1);
|
||||||
|
|
||||||
//setting morale
|
morale->set(true, hero);
|
||||||
std::vector<std::pair<int,std::string> > mrl = hero->getCurrentMoraleModifiers();
|
luck->set(false, hero);
|
||||||
int mrlv = hero->getCurrentMorale();
|
|
||||||
int mrlt = (mrlv>0)-(mrlv<0); //signum: -1 - bad morale, 0 - neutral, 1 - good
|
|
||||||
morale->hoverText = CGI->generaltexth->heroscrn[4 - mrlt];
|
|
||||||
morale->baseType = SComponent::morale;
|
|
||||||
morale->bonus = mrlv;
|
|
||||||
morale->text = CGI->generaltexth->arraytxt[88];
|
|
||||||
boost::algorithm::replace_first(morale->text,"%s",CGI->generaltexth->arraytxt[86-mrlt]);
|
|
||||||
if (!mrl.size())
|
|
||||||
morale->text += CGI->generaltexth->arraytxt[108];
|
|
||||||
else
|
|
||||||
for(int it=0; it < mrl.size(); it++)
|
|
||||||
morale->text += "\n" + mrl[it].second;
|
|
||||||
|
|
||||||
|
|
||||||
//setting luck
|
|
||||||
mrl = hero->getCurrentLuckModifiers();
|
|
||||||
mrlv = hero->getCurrentLuck();
|
|
||||||
mrlt = (mrlv>0)-(mrlv<0); //signum: -1 - bad luck, 0 - neutral, 1 - good
|
|
||||||
luck->hoverText = CGI->generaltexth->heroscrn[7 - mrlt];
|
|
||||||
luck->baseType = SComponent::luck;
|
|
||||||
luck->bonus = mrlv;
|
|
||||||
luck->text = CGI->generaltexth->arraytxt[62];
|
|
||||||
boost::algorithm::replace_first(luck->text,"%s",CGI->generaltexth->arraytxt[60-mrlt]);
|
|
||||||
if (!mrl.size())
|
|
||||||
luck->text += CGI->generaltexth->arraytxt[77];
|
|
||||||
else
|
|
||||||
for(int it=0; it < mrl.size(); it++)
|
|
||||||
luck->text += "\n" + mrl[it].second;
|
|
||||||
|
|
||||||
//restoring pos
|
//restoring pos
|
||||||
pos.x += 65;
|
pos.x += 65;
|
||||||
|
@@ -46,9 +46,8 @@ class CHeroWindow: public CWindowWithGarrison
|
|||||||
std::vector<LRClickableAreaWTextComp *> primSkillAreas;
|
std::vector<LRClickableAreaWTextComp *> primSkillAreas;
|
||||||
LRClickableAreaWText * expArea;
|
LRClickableAreaWText * expArea;
|
||||||
LRClickableAreaWText * spellPointsArea;
|
LRClickableAreaWText * spellPointsArea;
|
||||||
LRClickableAreaWTextComp * luck;
|
|
||||||
LRClickableAreaWText * specArea;//speciality
|
LRClickableAreaWText * specArea;//speciality
|
||||||
LRClickableAreaWTextComp * morale;
|
MoraleLuckBox * morale, * luck;
|
||||||
std::vector<LRClickableAreaWTextComp *> secSkillAreas;
|
std::vector<LRClickableAreaWTextComp *> secSkillAreas;
|
||||||
public:
|
public:
|
||||||
const CGHeroInstance * curHero;
|
const CGHeroInstance * curHero;
|
||||||
|
@@ -141,6 +141,7 @@ void CPlayerInterface::init(ICallback * CB)
|
|||||||
}
|
}
|
||||||
void CPlayerInterface::yourTurn()
|
void CPlayerInterface::yourTurn()
|
||||||
{
|
{
|
||||||
|
boost::unique_lock<boost::recursive_mutex> un(*pim);
|
||||||
LOCPLINT = this;
|
LOCPLINT = this;
|
||||||
makingTurn = true;
|
makingTurn = true;
|
||||||
|
|
||||||
|
@@ -306,7 +306,7 @@ public:
|
|||||||
int ID; //object ID, rarely used by some classes for identification / internal info
|
int ID; //object ID, rarely used by some classes for identification / internal info
|
||||||
|
|
||||||
CIntObject();
|
CIntObject();
|
||||||
virtual ~CIntObject();; //d-tor
|
virtual ~CIntObject(); //d-tor
|
||||||
|
|
||||||
//l-clicks handling
|
//l-clicks handling
|
||||||
bool pressedL; //for determining if object is L-pressed
|
bool pressedL; //for determining if object is L-pressed
|
||||||
@@ -421,6 +421,11 @@ public:
|
|||||||
SDL_Surface *bg;
|
SDL_Surface *bg;
|
||||||
bool freeSurf;
|
bool freeSurf;
|
||||||
|
|
||||||
|
operator SDL_Surface*()
|
||||||
|
{
|
||||||
|
return bg;
|
||||||
|
}
|
||||||
|
|
||||||
CPicture(SDL_Surface *BG, int x, int y, bool Free = true);
|
CPicture(SDL_Surface *BG, int x, int y, bool Free = true);
|
||||||
CPicture(const std::string &bmpname, int x, int y);
|
CPicture(const std::string &bmpname, int x, int y);
|
||||||
~CPicture();
|
~CPicture();
|
||||||
|
@@ -353,7 +353,7 @@ void CGarrisonSlot::show(SDL_Surface * to)
|
|||||||
char buf[15];
|
char buf[15];
|
||||||
SDL_itoa(count,buf,10);
|
SDL_itoa(count,buf,10);
|
||||||
blitAt(imgs[creature->idNumber],pos,to);
|
blitAt(imgs[creature->idNumber],pos,to);
|
||||||
printTo(buf, pos.x+pos.w, pos.y+pos.h+1, owner->smallIcons ? FONT_TINY : FONT_VERD, zwykly, to);
|
printTo(buf, pos.x+pos.w, pos.y+pos.h+1, owner->smallIcons ? FONT_TINY : FONT_MEDIUM, zwykly, to);
|
||||||
|
|
||||||
if((owner->highlighted==this)
|
if((owner->highlighted==this)
|
||||||
|| (owner->splitting && owner->highlighted->creature == creature))
|
|| (owner->splitting && owner->highlighted->creature == creature))
|
||||||
@@ -1125,8 +1125,8 @@ CStatusBar::CStatusBar(int x, int y, std::string name, int maxw)
|
|||||||
{
|
{
|
||||||
bg=BitmapHandler::loadBitmap(name);
|
bg=BitmapHandler::loadBitmap(name);
|
||||||
SDL_SetColorKey(bg,SDL_SRCCOLORKEY,SDL_MapRGB(bg->format,0,255,255));
|
SDL_SetColorKey(bg,SDL_SRCCOLORKEY,SDL_MapRGB(bg->format,0,255,255));
|
||||||
pos.x=x;
|
pos.x += x;
|
||||||
pos.y=y;
|
pos.y += y;
|
||||||
if(maxw >= 0)
|
if(maxw >= 0)
|
||||||
pos.w = std::min(bg->w,maxw);
|
pos.w = std::min(bg->w,maxw);
|
||||||
else
|
else
|
||||||
@@ -4833,20 +4833,10 @@ void CArtMerchantWindow::Buy() {}
|
|||||||
|
|
||||||
void CThievesGuildWindow::activate()
|
void CThievesGuildWindow::activate()
|
||||||
{
|
{
|
||||||
statusBar->activate();
|
CIntObject::activate();
|
||||||
exitb->activate();
|
|
||||||
resdatabar->activate();
|
|
||||||
|
|
||||||
LOCPLINT->statusbar = statusBar;
|
LOCPLINT->statusbar = statusBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CThievesGuildWindow::deactivate()
|
|
||||||
{
|
|
||||||
statusBar->deactivate();
|
|
||||||
exitb->deactivate();
|
|
||||||
resdatabar->deactivate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CThievesGuildWindow::show(SDL_Surface * to)
|
void CThievesGuildWindow::show(SDL_Surface * to)
|
||||||
{
|
{
|
||||||
blitAt(background, pos.x, pos.y, to);
|
blitAt(background, pos.x, pos.y, to);
|
||||||
@@ -4870,10 +4860,12 @@ void CThievesGuildWindow::bexitf()
|
|||||||
CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner)
|
CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner)
|
||||||
:owner(_owner)
|
:owner(_owner)
|
||||||
{
|
{
|
||||||
|
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
||||||
|
|
||||||
SThievesGuildInfo tgi; //info to be displayed
|
SThievesGuildInfo tgi; //info to be displayed
|
||||||
LOCPLINT->cb->getThievesGuildInfo(tgi, owner);
|
LOCPLINT->cb->getThievesGuildInfo(tgi, owner);
|
||||||
|
|
||||||
pos = Rect( (conf.cc.resx - 800) / 2, (conf.cc.resy - 600) / 2, 800, 600 );
|
pos = center(Rect(0,0,800,600));// Rect( (conf.cc.resx - 800) / 2, (conf.cc.resy - 600) / 2, 800, 600 );
|
||||||
|
|
||||||
//loading backround and converting to more bpp form
|
//loading backround and converting to more bpp form
|
||||||
SDL_Surface * bg = background = BitmapHandler::loadBitmap("TpRank.bmp", false);
|
SDL_Surface * bg = background = BitmapHandler::loadBitmap("TpRank.bmp", false);
|
||||||
@@ -4881,8 +4873,8 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner)
|
|||||||
blitAt(bg, 0, 0, background);
|
blitAt(bg, 0, 0, background);
|
||||||
SDL_FreeSurface(bg);
|
SDL_FreeSurface(bg);
|
||||||
|
|
||||||
exitb = new AdventureMapButton (std::string(), std::string(), boost::bind(&CThievesGuildWindow::bexitf,this), 748 + pos.x, 556 + pos.y, "HSBTNS.def", SDLK_RETURN);
|
exitb = new AdventureMapButton (std::string(), std::string(), boost::bind(&CThievesGuildWindow::bexitf,this), 748, 556, "HSBTNS.def", SDLK_RETURN);
|
||||||
statusBar = new CStatusBar(pos.x + 3, pos.y + 555, "TStatBar.bmp", 742);
|
statusBar = new CStatusBar(3, 555, "TStatBar.bmp", 742);
|
||||||
|
|
||||||
resdatabar = new CMinorResDataBar();
|
resdatabar = new CMinorResDataBar();
|
||||||
resdatabar->pos.x += pos.x - 3;
|
resdatabar->pos.x += pos.x - 3;
|
||||||
@@ -4960,7 +4952,7 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner)
|
|||||||
//printing best hero
|
//printing best hero
|
||||||
|
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
for(std::map<ui8, SThievesGuildInfo::InfoAboutHero>::const_iterator it = tgi.colorToBestHero.begin(); it != tgi.colorToBestHero.end(); ++it)
|
for(std::map<ui8, InfoAboutHero>::const_iterator it = tgi.colorToBestHero.begin(); it != tgi.colorToBestHero.end(); ++it)
|
||||||
{
|
{
|
||||||
blitAt(graphics->portraitSmall[it->second.portrait], 260 + 66 * counter, 360, background);
|
blitAt(graphics->portraitSmall[it->second.portrait], 260 + 66 * counter, 360, background);
|
||||||
counter++;
|
counter++;
|
||||||
@@ -4979,12 +4971,53 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner)
|
|||||||
CThievesGuildWindow::~CThievesGuildWindow()
|
CThievesGuildWindow::~CThievesGuildWindow()
|
||||||
{
|
{
|
||||||
SDL_FreeSurface(background);
|
SDL_FreeSurface(background);
|
||||||
delete exitb;
|
// delete exitb;
|
||||||
delete statusBar;
|
// delete statusBar;
|
||||||
delete resdatabar;
|
// delete resdatabar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void MoraleLuckBox::set( bool morale, const CGHeroInstance *hero, int slot /*= -1*/ )
|
||||||
|
{
|
||||||
|
int mrlv = -9, mrlt = -9;
|
||||||
|
std::vector<std::pair<int,std::string> > mrl;
|
||||||
|
|
||||||
|
if(morale)
|
||||||
|
{
|
||||||
|
//setting morale
|
||||||
|
mrl = hero->getCurrentMoraleModifiers();
|
||||||
|
mrlv = hero->getCurrentMorale();
|
||||||
|
mrlt = (mrlv>0)-(mrlv<0); //signum: -1 - bad morale, 0 - neutral, 1 - good
|
||||||
|
hoverText = CGI->generaltexth->heroscrn[4 - mrlt];
|
||||||
|
baseType = SComponent::morale;
|
||||||
|
bonus = mrlv;
|
||||||
|
text = CGI->generaltexth->arraytxt[88];
|
||||||
|
boost::algorithm::replace_first(text,"%s",CGI->generaltexth->arraytxt[86-mrlt]);
|
||||||
|
if (!mrl.size())
|
||||||
|
text += CGI->generaltexth->arraytxt[108];
|
||||||
|
else
|
||||||
|
for(int it=0; it < mrl.size(); it++)
|
||||||
|
text += "\n" + mrl[it].second;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//setting luck
|
||||||
|
mrl = hero->getCurrentLuckModifiers();
|
||||||
|
mrlv = hero->getCurrentLuck();
|
||||||
|
mrlt = (mrlv>0)-(mrlv<0); //signum: -1 - bad luck, 0 - neutral, 1 - good
|
||||||
|
hoverText = CGI->generaltexth->heroscrn[7 - mrlt];
|
||||||
|
baseType = SComponent::luck;
|
||||||
|
bonus = mrlv;
|
||||||
|
text = CGI->generaltexth->arraytxt[62];
|
||||||
|
boost::algorithm::replace_first(text,"%s",CGI->generaltexth->arraytxt[60-mrlt]);
|
||||||
|
if (!mrl.size())
|
||||||
|
text += CGI->generaltexth->arraytxt[77];
|
||||||
|
else
|
||||||
|
for(int it=0; it < mrl.size(); it++)
|
||||||
|
text += "\n" + mrl[it].second;
|
||||||
|
}
|
||||||
|
}
|
@@ -408,32 +408,6 @@ public:
|
|||||||
void sliderMoved(int to);
|
void sliderMoved(int to);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCreInfoWindow : public CIntObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
//bool active; //TODO: comment me
|
|
||||||
int type;//0 - rclick popup; 1 - normal window
|
|
||||||
SDL_Surface *bitmap; //background
|
|
||||||
char anf; //animation counter
|
|
||||||
std::string count; //creature count in text format
|
|
||||||
|
|
||||||
boost::function<void()> dsm; //dismiss button callback
|
|
||||||
CCreaturePic *anim; //related creature's animation
|
|
||||||
CCreature *c; //related creature
|
|
||||||
std::vector<SComponent*> upgResCost; //cost of upgrade (if not possible then empty)
|
|
||||||
|
|
||||||
AdventureMapButton *dismiss, *upgrade, *ok;
|
|
||||||
CCreInfoWindow(int Cid, int Type, int creatureCount, StackState *State, boost::function<void()> Upg, boost::function<void()> Dsm, UpgradeInfo *ui); //c-tor
|
|
||||||
~CCreInfoWindow(); //d-tor
|
|
||||||
void activate();
|
|
||||||
void close();
|
|
||||||
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 CIntObject
|
class CLevelWindow : public CIntObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -644,6 +618,13 @@ public:
|
|||||||
virtual void clickRight(tribool down, bool previousState);
|
virtual void clickRight(tribool down, bool previousState);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MoraleLuckBox : public LRClickableAreaWTextComp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
void set(bool morale, const CGHeroInstance *hero, int slot = -1); //slot -1 means only hero modifiers
|
||||||
|
};
|
||||||
|
|
||||||
class LRClickableAreaOpenHero: public LRClickableAreaWTextComp
|
class LRClickableAreaOpenHero: public LRClickableAreaWTextComp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -661,6 +642,34 @@ public:
|
|||||||
void clickRight(tribool down, bool previousState);
|
void clickRight(tribool down, bool previousState);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CCreInfoWindow : public CIntObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//bool active; //TODO: comment me
|
||||||
|
int type;//0 - rclick popup; 1 - normal window
|
||||||
|
SDL_Surface *bitmap; //background
|
||||||
|
char anf; //animation counter
|
||||||
|
std::string count; //creature count in text format
|
||||||
|
|
||||||
|
boost::function<void()> dsm; //dismiss button callback
|
||||||
|
CCreaturePic *anim; //related creature's animation
|
||||||
|
CCreature *c; //related creature
|
||||||
|
std::vector<SComponent*> upgResCost; //cost of upgrade (if not possible then empty)
|
||||||
|
|
||||||
|
//MoraleLuckBox *luck, *morale;
|
||||||
|
|
||||||
|
AdventureMapButton *dismiss, *upgrade, *ok;
|
||||||
|
CCreInfoWindow(int Cid, int Type, int creatureCount, StackState *State, boost::function<void()> Upg, boost::function<void()> Dsm, UpgradeInfo *ui); //c-tor
|
||||||
|
~CCreInfoWindow(); //d-tor
|
||||||
|
void activate();
|
||||||
|
void close();
|
||||||
|
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 CArtPlace: public LRClickableAreaWTextComp
|
class CArtPlace: public LRClickableAreaWTextComp
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@@ -855,7 +864,6 @@ class CThievesGuildWindow : public CIntObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void activate();
|
void activate();
|
||||||
void deactivate();
|
|
||||||
void show(SDL_Surface * to);
|
void show(SDL_Surface * to);
|
||||||
|
|
||||||
void bexitf();
|
void bexitf();
|
||||||
|
@@ -628,6 +628,13 @@ void OpenWindow::applyCl(CClient *cl)
|
|||||||
INTERFACE_CALL_IF_PRESENT(sy->o->tempOwner, showShipyardDialog, sy);
|
INTERFACE_CALL_IF_PRESENT(sy->o->tempOwner, showShipyardDialog, sy);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case THIEVES_GUILD:
|
||||||
|
{
|
||||||
|
//displays Thieves' Guild window (when hero enters Den of Thieves)
|
||||||
|
const CGObjectInstance *obj = cl->getObj(id1);
|
||||||
|
GH.pushInt( new CThievesGuildWindow(obj) );
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -668,10 +675,3 @@ void TradeComponents::applyCl(CClient *cl)
|
|||||||
tlog2 << "Shop type not supported! \n";
|
tlog2 << "Shop type not supported! \n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SShowThievesGuildWindow::applyCl(CClient *cl)
|
|
||||||
{
|
|
||||||
//displays Thieves' Guild window (when hero enters Den of Thieves)
|
|
||||||
const CGObjectInstance *obj = cl->getObj(requestingObject);
|
|
||||||
GH.pushInt( new CThievesGuildWindow(obj) );
|
|
||||||
}
|
|
||||||
|
@@ -3191,12 +3191,9 @@ void CGameState::obtainPlayersStats(SThievesGuildInfo & tgi, int level)
|
|||||||
if(g->second.color == 255)
|
if(g->second.color == 255)
|
||||||
continue;
|
continue;
|
||||||
const CGHeroInstance * best = HLP::findBestHero(this, g->second.color);
|
const CGHeroInstance * best = HLP::findBestHero(this, g->second.color);
|
||||||
SThievesGuildInfo::InfoAboutHero iah;
|
InfoAboutHero iah;
|
||||||
iah.portrait = best->portrait;
|
iah.initFromHero(best, level >= 8);
|
||||||
for(int c=0; c<PRIMARY_SKILLS; ++c)
|
iah.army.slots.clear();
|
||||||
{
|
|
||||||
iah.primSkills[c] = -1; //mark as unknown
|
|
||||||
}
|
|
||||||
tgi.colorToBestHero[g->second.color] = iah;
|
tgi.colorToBestHero[g->second.color] = iah;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3230,18 +3227,7 @@ void CGameState::obtainPlayersStats(SThievesGuildInfo & tgi, int level)
|
|||||||
}
|
}
|
||||||
if(level >= 8) //best hero's stats
|
if(level >= 8) //best hero's stats
|
||||||
{
|
{
|
||||||
for(std::map<ui8, PlayerState>::const_iterator g = players.begin(); g != players.end(); ++g)
|
//already set in lvl 1 handling
|
||||||
{
|
|
||||||
if(g->second.color == 255) //do nothing for neutral player
|
|
||||||
continue;
|
|
||||||
const CGHeroInstance * best = HLP::findBestHero(this, g->second.color);
|
|
||||||
|
|
||||||
for(int k=0; k<ARRAY_COUNT(tgi.colorToBestHero[g->second.color].primSkills); ++k)
|
|
||||||
{
|
|
||||||
//getting prim skills with all bonuses
|
|
||||||
tgi.colorToBestHero[g->second.color].primSkills[k] = best->getPrimSkillLevel(k);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(level >= 9) //personality
|
if(level >= 9) //personality
|
||||||
{
|
{
|
||||||
@@ -3619,3 +3605,48 @@ PlayerState::PlayerState()
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InfoAboutHero::InfoAboutHero()
|
||||||
|
{
|
||||||
|
details = NULL;
|
||||||
|
hclass = NULL;
|
||||||
|
portrait = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
InfoAboutHero::~InfoAboutHero()
|
||||||
|
{
|
||||||
|
delete details;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InfoAboutHero::initFromHero( const CGHeroInstance *h, bool detailed )
|
||||||
|
{
|
||||||
|
owner = h->tempOwner;
|
||||||
|
hclass = h->type->heroClass;
|
||||||
|
name = h->name;
|
||||||
|
portrait = h->portrait;
|
||||||
|
army = h->army;
|
||||||
|
|
||||||
|
if(detailed)
|
||||||
|
{
|
||||||
|
//include details about hero
|
||||||
|
details = new Details;
|
||||||
|
details->luck = h->getCurrentLuck();
|
||||||
|
details->morale = h->getCurrentMorale();
|
||||||
|
details->mana = h->mana;
|
||||||
|
details->primskills.resize(PRIMARY_SKILLS);
|
||||||
|
|
||||||
|
for (int i = 0; i < PRIMARY_SKILLS ; i++)
|
||||||
|
{
|
||||||
|
details->primskills[i] = h->getPrimSkillLevel(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//hide info about hero stacks counts using descriptives names ids
|
||||||
|
for(std::map<si32,std::pair<ui32,si32> >::iterator i = army.slots.begin(); i != army.slots.end(); ++i)
|
||||||
|
{
|
||||||
|
i->second.second = CCreature::getQuantityID(i->second.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -52,39 +52,50 @@ struct MetaString;
|
|||||||
struct CPack;
|
struct CPack;
|
||||||
class CSpell;
|
class CSpell;
|
||||||
struct TerrainTile;
|
struct TerrainTile;
|
||||||
|
class CHeroClass;
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
class shared_mutex;
|
class shared_mutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct DLL_EXPORT InfoAboutHero
|
||||||
|
{
|
||||||
|
struct DLL_EXPORT Details
|
||||||
|
{
|
||||||
|
std::vector<int> primskills;
|
||||||
|
int mana, luck, morale;
|
||||||
|
} *details;
|
||||||
|
|
||||||
|
char owner;
|
||||||
|
const CHeroClass *hclass;
|
||||||
|
std::string name;
|
||||||
|
int portrait;
|
||||||
|
CCreatureSet army; //numbers of creatures are exact numbers if detailed else they are quantity ids (0 - a few, 1 - several and so on)
|
||||||
|
|
||||||
|
InfoAboutHero();
|
||||||
|
~InfoAboutHero();
|
||||||
|
void initFromHero(const CGHeroInstance *h, bool detailed);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct DLL_EXPORT SThievesGuildInfo
|
struct DLL_EXPORT SThievesGuildInfo
|
||||||
{
|
{
|
||||||
std::vector<ui8> playerColors; //colors of players that are in-game
|
std::vector<ui8> playerColors; //colors of players that are in-game
|
||||||
|
|
||||||
std::vector< std::list< ui8 > > numOfTowns, numOfHeroes, gold, woodOre, mercSulfCrystGems, obelisks, artifacts, army, income; // [place] -> [colours of players]
|
std::vector< std::list< ui8 > > numOfTowns, numOfHeroes, gold, woodOre, mercSulfCrystGems, obelisks, artifacts, army, income; // [place] -> [colours of players]
|
||||||
|
|
||||||
struct InfoAboutHero
|
|
||||||
{
|
|
||||||
ui32 portrait;
|
|
||||||
si32 primSkills[PRIMARY_SKILLS]; //-1 if not available; otherwise values
|
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
|
||||||
{
|
|
||||||
h & portrait & primSkills;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
std::map<ui8, InfoAboutHero> colorToBestHero; //maps player's color to his best heros'
|
std::map<ui8, InfoAboutHero> colorToBestHero; //maps player's color to his best heros'
|
||||||
|
|
||||||
std::map<ui8, si8> personality; // color to personality // -1 - human, AI -> (00 - random, 01 - warrior, 02 - builder, 03 - explorer)
|
std::map<ui8, si8> personality; // color to personality // -1 - human, AI -> (00 - random, 01 - warrior, 02 - builder, 03 - explorer)
|
||||||
std::map<ui8, si32> bestCreature; // color to ID // id or -1 if not known
|
std::map<ui8, si32> bestCreature; // color to ID // id or -1 if not known
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
// template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
// {
|
||||||
h & playerColors & numOfTowns & numOfHeroes & gold & woodOre & mercSulfCrystGems & obelisks & artifacts & army & income;
|
// h & playerColors & numOfTowns & numOfHeroes & gold & woodOre & mercSulfCrystGems & obelisks & artifacts & army & income;
|
||||||
h & colorToBestHero & personality & bestCreature;
|
// h & colorToBestHero & personality & bestCreature;
|
||||||
}
|
// }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -573,7 +573,7 @@ struct OpenWindow : public CPackForClient //517
|
|||||||
OpenWindow(){type = 517;};
|
OpenWindow(){type = 517;};
|
||||||
void applyCl(CClient *cl);
|
void applyCl(CClient *cl);
|
||||||
|
|
||||||
enum EWindow {EXCHANGE_WINDOW, RECRUITMENT_FIRST, RECRUITMENT_ALL, SHIPYARD_WINDOW};
|
enum EWindow {EXCHANGE_WINDOW, RECRUITMENT_FIRST, RECRUITMENT_ALL, SHIPYARD_WINDOW, THIEVES_GUILD};
|
||||||
ui8 window;
|
ui8 window;
|
||||||
ui32 id1, id2;
|
ui32 id1, id2;
|
||||||
|
|
||||||
@@ -1427,18 +1427,5 @@ struct CenterView : public CPackForClient//515
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SShowThievesGuildWindow : public CPackForClient //516
|
|
||||||
{
|
|
||||||
SShowThievesGuildWindow(){CPackForClient::type = 516;};
|
|
||||||
void applyCl(CClient *cl);
|
|
||||||
|
|
||||||
si32 requestingObject;
|
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
|
||||||
{
|
|
||||||
h & requestingObject;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif //__NETPACKS_H__
|
#endif //__NETPACKS_H__
|
||||||
|
@@ -59,6 +59,7 @@ void registerTypes1(Serializer &s)
|
|||||||
s.template registerType<CCartographer>();
|
s.template registerType<CCartographer>();
|
||||||
s.template registerType<CGObjectInstance>();
|
s.template registerType<CGObjectInstance>();
|
||||||
s.template registerType<COPWBonus>();
|
s.template registerType<COPWBonus>();
|
||||||
|
s.template registerType<CGDenOfthieves>();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Serializer> DLL_EXPORT
|
template<typename Serializer> DLL_EXPORT
|
||||||
@@ -123,7 +124,6 @@ void registerTypes2(Serializer &s)
|
|||||||
s.template registerType<SetSelection>();
|
s.template registerType<SetSelection>();
|
||||||
s.template registerType<PlayerMessage>();
|
s.template registerType<PlayerMessage>();
|
||||||
s.template registerType<CenterView>();
|
s.template registerType<CenterView>();
|
||||||
s.template registerType<SShowThievesGuildWindow>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Serializer> DLL_EXPORT
|
template<typename Serializer> DLL_EXPORT
|
||||||
|
@@ -762,7 +762,7 @@ void Mapa::loadTown( CGObjectInstance * &nobj, const unsigned char * bufor, int
|
|||||||
nt->identifier = 0;
|
nt->identifier = 0;
|
||||||
if(version>RoE)
|
if(version>RoE)
|
||||||
{
|
{
|
||||||
readNormalNr(bufor,i); i+=4;
|
nt->identifier = readNormalNr(bufor,i); i+=4;
|
||||||
}
|
}
|
||||||
nt->tempOwner = bufor[i]; ++i;
|
nt->tempOwner = bufor[i]; ++i;
|
||||||
if(readChar(bufor,i)) //has name
|
if(readChar(bufor,i)) //has name
|
||||||
|
@@ -47,7 +47,7 @@ class DLL_EXPORT CCreGenObjInfo : public CSpecObjInfo
|
|||||||
public:
|
public:
|
||||||
unsigned char player; //owner
|
unsigned char player; //owner
|
||||||
bool asCastle;
|
bool asCastle;
|
||||||
int identifier;
|
ui32 identifier;
|
||||||
unsigned char castles[2]; //allowed castles
|
unsigned char castles[2]; //allowed castles
|
||||||
};
|
};
|
||||||
class DLL_EXPORT CCreGen2ObjInfo : public CSpecObjInfo
|
class DLL_EXPORT CCreGen2ObjInfo : public CSpecObjInfo
|
||||||
@@ -55,7 +55,7 @@ class DLL_EXPORT CCreGen2ObjInfo : public CSpecObjInfo
|
|||||||
public:
|
public:
|
||||||
unsigned char player; //owner
|
unsigned char player; //owner
|
||||||
bool asCastle;
|
bool asCastle;
|
||||||
int identifier;
|
ui32 identifier;
|
||||||
unsigned char castles[2]; //allowed castles
|
unsigned char castles[2]; //allowed castles
|
||||||
unsigned char minLevel, maxLevel; //minimal and maximal level of creature in dwelling: <0, 6>
|
unsigned char minLevel, maxLevel; //minimal and maximal level of creature in dwelling: <0, 6>
|
||||||
};
|
};
|
||||||
|
@@ -3460,9 +3460,10 @@ void CGameHandler::showGarrisonDialog( int upobj, int hid, bool removableUnits,
|
|||||||
|
|
||||||
void CGameHandler::showThievesGuildWindow(int requestingObjId)
|
void CGameHandler::showThievesGuildWindow(int requestingObjId)
|
||||||
{
|
{
|
||||||
SShowThievesGuildWindow sthg;
|
OpenWindow ow;
|
||||||
sthg.requestingObject = requestingObjId;
|
ow.window = OpenWindow::THIEVES_GUILD;
|
||||||
sendAndApply(&sthg);
|
ow.id1 = requestingObjId;
|
||||||
|
sendAndApply(&ow);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameHandler::isAllowedExchange( int id1, int id2 )
|
bool CGameHandler::isAllowedExchange( int id1, int id2 )
|
||||||
@@ -3638,7 +3639,7 @@ void CGameHandler::checkLossVictory( ui8 player )
|
|||||||
setOwner((**i).id,NEUTRAL_PLAYER);
|
setOwner((**i).id,NEUTRAL_PLAYER);
|
||||||
}
|
}
|
||||||
|
|
||||||
//eliminating one player may cause victory of anoother:
|
//eliminating one player may cause victory of another:
|
||||||
winLoseHandle(ALL_PLAYERS & ~(1<<player));
|
winLoseHandle(ALL_PLAYERS & ~(1<<player));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user