mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
[refactor] a few more cleanups
This commit is contained in:
parent
2f83b211ca
commit
264ce77ec9
@ -48,7 +48,6 @@ void CGDefInfo::fetchInfoFromMSK()
|
||||
|
||||
void CDefObjInfoHandler::load()
|
||||
{
|
||||
VLC->dobjinfo = this;
|
||||
auto textFile = CResourceHandler::get()->loadData(ResourceID("DATA/ZOBJCTS.TXT"));
|
||||
|
||||
std::istringstream inp(std::string((char*)textFile.first.get(), textFile.second));
|
||||
@ -60,7 +59,7 @@ void CDefObjInfoHandler::load()
|
||||
CGDefInfo* nobj = new CGDefInfo();
|
||||
std::string dump;
|
||||
inp>>nobj->name;
|
||||
|
||||
|
||||
std::transform(nobj->name.begin(), nobj->name.end(), nobj->name.begin(), (int(*)(int))toupper);
|
||||
|
||||
for(int o=0; o<6; ++o)
|
||||
@ -89,7 +88,7 @@ void CDefObjInfoHandler::load()
|
||||
}
|
||||
}
|
||||
|
||||
for(int yy=0; yy<2; ++yy) //first - on which types of terrain object can be placed;
|
||||
for(int yy=0; yy<2; ++yy) //first - on which types of terrain object can be placed;
|
||||
inp>>dump; //second -in which terrains' menus object in the editor will be available (?)
|
||||
inp>>nobj->id;
|
||||
inp>>nobj->subid;
|
||||
@ -101,9 +100,25 @@ void CDefObjInfoHandler::load()
|
||||
{
|
||||
nobj->visitDir = 0xff;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
static int visitableFromTop[] = {29, 82, 86, 11, 59, 8, 111,33,81,12,9,212,215,22}; //sea chest, flotsam, shipwreck survivor, buoy, ocean bottle, boat, whirlpool, garrison, scholar, campfire, borderguard, bordergate, questguard, corpse
|
||||
using namespace Obj;
|
||||
static int visitableFromTop[] =
|
||||
{FLOTSAM,
|
||||
SEA_CHEST,
|
||||
SHIPWRECK_SURVIVOR,
|
||||
BUOY,
|
||||
OCEAN_BOTTLE,
|
||||
BOAT,
|
||||
WHIRLPOOL,
|
||||
GARRISON,
|
||||
SCHOLAR,
|
||||
CAMPFIRE,
|
||||
BORDERGUARD,
|
||||
BORDER_GATE,
|
||||
QUEST_GUARD,
|
||||
CORPSE};
|
||||
|
||||
for(int i=0; i < ARRAY_COUNT(visitableFromTop); i++)
|
||||
{
|
||||
if(visitableFromTop[i] == nobj->id)
|
||||
@ -130,12 +145,12 @@ void CDefObjInfoHandler::load()
|
||||
|
||||
if(i)
|
||||
{
|
||||
gobjs[124][i] = new CGDefInfo(*gobjs[124][0]);
|
||||
gobjs[Obj::HOLE][i] = new CGDefInfo(*gobjs[Obj::HOLE][0]);
|
||||
}
|
||||
gobjs[124][i]->name = holeDefs[i];
|
||||
gobjs[Obj::HOLE][i]->name = holeDefs[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CDefObjInfoHandler::~CDefObjInfoHandler()
|
||||
{
|
||||
for(bmap<int,bmap<int, ConstTransitivePtr<CGDefInfo> > >::iterator i=gobjs.begin(); i!=gobjs.end(); i++)
|
||||
|
@ -83,6 +83,12 @@ static void showInfoDialog(const CGHeroInstance* h, const ui32 txtID, const ui16
|
||||
showInfoDialog(playerID,txtID,soundID);
|
||||
}
|
||||
|
||||
static std::string & visitedTxt(const bool visited)
|
||||
{
|
||||
int id = visited ? 352 : 353;
|
||||
return VLC->generaltexth->allTexts[id];
|
||||
}
|
||||
|
||||
///IObjectInterface
|
||||
void IObjectInterface::onHeroVisit(const CGHeroInstance * h) const
|
||||
{}
|
||||
@ -465,10 +471,8 @@ void CGObjectInstance::getNameVis( std::string &hname ) const
|
||||
hname = VLC->generaltexth->names[ID];
|
||||
if(h)
|
||||
{
|
||||
if(!h->hasBonusFrom(Bonus::OBJECT,ID))
|
||||
hname += " " + VLC->generaltexth->allTexts[353]; //not visited
|
||||
else
|
||||
hname += " " + VLC->generaltexth->allTexts[352]; //visited
|
||||
const bool visited = h->hasBonusFrom(Bonus::OBJECT,ID);
|
||||
hname + " " + visitedTxt(visited);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1604,7 +1608,7 @@ void CGDwelling::initObj()
|
||||
}
|
||||
}
|
||||
|
||||
void CGDwelling::setProperty(ui8 what, ui32 val)
|
||||
void CGDwelling::setPropertyDer(ui8 what, ui32 val)
|
||||
{
|
||||
switch (what)
|
||||
{
|
||||
@ -2768,9 +2772,8 @@ const std::string & CGVisitableOPH::getHoverText() const
|
||||
if(h)
|
||||
{
|
||||
hoverName += "\n\n";
|
||||
hoverName += (vstd::contains(visitors,h->id))
|
||||
? (VLC->generaltexth->allTexts[352]) //visited
|
||||
: ( VLC->generaltexth->allTexts[353]); //not visited
|
||||
bool visited = vstd::contains(visitors,h->id);
|
||||
hoverName += visitedTxt(visited);
|
||||
}
|
||||
return hoverName;
|
||||
}
|
||||
@ -2794,7 +2797,7 @@ void CGVisitableOPH::schoolSelected(int heroID, ui32 which) const
|
||||
|
||||
int base = (ID == Obj::SCHOOL_OF_MAGIC ? 2 : 0);
|
||||
cb->setObjProperty(id, ObjProperty::VISITORS, heroID); //add to the visitors
|
||||
cb->giveResource(cb->getOwner(heroID),6,-1000); //take 1000 gold
|
||||
cb->giveResource(cb->getOwner(heroID),Res::GOLD,-1000); //take 1000 gold
|
||||
cb->changePrimSkill(heroID, base + which-1, +1); //give appropriate skill
|
||||
}
|
||||
|
||||
@ -2826,7 +2829,7 @@ void COPWBonus::onHeroVisit (const CGHeroInstance * h) const
|
||||
switch (town->subID)
|
||||
{
|
||||
case ETownType::CASTLE: //Stables
|
||||
if (!h->hasBonusFrom(Bonus::OBJECT, 94)) //does not stack with advMap Stables
|
||||
if (!h->hasBonusFrom(Bonus::OBJECT, Obj::STABLES)) //does not stack with advMap Stables
|
||||
{
|
||||
GiveBonus gb;
|
||||
gb.bonus = Bonus(Bonus::ONE_WEEK, Bonus::LAND_MOVEMENT, Bonus::OBJECT, 600, 94, VLC->generaltexth->arraytxt[100]);
|
||||
@ -3593,7 +3596,7 @@ void CGVisitableOPW::onHeroVisit( const CGHeroInstance * h ) const
|
||||
cb->showInfoDialog(&iw);
|
||||
cb->setObjProperty(id, ObjProperty::VISITED, true);
|
||||
MetaString ms; //set text to "visited"
|
||||
ms << std::pair<ui8,ui32>(3,ID) << " " << std::pair<ui8,ui32>(1,352);
|
||||
ms.addTxt(MetaString::OBJ_NAMES,ID); ms << " "; ms.addTxt(MetaString::GENERAL_TXT,352);
|
||||
cb->setHoverName(id,&ms);
|
||||
}
|
||||
}
|
||||
@ -4745,25 +4748,24 @@ void CGWitchHut::onHeroVisit( const CGHeroInstance * h ) const
|
||||
iw.player = h->getOwner();
|
||||
if(!wasVisited(h->tempOwner))
|
||||
cb->setObjProperty(id,10,h->tempOwner);
|
||||
|
||||
ui32 txt_id;
|
||||
if(h->getSecSkillLevel(static_cast<CGHeroInstance::SecondarySkill>(ability))) //you alredy know this skill
|
||||
{
|
||||
iw.text.addTxt(MetaString::ADVOB_TXT,172);
|
||||
iw.text.addReplacement(MetaString::SEC_SKILL_NAME, ability);
|
||||
txt_id =172;
|
||||
}
|
||||
else if(!h->canLearnSkill()) //already all skills slots used
|
||||
{
|
||||
iw.text.addTxt(MetaString::ADVOB_TXT,173);
|
||||
iw.text.addReplacement(MetaString::SEC_SKILL_NAME, ability);
|
||||
txt_id = 173;
|
||||
}
|
||||
else //give sec skill
|
||||
{
|
||||
iw.components.push_back(Component(Component::SEC_SKILL, ability, 1, 0));
|
||||
iw.text.addTxt(MetaString::ADVOB_TXT,171);
|
||||
iw.text.addReplacement(MetaString::SEC_SKILL_NAME, ability);
|
||||
txt_id = 171;
|
||||
cb->changeSecSkill(h->id,ability,1,true);
|
||||
}
|
||||
|
||||
iw.text.addTxt(MetaString::ADVOB_TXT,txt_id);
|
||||
iw.text.addReplacement(MetaString::SEC_SKILL_NAME, ability);
|
||||
cb->showInfoDialog(&iw);
|
||||
}
|
||||
|
||||
@ -4980,10 +4982,8 @@ const std::string & CGBonusingObject::getHoverText() const
|
||||
hoverName = VLC->generaltexth->names[ID];
|
||||
if(h)
|
||||
{
|
||||
if(!h->hasBonusFrom(Bonus::OBJECT,ID))
|
||||
hoverName += " " + VLC->generaltexth->allTexts[353]; //not visited
|
||||
else
|
||||
hoverName += " " + VLC->generaltexth->allTexts[352]; //visited
|
||||
bool visited = h->hasBonusFrom(Bonus::OBJECT,ID);
|
||||
hoverName += " " + visitedTxt(visited);
|
||||
}
|
||||
return hoverName;
|
||||
}
|
||||
@ -5018,11 +5018,7 @@ void CGMagicSpring::onHeroVisit(const CGHeroInstance * h) const
|
||||
|
||||
const std::string & CGMagicSpring::getHoverText() const
|
||||
{
|
||||
hoverName = VLC->generaltexth->names[ID];
|
||||
if(!visited)
|
||||
hoverName += " " + VLC->generaltexth->allTexts[353]; //not visited
|
||||
else
|
||||
hoverName += " " + VLC->generaltexth->allTexts[352]; //visited
|
||||
hoverName = VLC->generaltexth->names[ID] + " " + visitedTxt(visited);
|
||||
return hoverName;
|
||||
}
|
||||
|
||||
@ -5489,10 +5485,11 @@ void CGSignBottle::onHeroVisit( const CGHeroInstance * h ) const
|
||||
cb->removeObject(id);
|
||||
}
|
||||
|
||||
void CGScholar::giveAnyBonus( const CGHeroInstance * h ) const
|
||||
{
|
||||
|
||||
}
|
||||
//TODO: remove
|
||||
//void CGScholar::giveAnyBonus( const CGHeroInstance * h ) const
|
||||
//{
|
||||
//
|
||||
//}
|
||||
|
||||
void CGScholar::onHeroVisit( const CGHeroInstance * h ) const
|
||||
{
|
||||
@ -5691,12 +5688,8 @@ void CGOnceVisitable::onHeroVisit( const CGHeroInstance * h ) const
|
||||
|
||||
const std::string & CGOnceVisitable::getHoverText() const
|
||||
{
|
||||
hoverName = VLC->generaltexth->names[ID] + " ";
|
||||
|
||||
hoverName += (wasVisited(cb->getCurrentPlayer())
|
||||
? (VLC->generaltexth->allTexts[352]) //visited
|
||||
: ( VLC->generaltexth->allTexts[353])); //not visited
|
||||
|
||||
const bool visited = wasVisited(cb->getCurrentPlayer());
|
||||
hoverName = VLC->generaltexth->names[ID] + " " + visitedTxt(visited);
|
||||
return hoverName;
|
||||
}
|
||||
|
||||
@ -5812,11 +5805,8 @@ void CBank::initObj()
|
||||
}
|
||||
const std::string & CBank::getHoverText() const
|
||||
{
|
||||
hoverName = VLC->objh->creBanksNames[index];
|
||||
if (bc == NULL)
|
||||
hoverName += " " + VLC->generaltexth->allTexts[352];
|
||||
else
|
||||
hoverName += " " + VLC->generaltexth->allTexts[353];
|
||||
bool visited = (bc == nullptr);
|
||||
hoverName = VLC->objh->creBanksNames[index] + " " + visitedTxt(visited);
|
||||
return hoverName;
|
||||
}
|
||||
void CBank::reset(ui16 var1) //prevents desync
|
||||
@ -6185,11 +6175,7 @@ void CGPyramid::initObj()
|
||||
}
|
||||
const std::string & CGPyramid::getHoverText() const
|
||||
{
|
||||
hoverName = VLC->objh->creBanksNames[21];
|
||||
if (bc == NULL)
|
||||
hoverName += " " + VLC->generaltexth->allTexts[352];
|
||||
else
|
||||
hoverName += " " + VLC->generaltexth->allTexts[353];
|
||||
hoverName = VLC->objh->creBanksNames[21]+ " " + visitedTxt((bc==nullptr));
|
||||
return hoverName;
|
||||
}
|
||||
void CGPyramid::onHeroVisit (const CGHeroInstance * h) const
|
||||
@ -6253,6 +6239,14 @@ bool CGKeys::wasMyColorVisited (int player) const
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string& CGKeys::getHoverText() const
|
||||
{
|
||||
bool visited = wasMyColorVisited (cb->getLocalPlayer());
|
||||
hoverName = getName() + "\n" + visitedTxt(visited);
|
||||
return hoverName;
|
||||
}
|
||||
|
||||
|
||||
const std::string CGKeys::getName() const
|
||||
{
|
||||
std::string name;
|
||||
@ -6260,16 +6254,6 @@ const std::string CGKeys::getName() const
|
||||
return name;
|
||||
}
|
||||
|
||||
const std::string & CGKeymasterTent::getHoverText() const
|
||||
{
|
||||
hoverName = getName();
|
||||
if (wasMyColorVisited (cb->getCurrentPlayer()) )//TODO: use local player, not current
|
||||
hoverName += "\n" + VLC->generaltexth->allTexts[352];
|
||||
else
|
||||
hoverName += "\n" + VLC->generaltexth->allTexts[353];
|
||||
return hoverName;
|
||||
}
|
||||
|
||||
bool CGKeymasterTent::wasVisited (ui8 player) const
|
||||
{
|
||||
return wasMyColorVisited (player);
|
||||
@ -6294,16 +6278,6 @@ void CGBorderGuard::initObj()
|
||||
blockVisit = true;
|
||||
}
|
||||
|
||||
const std::string & CGBorderGuard::getHoverText() const
|
||||
{
|
||||
hoverName = getName();
|
||||
if (wasMyColorVisited (cb->getCurrentPlayer()) )//TODO: use local player, not current
|
||||
hoverName += "\n" + VLC->generaltexth->allTexts[352];
|
||||
else
|
||||
hoverName += "\n" + VLC->generaltexth->allTexts[353];
|
||||
return hoverName;
|
||||
}
|
||||
|
||||
void CGBorderGuard::getVisitText (MetaString &text, std::vector<Component> &components, bool isCustom, bool FirstVisit, const CGHeroInstance * h) const
|
||||
{
|
||||
text << std::pair<ui8,ui32>(11,18);
|
||||
@ -6543,8 +6517,8 @@ void IBoatGenerator::getProblemText(MetaString &out, const CGHeroInstance *visit
|
||||
void IShipyard::getBoatCost( std::vector<si32> &cost ) const
|
||||
{
|
||||
cost.resize(GameConstants::RESOURCE_QUANTITY);
|
||||
cost[0] = 10;
|
||||
cost[6] = 1000;
|
||||
cost[Res::WOOD] = 10;
|
||||
cost[Res::GOLD] = 1000;
|
||||
}
|
||||
|
||||
IShipyard::IShipyard(const CGObjectInstance *O)
|
||||
@ -6707,11 +6681,8 @@ void CGObelisk::initObj()
|
||||
|
||||
const std::string & CGObelisk::getHoverText() const
|
||||
{
|
||||
hoverName = VLC->generaltexth->names[ID];
|
||||
if(wasVisited(cb->getCurrentPlayer()))
|
||||
hoverName += " " + VLC->generaltexth->allTexts[352]; //not visited
|
||||
else
|
||||
hoverName += " " + VLC->generaltexth->allTexts[353]; //visited
|
||||
bool visited = wasVisited(cb->getLocalPlayer());
|
||||
hoverName = VLC->generaltexth->names[ID] + " " + visitedTxt(visited);
|
||||
return hoverName;
|
||||
}
|
||||
|
||||
@ -6805,11 +6776,11 @@ CArmedInstance::CArmedInstance()
|
||||
battle = NULL;
|
||||
}
|
||||
|
||||
int CArmedInstance::valOfGlobalBonuses(CSelector selector) const
|
||||
{
|
||||
//if (tempOwner != NEUTRAL_PLAYER)
|
||||
return cb->gameState()->players[tempOwner].valOfBonuses(selector);
|
||||
}
|
||||
//int CArmedInstance::valOfGlobalBonuses(CSelector selector) const
|
||||
//{
|
||||
//// if (tempOwner != NEUTRAL_PLAYER)
|
||||
// return cb->gameState()->players[tempOwner].valOfBonuses(selector);
|
||||
//}
|
||||
|
||||
void CArmedInstance::updateMoraleBonusFromArmy()
|
||||
{
|
||||
|
@ -163,9 +163,6 @@ public:
|
||||
|
||||
class DLL_LINKAGE CGObjectInstance : public IObjectInterface
|
||||
{
|
||||
protected:
|
||||
void getNameVis(std::string &hname) const;
|
||||
void giveDummyBonus(int heroID, ui8 duration = Bonus::ONE_DAY) const;
|
||||
public:
|
||||
mutable std::string hoverName;
|
||||
int3 pos; //h3m pos
|
||||
@ -201,11 +198,10 @@ public:
|
||||
//CGObjectInstance& operator=(const CGObjectInstance & right);
|
||||
virtual const std::string & getHoverText() const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void initObj();
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void setProperty(ui8 what, ui32 val);//synchr
|
||||
virtual void setPropertyDer(ui8 what, ui32 val);//synchr
|
||||
///IObjectInterface
|
||||
void initObj() override;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void setProperty(ui8 what, ui32 val) override;//synchr
|
||||
|
||||
friend class CGameHandler;
|
||||
|
||||
@ -215,6 +211,11 @@ public:
|
||||
h & hoverName & pos & ID & subID & id & animPhaseShift & tempOwner & blockVisit & defInfo;
|
||||
//definfo is handled by map serializer
|
||||
}
|
||||
protected:
|
||||
virtual void setPropertyDer(ui8 what, ui32 val);//synchr
|
||||
|
||||
void getNameVis(std::string &hname) const;
|
||||
void giveDummyBonus(int heroID, ui8 duration = Bonus::ONE_DAY) const;
|
||||
};
|
||||
class CGHeroPlaceholder : public CGObjectInstance
|
||||
{
|
||||
@ -235,7 +236,7 @@ public:
|
||||
std::set<ui8> players; //players that visited this object
|
||||
|
||||
bool wasVisited(ui8 player) const;
|
||||
virtual void setPropertyDer( ui8 what, ui32 val );
|
||||
void setPropertyDer(ui8 what, ui32 val) override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -252,10 +253,10 @@ public:
|
||||
void randomizeArmy(int type);
|
||||
void updateMoraleBonusFromArmy();
|
||||
|
||||
void armyChanged() OVERRIDE;
|
||||
void armyChanged() override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int valOfGlobalBonuses(CSelector selector) const; //used only for castle interface ???
|
||||
// int valOfGlobalBonuses(CSelector selector) const; //used only for castle interface ???
|
||||
virtual CBonusSystemNode *whereShouldBeAttached(CGameState *gs);
|
||||
virtual CBonusSystemNode *whatShouldBeAttached();
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -417,15 +418,17 @@ public:
|
||||
virtual ~CGHeroInstance();
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
ui8 bearerType() const OVERRIDE;
|
||||
ui8 bearerType() const override;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual CBonusSystemNode *whereShouldBeAttached(CGameState *gs) OVERRIDE;
|
||||
virtual std::string nodeName() const OVERRIDE;
|
||||
CBonusSystemNode *whereShouldBeAttached(CGameState *gs) override;
|
||||
std::string nodeName() const override;
|
||||
void deserializationFix();
|
||||
void setPropertyDer(ui8 what, ui32 val);//synchr
|
||||
void initObj();
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
|
||||
void initObj() override;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
protected:
|
||||
void setPropertyDer(ui8 what, ui32 val) override;//synchr
|
||||
};
|
||||
|
||||
class DLL_LINKAGE CSpecObjInfo
|
||||
@ -466,10 +469,12 @@ public:
|
||||
h & static_cast<CArmedInstance&>(*this) & creatures;
|
||||
}
|
||||
|
||||
void initObj();
|
||||
void setProperty(ui8 what, ui32 val);
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void newTurn() const;
|
||||
void initObj() override;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void newTurn() const override;
|
||||
protected:
|
||||
void setPropertyDer(ui8 what, ui32 val) override;
|
||||
private:
|
||||
void heroAcceptsCreatures(const CGHeroInstance *h, ui32 answer) const;
|
||||
void fightOver(const CGHeroInstance *h, BattleResult *result) const;
|
||||
void wantsFight(const CGHeroInstance *h, ui32 answer) const;
|
||||
@ -481,22 +486,26 @@ class DLL_LINKAGE CGVisitableOPH : public CGObjectInstance //objects visitable o
|
||||
public:
|
||||
std::set<si32> visitors; //ids of heroes who have visited this obj
|
||||
si8 ttype; //tree type - used only by trees of knowledge: 0 - give level for free; 1 - take 2000 gold; 2 - take 10 gems
|
||||
const std::string & getHoverText() const;
|
||||
|
||||
void setPropertyDer(ui8 what, ui32 val);//synchr
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void onNAHeroVisit(int heroID, bool alreadyVisited) const;
|
||||
void initObj();
|
||||
bool wasVisited (const CGHeroInstance * h) const;
|
||||
void treeSelected(int heroID, int resType, int resVal, TExpType expVal, ui32 result) const; //handle player's anwer to the Tree of Knowledge dialog
|
||||
void schoolSelected(int heroID, ui32 which) const;
|
||||
void arenaSelected(int heroID, int primSkill) const;
|
||||
const std::string & getHoverText() const override;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void initObj() override;
|
||||
bool wasVisited (const CGHeroInstance * h) const override;
|
||||
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CGObjectInstance&>(*this);
|
||||
h & visitors & ttype;
|
||||
}
|
||||
protected:
|
||||
void setPropertyDer(ui8 what, ui32 val) override;//synchr
|
||||
private:
|
||||
void onNAHeroVisit(int heroID, bool alreadyVisited) const;
|
||||
///dialog callbacks
|
||||
void treeSelected(int heroID, int resType, int resVal, TExpType expVal, ui32 result) const;
|
||||
void schoolSelected(int heroID, ui32 which) const;
|
||||
void arenaSelected(int heroID, int primSkill) const;
|
||||
};
|
||||
class DLL_LINKAGE CGTownBuilding : public IObjectInterface
|
||||
{
|
||||
@ -515,8 +524,8 @@ class DLL_LINKAGE COPWBonus : public CGTownBuilding
|
||||
{///used for OPW bonusing structures
|
||||
public:
|
||||
std::set<si32> visitors;
|
||||
void setProperty(ui8 what, ui32 val);
|
||||
void onHeroVisit (const CGHeroInstance * h) const;
|
||||
void setProperty(ui8 what, ui32 val) override;
|
||||
void onHeroVisit (const CGHeroInstance * h) const override;
|
||||
|
||||
COPWBonus (int index, CGTownInstance *TOWN);
|
||||
COPWBonus (){ID = 0; town = NULL;};
|
||||
@ -533,8 +542,8 @@ class DLL_LINKAGE CTownBonus : public CGTownBuilding
|
||||
///feel free to merge inheritance tree
|
||||
public:
|
||||
std::set<si32> visitors;
|
||||
void setProperty(ui8 what, ui32 val);
|
||||
void onHeroVisit (const CGHeroInstance * h) const;
|
||||
void setProperty(ui8 what, ui32 val) override;
|
||||
void onHeroVisit (const CGHeroInstance * h) const override;
|
||||
|
||||
CTownBonus (int index, CGTownInstance *TOWN);
|
||||
CTownBonus (){ID = 0; town = NULL;};
|
||||
@ -604,8 +613,8 @@ public:
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual CBonusSystemNode *whatShouldBeAttached() OVERRIDE;
|
||||
std::string nodeName() const OVERRIDE;
|
||||
CBonusSystemNode *whatShouldBeAttached() override;
|
||||
std::string nodeName() const override;
|
||||
void deserializationFix();
|
||||
void recreateBuildingsBonuses();
|
||||
bool addBonusIfBuilt(int building, int type, int val, TPropagatorPtr prop, int subtype = -1); //returns true if building is built and bonus has been added
|
||||
@ -622,11 +631,10 @@ public:
|
||||
int getSightRadious() const; //returns sight distance
|
||||
int getBoatType() const; //0 - evil (if a ship can be evil...?), 1 - good, 2 - neutral
|
||||
void getOutOffsets(std::vector<int3> &offsets) const; //offsets to obj pos when we boat can be placed
|
||||
int getMarketEfficiency() const; //=market count
|
||||
int getMarketEfficiency() const override; //=market count
|
||||
bool allowsTrade(EMarketMode::EMarketMode mode) const;
|
||||
std::vector<int> availableItemsIds(EMarketMode::EMarketMode mode) const;
|
||||
void setPropertyDer(ui8 what, ui32 val);
|
||||
void newTurn() const;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -651,13 +659,16 @@ public:
|
||||
CGTownInstance();
|
||||
virtual ~CGTownInstance();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///IObjectInterface overrides
|
||||
void newTurn() const override;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void onHeroLeave(const CGHeroInstance * h) const override;
|
||||
void initObj() override;
|
||||
protected:
|
||||
void setPropertyDer(ui8 what, ui32 val) override;
|
||||
private:
|
||||
///dialog callbacks
|
||||
void fightOver(const CGHeroInstance *h, BattleResult *result) const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void onHeroLeave(const CGHeroInstance * h) const;
|
||||
void initObj();
|
||||
};
|
||||
class DLL_LINKAGE CGPandoraBox : public CArmedInstance
|
||||
{
|
||||
@ -677,13 +688,8 @@ public:
|
||||
std::vector<si32> spells; //gained spells
|
||||
CCreatureSet creatures; //gained creatures
|
||||
|
||||
void initObj();
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void open (const CGHeroInstance * h, ui32 accept) const;
|
||||
void endBattle(const CGHeroInstance *h, BattleResult *result) const;
|
||||
void giveContents(const CGHeroInstance *h, bool afterBattle) const;
|
||||
void getText( InfoWindow &iw, bool &afterBattle, int val, int negative, int positive, const CGHeroInstance * h ) const;
|
||||
void getText( InfoWindow &iw, bool &afterBattle, int text, const CGHeroInstance * h ) const;
|
||||
void initObj() override;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -691,6 +697,13 @@ public:
|
||||
h & message & gainedExp & manaDiff & moraleDiff & luckDiff & resources & primskills
|
||||
& abilities & abilityLevels & artifacts & spells & creatures;
|
||||
}
|
||||
protected:
|
||||
void endBattle(const CGHeroInstance *h, BattleResult *result) const;
|
||||
void giveContents(const CGHeroInstance *h, bool afterBattle) const;
|
||||
private:
|
||||
void open (const CGHeroInstance * h, ui32 accept) const;
|
||||
void getText( InfoWindow &iw, bool &afterBattle, int val, int negative, int positive, const CGHeroInstance * h ) const;
|
||||
void getText( InfoWindow &iw, bool &afterBattle, int text, const CGHeroInstance * h ) const;
|
||||
};
|
||||
|
||||
class DLL_LINKAGE CGEvent : public CGPandoraBox //event objects
|
||||
@ -707,9 +720,9 @@ public:
|
||||
h & removeAfterVisit & availableFor & computerActivate & humanActivate;
|
||||
}
|
||||
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
private:
|
||||
void activated(const CGHeroInstance * h) const;
|
||||
|
||||
};
|
||||
|
||||
class DLL_LINKAGE CGCreature : public CArmedInstance //creatures on map
|
||||
@ -724,18 +737,12 @@ public:
|
||||
ui8 notGrowingTeam; //if true, number of units won't grow
|
||||
ui64 temppower; //used to handle fractional stack growth for tiny stacks
|
||||
|
||||
void fight(const CGHeroInstance *h) const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
const std::string & getHoverText() const;
|
||||
|
||||
void flee( const CGHeroInstance * h ) const;
|
||||
void endBattle(BattleResult *result) const;
|
||||
void fleeDecision(const CGHeroInstance *h, ui32 pursue) const;
|
||||
void joinDecision(const CGHeroInstance *h, int cost, ui32 accept) const;
|
||||
void initObj();
|
||||
void newTurn() const;
|
||||
void setPropertyDer(ui8 what, ui32 val);
|
||||
int takenAction(const CGHeroInstance *h, bool allowJoin=true) const; //action on confrontation: -2 - fight, -1 - flee, >=0 - will join for given value of gold (may be 0)
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
const std::string & getHoverText() const override;
|
||||
void initObj() override;
|
||||
void newTurn() const override;
|
||||
|
||||
|
||||
struct DLL_LINKAGE RestoredCreature // info about merging stacks after battle back into one
|
||||
{
|
||||
@ -751,6 +758,18 @@ public:
|
||||
h & static_cast<CArmedInstance&>(*this);
|
||||
h & identifier & character & message & resources & gainedArtifact & neverFlees & notGrowingTeam & temppower & restore;
|
||||
}
|
||||
protected:
|
||||
void setPropertyDer(ui8 what, ui32 val) override;
|
||||
private:
|
||||
|
||||
void fight(const CGHeroInstance *h) const;
|
||||
void flee( const CGHeroInstance * h ) const;
|
||||
void endBattle(BattleResult *result) const;
|
||||
void fleeDecision(const CGHeroInstance *h, ui32 pursue) const;
|
||||
void joinDecision(const CGHeroInstance *h, int cost, ui32 accept) const;
|
||||
|
||||
int takenAction(const CGHeroInstance *h, bool allowJoin=true) const; //action on confrontation: -2 - fight, -1 - flee, >=0 - will join for given value of gold (may be 0)
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -759,8 +778,8 @@ class DLL_LINKAGE CGSignBottle : public CGObjectInstance //signs and ocean bottl
|
||||
public:
|
||||
std::string message;
|
||||
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void initObj();
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void initObj() override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -793,11 +812,10 @@ public:
|
||||
std::string seerName;
|
||||
|
||||
CGSeerHut() : IQuestObject(){};
|
||||
void initObj();
|
||||
const std::string & getHoverText() const;
|
||||
void setPropertyDer (ui8 what, ui32 val);
|
||||
void newTurn() const;
|
||||
void onHeroVisit (const CGHeroInstance * h) const;
|
||||
void initObj() override;
|
||||
const std::string & getHoverText() const override;
|
||||
void newTurn() const override;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
|
||||
int checkDirection() const; //calculates the region of map where monster is placed
|
||||
void setObjToKill(); //remember creatures / heroes to kill after they are initialized
|
||||
@ -813,13 +831,15 @@ public:
|
||||
h & static_cast<CArmedInstance&>(*this) & static_cast<IQuestObject&>(*this);
|
||||
h & rewardType & rID & rVal & seerName;
|
||||
}
|
||||
protected:
|
||||
void setPropertyDer(ui8 what, ui32 val) override;
|
||||
};
|
||||
|
||||
class DLL_LINKAGE CGQuestGuard : public CGSeerHut
|
||||
{
|
||||
public:
|
||||
CGQuestGuard() : CGSeerHut(){};
|
||||
void initObj();
|
||||
void initObj() override;
|
||||
void completeQuest (const CGHeroInstance * h) const;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
@ -834,9 +854,9 @@ public:
|
||||
std::vector<si32> allowedAbilities;
|
||||
ui32 ability;
|
||||
|
||||
const std::string & getHoverText() const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void initObj();
|
||||
const std::string & getHoverText() const override;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void initObj() override;
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CPlayersVisited&>(*this);
|
||||
@ -851,9 +871,9 @@ public:
|
||||
ui8 bonusType; //255 - random, 0 - primary skill, 1 - secondary skill, 2 - spell
|
||||
ui16 bonusID; //ID of skill/spell
|
||||
|
||||
void giveAnyBonus(const CGHeroInstance * h) const; //FIXME: unused?
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void initObj();
|
||||
// void giveAnyBonus(const CGHeroInstance * h) const; //TODO: remove
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void initObj() override;
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CGObjectInstance&>(*this);
|
||||
@ -867,7 +887,7 @@ public:
|
||||
ui8 removableUnits;
|
||||
|
||||
ui8 getPassableness() const;
|
||||
void onHeroVisit (const CGHeroInstance *h) const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void fightOver (const CGHeroInstance *h, BattleResult *result) const;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
@ -883,11 +903,11 @@ public:
|
||||
CArtifactInstance *storedArtifact;
|
||||
std::string message;
|
||||
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void fightForArt(ui32 agreed, const CGHeroInstance *h) const;
|
||||
void endBattle(BattleResult *result, const CGHeroInstance *h) const;
|
||||
void pick( const CGHeroInstance * h ) const;
|
||||
void initObj();
|
||||
void initObj() override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -902,9 +922,10 @@ public:
|
||||
ui32 amount; //0 if random
|
||||
std::string message;
|
||||
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void initObj() override;
|
||||
|
||||
void collectRes(int player) const;
|
||||
void initObj();
|
||||
void fightForRes(ui32 agreed, const CGHeroInstance *h) const;
|
||||
void endBattle(BattleResult *result, const CGHeroInstance *h) const;
|
||||
|
||||
@ -920,8 +941,8 @@ class DLL_LINKAGE CGPickable : public CGObjectInstance //campfire, treasure ches
|
||||
public:
|
||||
ui32 type, val1, val2;
|
||||
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void initObj();
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void initObj() override;
|
||||
void chosen(int which, int heroID) const;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
@ -935,9 +956,9 @@ class DLL_LINKAGE CGShrine : public CPlayersVisited
|
||||
{
|
||||
public:
|
||||
ui8 spell; //number of spell or 255 if random
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void initObj();
|
||||
const std::string & getHoverText() const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void initObj() override;
|
||||
const std::string & getHoverText() const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -956,11 +977,11 @@ public:
|
||||
void endBattle(BattleResult *result, ui8 attackingPlayer) const;
|
||||
void fight(ui32 agreed, const CGHeroInstance *h) const;
|
||||
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
|
||||
void flagMine(ui8 player) const;
|
||||
void newTurn() const;
|
||||
void initObj();
|
||||
void newTurn() const override;
|
||||
void initObj() override;
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CArmedInstance&>(*this);
|
||||
@ -974,16 +995,17 @@ class DLL_LINKAGE CGVisitableOPW : public CGObjectInstance //objects visitable O
|
||||
public:
|
||||
ui8 visited; //true if object has been visited this week
|
||||
|
||||
void setPropertyDer(ui8 what, ui32 val);//synchr
|
||||
bool wasVisited(ui8 player) const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void newTurn() const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void newTurn() const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CGObjectInstance&>(*this);
|
||||
h & visited;
|
||||
}
|
||||
protected:
|
||||
void setPropertyDer(ui8 what, ui32 val) override;
|
||||
};
|
||||
|
||||
class DLL_LINKAGE CGTeleport : public CGObjectInstance //teleports and subterranean gates
|
||||
@ -991,8 +1013,8 @@ class DLL_LINKAGE CGTeleport : public CGObjectInstance //teleports and subterran
|
||||
public:
|
||||
static std::map<int,std::map<int, std::vector<int> > > objs; //teleports: map[ID][subID] => vector of ids
|
||||
static std::vector<std::pair<int, int> > gates; //subterranean gates: pairs of ids
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void initObj();
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void initObj() override;
|
||||
static void postInit();
|
||||
static int getMatchingGate(int id); //receives id of one subterranean gate and returns id of the paired one, -1 if none
|
||||
|
||||
@ -1006,9 +1028,9 @@ class DLL_LINKAGE CGBonusingObject : public CGObjectInstance //objects giving bo
|
||||
{
|
||||
public:
|
||||
bool wasVisited (const CGHeroInstance * h) const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
const std::string & getHoverText() const;
|
||||
void initObj();
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
const std::string & getHoverText() const override;
|
||||
void initObj() override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -1019,8 +1041,8 @@ public:
|
||||
class DLL_LINKAGE CGMagicSpring : public CGVisitableOPW
|
||||
{///unfortunatelly, this one is quite different than others
|
||||
public:
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
const std::string & getHoverText() const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
const std::string & getHoverText() const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -1032,8 +1054,8 @@ public:
|
||||
class DLL_LINKAGE CGMagicWell : public CGObjectInstance //objects giving bonuses to luck/morale/movement
|
||||
{
|
||||
public:
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
const std::string & getHoverText() const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
const std::string & getHoverText() const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -1044,9 +1066,9 @@ public:
|
||||
class DLL_LINKAGE CGSirens : public CGObjectInstance
|
||||
{
|
||||
public:
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
const std::string & getHoverText() const;
|
||||
void initObj();
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
const std::string & getHoverText() const override;
|
||||
void initObj() override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -1057,7 +1079,7 @@ public:
|
||||
class DLL_LINKAGE CGObservatory : public CGObjectInstance //Redwood observatory
|
||||
{
|
||||
public:
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -1072,21 +1094,24 @@ public:
|
||||
static std::map <ui8, std::set <ui8> > playerKeyMap; //[players][keysowned]
|
||||
//SubID 0 - lightblue, 1 - green, 2 - red, 3 - darkblue, 4 - brown, 5 - purple, 6 - white, 7 - black
|
||||
|
||||
void setPropertyDer (ui8 what, ui32 val);
|
||||
const std::string getName() const; //depending on color
|
||||
bool wasMyColorVisited (int player) const;
|
||||
|
||||
const std::string & getHoverText() const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CGObjectInstance&>(*this);
|
||||
}
|
||||
protected:
|
||||
void setPropertyDer(ui8 what, ui32 val) override;
|
||||
};
|
||||
|
||||
class DLL_LINKAGE CGKeymasterTent : public CGKeys
|
||||
{
|
||||
public:
|
||||
bool wasVisited (ui8 player) const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
const std::string & getHoverText() const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -1098,12 +1123,13 @@ class DLL_LINKAGE CGBorderGuard : public CGKeys, public IQuestObject
|
||||
{
|
||||
public:
|
||||
CGBorderGuard() : IQuestObject(){};
|
||||
void initObj();
|
||||
const std::string & getHoverText() const;
|
||||
void initObj() override;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
|
||||
void getVisitText (MetaString &text, std::vector<Component> &components, bool isCustom, bool FirstVisit, const CGHeroInstance * h = NULL) const;
|
||||
void getRolloverText (MetaString &text, bool onHover) const;
|
||||
bool checkQuest (const CGHeroInstance * h) const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
|
||||
void openGate(const CGHeroInstance *h, ui32 accept) const;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
@ -1118,8 +1144,9 @@ class DLL_LINKAGE CGBorderGate : public CGBorderGuard
|
||||
{
|
||||
public:
|
||||
CGBorderGate() : CGBorderGuard(){};
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
ui8 getPassableness() const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
|
||||
ui8 getPassableness() const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -1133,7 +1160,7 @@ public:
|
||||
ui8 direction;
|
||||
const CGHeroInstance *hero; //hero on board
|
||||
|
||||
void initObj();
|
||||
void initObj() override;
|
||||
|
||||
CGBoat()
|
||||
{
|
||||
@ -1154,9 +1181,10 @@ public:
|
||||
ui32 bonusType, //id of res or artifact
|
||||
bonusVal; //resource amount (or not used)
|
||||
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
const std::string & getHoverText() const;
|
||||
void initObj();
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
const std::string & getHoverText() const override;
|
||||
void initObj() override;
|
||||
|
||||
void searchTomb(const CGHeroInstance *h, ui32 accept) const;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
@ -1175,14 +1203,14 @@ class DLL_LINKAGE CBank : public CArmedInstance
|
||||
std::vector<ui32> artifacts; //fixed and deterministic
|
||||
ui32 daycounter;
|
||||
|
||||
void initObj();
|
||||
const std::string & getHoverText() const;
|
||||
void setPropertyDer (ui8 what, ui32 val);
|
||||
void initObj() override;
|
||||
const std::string & getHoverText() const override;
|
||||
void initialize() const;
|
||||
void reset(ui16 var1);
|
||||
void newTurn() const;
|
||||
bool wasVisited (ui8 player) const;
|
||||
virtual void onHeroVisit (const CGHeroInstance * h) const;
|
||||
void newTurn() const override;
|
||||
bool wasVisited (ui8 player) const override;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
|
||||
virtual void fightGuards (const CGHeroInstance *h, ui32 accept) const;
|
||||
virtual void endBattle (const CGHeroInstance *h, const BattleResult *result) const;
|
||||
|
||||
@ -1191,17 +1219,20 @@ class DLL_LINKAGE CBank : public CArmedInstance
|
||||
h & static_cast<CArmedInstance&>(*this);
|
||||
h & index & multiplier & artifacts & daycounter & bc;
|
||||
}
|
||||
protected:
|
||||
void setPropertyDer(ui8 what, ui32 val) override;
|
||||
};
|
||||
class DLL_LINKAGE CGPyramid : public CBank
|
||||
{
|
||||
public:
|
||||
ui16 spell;
|
||||
|
||||
void initObj();
|
||||
const std::string & getHoverText() const;
|
||||
void newTurn() const {}; //empty, no reset
|
||||
void onHeroVisit (const CGHeroInstance * h) const;
|
||||
void endBattle (const CGHeroInstance *h, const BattleResult *result) const;
|
||||
void initObj() override;
|
||||
const std::string & getHoverText() const override;
|
||||
void newTurn() const override {}; //empty, no reset
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
|
||||
void endBattle (const CGHeroInstance *h, const BattleResult *result) const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -1215,7 +1246,7 @@ class CGShipyard : public CGObjectInstance, public IShipyard
|
||||
public:
|
||||
void getOutOffsets(std::vector<int3> &offsets) const; //offsets to obj pos when we boat can be placed
|
||||
CGShipyard();
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
};
|
||||
|
||||
class DLL_LINKAGE CGMagi : public CGObjectInstance
|
||||
@ -1223,8 +1254,8 @@ class DLL_LINKAGE CGMagi : public CGObjectInstance
|
||||
public:
|
||||
static std::map <si32, std::vector<si32> > eyelist; //[subID][id], supports multiple sets as in H5
|
||||
|
||||
void initObj();
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void initObj() override;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -1238,7 +1269,7 @@ class DLL_LINKAGE CCartographer : public CPlayersVisited
|
||||
{
|
||||
///behaviour varies depending on surface and floor
|
||||
public:
|
||||
void onHeroVisit( const CGHeroInstance * h ) const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void buyMap (const CGHeroInstance *h, ui32 accept) const;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
@ -1249,7 +1280,7 @@ public:
|
||||
|
||||
class DLL_LINKAGE CGDenOfthieves : public CGObjectInstance
|
||||
{
|
||||
void onHeroVisit (const CGHeroInstance * h) const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
};
|
||||
|
||||
class DLL_LINKAGE CGObelisk : public CPlayersVisited
|
||||
@ -1258,23 +1289,24 @@ public:
|
||||
static ui8 obeliskCount; //how many obelisks are on map
|
||||
static std::map<ui8, ui8> visited; //map: team_id => how many obelisks has been visited
|
||||
|
||||
void setPropertyDer (ui8 what, ui32 val);
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void initObj();
|
||||
const std::string & getHoverText() const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void initObj() override;
|
||||
const std::string & getHoverText() const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & static_cast<CPlayersVisited&>(*this);
|
||||
}
|
||||
protected:
|
||||
void setPropertyDer(ui8 what, ui32 val) override;
|
||||
};
|
||||
|
||||
class DLL_LINKAGE CGLighthouse : public CGObjectInstance
|
||||
{
|
||||
public:
|
||||
void onHeroVisit(const CGHeroInstance * h) const;
|
||||
void initObj();
|
||||
const std::string & getHoverText() const;
|
||||
void onHeroVisit(const CGHeroInstance * h) const override;
|
||||
void initObj() override;
|
||||
const std::string & getHoverText() const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -1287,12 +1319,14 @@ class DLL_LINKAGE CGMarket : public CGObjectInstance, public IMarket
|
||||
{
|
||||
public:
|
||||
CGMarket();
|
||||
void onHeroVisit(const CGHeroInstance * h) const; //open trading window
|
||||
///IObjectIntercae
|
||||
void onHeroVisit(const CGHeroInstance * h) const override; //open trading window
|
||||
|
||||
int getMarketEfficiency() const;
|
||||
bool allowsTrade(EMarketMode::EMarketMode mode) const;
|
||||
int availableUnits(EMarketMode::EMarketMode mode, int marketItemSerial) const; //-1 if unlimited
|
||||
std::vector<int> availableItemsIds(EMarketMode::EMarketMode mode) const;
|
||||
///IMarket
|
||||
int getMarketEfficiency() const override;
|
||||
bool allowsTrade(EMarketMode::EMarketMode mode) const override;
|
||||
int availableUnits(EMarketMode::EMarketMode mode, int marketItemSerial) const override; //-1 if unlimited
|
||||
std::vector<int> availableItemsIds(EMarketMode::EMarketMode mode) const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -1305,8 +1339,8 @@ class DLL_LINKAGE CGBlackMarket : public CGMarket
|
||||
public:
|
||||
std::vector<const CArtifact *> artifacts; //available artifacts
|
||||
|
||||
void newTurn() const; //reset artifacts for black market every month
|
||||
std::vector<int> availableItemsIds(EMarketMode::EMarketMode mode) const;
|
||||
void newTurn() const override; //reset artifacts for black market every month
|
||||
std::vector<int> availableItemsIds(EMarketMode::EMarketMode mode) const override;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
@ -1321,8 +1355,8 @@ public:
|
||||
std::vector<int> skills; //available skills
|
||||
|
||||
std::vector<int> availableItemsIds(EMarketMode::EMarketMode mode) const;
|
||||
void initObj();//set skills for trade
|
||||
void onHeroVisit(const CGHeroInstance * h) const; //open window
|
||||
void initObj() override;//set skills for trade
|
||||
void onHeroVisit(const CGHeroInstance * h) const override; //open window
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
|
@ -993,7 +993,7 @@ void CMapLoaderH3M::readDefInfo()
|
||||
//add holes - they always can appear
|
||||
for(int i = 0; i < 8 ; ++i)
|
||||
{
|
||||
map->customDefs.push_back(VLC->dobjinfo->gobjs[124][i]);
|
||||
map->customDefs.push_back(VLC->dobjinfo->gobjs[Obj::HOLE][i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1147,7 +1147,7 @@ void CMapLoaderH3M::readObjects()
|
||||
nobj = new CGVisitableOPW();
|
||||
break;
|
||||
}
|
||||
case Obj::MONOLITH1:
|
||||
case Obj::MONOLITH1:
|
||||
case Obj::MONOLITH2:
|
||||
case Obj::MONOLITH3:
|
||||
case Obj::SUBTERRANEAN_GATE:
|
||||
@ -1166,13 +1166,13 @@ void CMapLoaderH3M::readObjects()
|
||||
break;
|
||||
}
|
||||
case Obj::MONSTER: //Monster
|
||||
case Obj::RANDOM_MONSTER:
|
||||
case Obj::RANDOM_MONSTER_L1:
|
||||
case Obj::RANDOM_MONSTER:
|
||||
case Obj::RANDOM_MONSTER_L1:
|
||||
case Obj::RANDOM_MONSTER_L2:
|
||||
case Obj::RANDOM_MONSTER_L3:
|
||||
case Obj::RANDOM_MONSTER_L3:
|
||||
case Obj::RANDOM_MONSTER_L4:
|
||||
case Obj::RANDOM_MONSTER_L5:
|
||||
case Obj::RANDOM_MONSTER_L6:
|
||||
case Obj::RANDOM_MONSTER_L5:
|
||||
case Obj::RANDOM_MONSTER_L6:
|
||||
case Obj::RANDOM_MONSTER_L7:
|
||||
{
|
||||
CGCreature * cre = new CGCreature();
|
||||
@ -1248,7 +1248,7 @@ void CMapLoaderH3M::readObjects()
|
||||
pos += 2;
|
||||
break;
|
||||
}
|
||||
case Obj::OCEAN_BOTTLE:
|
||||
case Obj::OCEAN_BOTTLE:
|
||||
case Obj::SIGN:
|
||||
{
|
||||
CGSignBottle * sb = new CGSignBottle();
|
||||
@ -1263,7 +1263,7 @@ void CMapLoaderH3M::readObjects()
|
||||
map->addQuest(nobj);
|
||||
break;
|
||||
}
|
||||
case Obj::WITCH_HUT:
|
||||
case Obj::WITCH_HUT:
|
||||
{
|
||||
CGWitchHut * wh = new CGWitchHut();
|
||||
nobj = wh;
|
||||
@ -1306,7 +1306,7 @@ void CMapLoaderH3M::readObjects()
|
||||
pos += 6;
|
||||
break;
|
||||
}
|
||||
case Obj::GARRISON:
|
||||
case Obj::GARRISON:
|
||||
case Obj::GARRISON2:
|
||||
{
|
||||
CGGarrison * gar = new CGGarrison();
|
||||
@ -1327,9 +1327,9 @@ void CMapLoaderH3M::readObjects()
|
||||
break;
|
||||
}
|
||||
case Obj::ARTIFACT:
|
||||
case Obj::RANDOM_ART:
|
||||
case Obj::RANDOM_TREASURE_ART:
|
||||
case Obj::RANDOM_MINOR_ART:
|
||||
case Obj::RANDOM_ART:
|
||||
case Obj::RANDOM_TREASURE_ART:
|
||||
case Obj::RANDOM_MINOR_ART:
|
||||
case Obj::RANDOM_MAJOR_ART:
|
||||
case Obj::RANDOM_RELIC_ART:
|
||||
case Obj::SPELL_SCROLL:
|
||||
@ -1366,7 +1366,7 @@ void CMapLoaderH3M::readObjects()
|
||||
art->storedArtifact = createArtifact(artID, spellID);
|
||||
break;
|
||||
}
|
||||
case Obj::RANDOM_RESOURCE:
|
||||
case Obj::RANDOM_RESOURCE:
|
||||
case Obj::RESOURCE:
|
||||
{
|
||||
CGResource * res = new CGResource();
|
||||
@ -1394,7 +1394,7 @@ void CMapLoaderH3M::readObjects()
|
||||
|
||||
break;
|
||||
}
|
||||
case Obj::RANDOM_TOWN:
|
||||
case Obj::RANDOM_TOWN:
|
||||
case Obj::TOWN:
|
||||
{
|
||||
nobj = readTown(defInfo->subid);
|
||||
@ -1408,9 +1408,9 @@ void CMapLoaderH3M::readObjects()
|
||||
pos += 3;
|
||||
break;
|
||||
}
|
||||
case Obj::CREATURE_GENERATOR1:
|
||||
case Obj::CREATURE_GENERATOR2:
|
||||
case Obj::CREATURE_GENERATOR3:
|
||||
case Obj::CREATURE_GENERATOR1:
|
||||
case Obj::CREATURE_GENERATOR2:
|
||||
case Obj::CREATURE_GENERATOR3:
|
||||
case Obj::CREATURE_GENERATOR4:
|
||||
{
|
||||
nobj = new CGDwelling();
|
||||
@ -1424,8 +1424,8 @@ void CMapLoaderH3M::readObjects()
|
||||
nobj = new CGDwelling();
|
||||
break;
|
||||
}
|
||||
case Obj::SHRINE_OF_MAGIC_INCANTATION:
|
||||
case Obj::SHRINE_OF_MAGIC_GESTURE:
|
||||
case Obj::SHRINE_OF_MAGIC_INCANTATION:
|
||||
case Obj::SHRINE_OF_MAGIC_GESTURE:
|
||||
case Obj::SHRINE_OF_MAGIC_THOUGHT:
|
||||
{
|
||||
CGShrine * shr = new CGShrine();
|
||||
@ -1519,7 +1519,7 @@ void CMapLoaderH3M::readObjects()
|
||||
continue;
|
||||
}
|
||||
case Obj::RANDOM_DWELLING: //same as castle + level range
|
||||
case Obj::RANDOM_DWELLING_LVL: //same as castle, fixed level
|
||||
case Obj::RANDOM_DWELLING_LVL: //same as castle, fixed level
|
||||
case Obj::RANDOM_DWELLING_FACTION: //level range, fixed faction
|
||||
{
|
||||
nobj = new CGDwelling();
|
||||
@ -1601,7 +1601,7 @@ void CMapLoaderH3M::readObjects()
|
||||
nobj = new CGObservatory();
|
||||
break;
|
||||
}
|
||||
case Obj::CORPSE:
|
||||
case Obj::CORPSE:
|
||||
case Obj::LEAN_TO:
|
||||
case Obj::WAGON:
|
||||
case Obj::WARRIORS_TOMB:
|
||||
@ -1665,16 +1665,16 @@ void CMapLoaderH3M::readObjects()
|
||||
map->addQuest (nobj);
|
||||
break;
|
||||
}
|
||||
case Obj::EYE_OF_MAGI:
|
||||
case Obj::EYE_OF_MAGI:
|
||||
case Obj::HUT_OF_MAGI:
|
||||
{
|
||||
nobj = new CGMagi();
|
||||
break;
|
||||
}
|
||||
case Obj::CREATURE_BANK:
|
||||
case Obj::DERELICT_SHIP:
|
||||
case Obj::DRAGON_UTOPIA:
|
||||
case Obj::CRYPT:
|
||||
case Obj::CREATURE_BANK:
|
||||
case Obj::DERELICT_SHIP:
|
||||
case Obj::DRAGON_UTOPIA:
|
||||
case Obj::CRYPT:
|
||||
case Obj::SHIPWRECK:
|
||||
{
|
||||
nobj = new CBank();
|
||||
@ -1691,7 +1691,7 @@ void CMapLoaderH3M::readObjects()
|
||||
//WoG object
|
||||
//TODO: possible special handling
|
||||
nobj = new CGObjectInstance();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Obj::CARTOGRAPHER:
|
||||
@ -1699,7 +1699,7 @@ void CMapLoaderH3M::readObjects()
|
||||
nobj = new CCartographer();
|
||||
break;
|
||||
}
|
||||
case Obj::MAGIC_SPRING:
|
||||
case Obj::MAGIC_SPRING:
|
||||
{
|
||||
nobj = new CGMagicSpring();
|
||||
break;
|
||||
@ -1721,9 +1721,9 @@ void CMapLoaderH3M::readObjects()
|
||||
pos += 4;
|
||||
break;
|
||||
}
|
||||
case Obj::ALTAR_OF_SACRIFICE:
|
||||
case Obj::TRADING_POST:
|
||||
case Obj::FREELANCERS_GUILD:
|
||||
case Obj::ALTAR_OF_SACRIFICE:
|
||||
case Obj::TRADING_POST:
|
||||
case Obj::FREELANCERS_GUILD:
|
||||
case Obj::TRADING_POST_SNOW:
|
||||
{
|
||||
nobj = new CGMarket();
|
||||
|
Loading…
Reference in New Issue
Block a user