mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-02 00:10:22 +02:00
Spelling fixes: privilaged -> privileged, retreive -> retrieve
This commit is contained in:
parent
35b01eb379
commit
324717acbe
@ -805,7 +805,7 @@ TSubgoal CollectRes::whatToDoToAchieve()
|
|||||||
std::vector<const IMarket*> markets;
|
std::vector<const IMarket*> markets;
|
||||||
|
|
||||||
std::vector<const CGObjectInstance*> visObjs;
|
std::vector<const CGObjectInstance*> visObjs;
|
||||||
ai->retreiveVisitableObjs(visObjs, true);
|
ai->retrieveVisitableObjs(visObjs, true);
|
||||||
for(const CGObjectInstance *obj : visObjs)
|
for(const CGObjectInstance *obj : visObjs)
|
||||||
{
|
{
|
||||||
if(const IMarket *m = IMarket::castFrom(obj, false))
|
if(const IMarket *m = IMarket::castFrom(obj, false))
|
||||||
|
@ -590,7 +590,7 @@ void VCAI::init(std::shared_ptr<CCallback> CB)
|
|||||||
if(!fh)
|
if(!fh)
|
||||||
fh = new FuzzyHelper();
|
fh = new FuzzyHelper();
|
||||||
|
|
||||||
retreiveVisitableObjs();
|
retrieveVisitableObjs();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VCAI::yourTurn()
|
void VCAI::yourTurn()
|
||||||
@ -762,7 +762,7 @@ void VCAI::makeTurn()
|
|||||||
{
|
{
|
||||||
townVisitsThisWeek.clear();
|
townVisitsThisWeek.clear();
|
||||||
std::vector<const CGObjectInstance *> objs;
|
std::vector<const CGObjectInstance *> objs;
|
||||||
retreiveVisitableObjs(objs, true);
|
retrieveVisitableObjs(objs, true);
|
||||||
for(const CGObjectInstance *obj : objs)
|
for(const CGObjectInstance *obj : objs)
|
||||||
{
|
{
|
||||||
if (isWeeklyRevisitable(obj))
|
if (isWeeklyRevisitable(obj))
|
||||||
@ -1784,7 +1784,7 @@ void VCAI::validateVisitableObjs()
|
|||||||
vstd::erase_if(alreadyVisited, shouldBeErased);
|
vstd::erase_if(alreadyVisited, shouldBeErased);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VCAI::retreiveVisitableObjs(std::vector<const CGObjectInstance *> &out, bool includeOwned) const
|
void VCAI::retrieveVisitableObjs(std::vector<const CGObjectInstance *> &out, bool includeOwned) const
|
||||||
{
|
{
|
||||||
foreach_tile_pos([&](const int3 &pos)
|
foreach_tile_pos([&](const int3 &pos)
|
||||||
{
|
{
|
||||||
@ -1796,7 +1796,7 @@ void VCAI::retreiveVisitableObjs(std::vector<const CGObjectInstance *> &out, boo
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void VCAI::retreiveVisitableObjs()
|
void VCAI::retrieveVisitableObjs()
|
||||||
{
|
{
|
||||||
foreach_tile_pos([&](const int3 &pos)
|
foreach_tile_pos([&](const int3 &pos)
|
||||||
{
|
{
|
||||||
@ -3094,21 +3094,21 @@ void SectorMap::update()
|
|||||||
CCallback * cbp = cb.get(); //optimization
|
CCallback * cbp = cb.get(); //optimization
|
||||||
foreach_tile_pos([&](crint3 pos)
|
foreach_tile_pos([&](crint3 pos)
|
||||||
{
|
{
|
||||||
if(retreiveTile(pos) == NOT_CHECKED)
|
if(retrieveTile(pos) == NOT_CHECKED)
|
||||||
{
|
{
|
||||||
if(!markIfBlocked(retreiveTile(pos), pos))
|
if(!markIfBlocked(retrieveTile(pos), pos))
|
||||||
exploreNewSector(pos, curSector++, cbp);
|
exploreNewSector(pos, curSector++, cbp);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
valid = true;
|
valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SectorMap::TSectorID &SectorMap::retreiveTileN(SectorMap::TSectorArray &a, const int3 &pos)
|
SectorMap::TSectorID & SectorMap::retrieveTileN(SectorMap::TSectorArray & a, const int3 & pos)
|
||||||
{
|
{
|
||||||
return a[pos.x][pos.y][pos.z];
|
return a[pos.x][pos.y][pos.z];
|
||||||
}
|
}
|
||||||
|
|
||||||
const SectorMap::TSectorID &SectorMap::retreiveTileN(const SectorMap::TSectorArray &a, const int3 &pos)
|
const SectorMap::TSectorID & SectorMap::retrieveTileN(const SectorMap::TSectorArray & a, const int3 & pos)
|
||||||
{
|
{
|
||||||
return a[pos.x][pos.y][pos.z];
|
return a[pos.x][pos.y][pos.z];
|
||||||
}
|
}
|
||||||
@ -3144,7 +3144,7 @@ void SectorMap::exploreNewSector(crint3 pos, int num, CCallback * cbp)
|
|||||||
{
|
{
|
||||||
int3 curPos = toVisit.front();
|
int3 curPos = toVisit.front();
|
||||||
toVisit.pop();
|
toVisit.pop();
|
||||||
TSectorID &sec = retreiveTile(curPos);
|
TSectorID & sec = retrieveTile(curPos);
|
||||||
if(sec == NOT_CHECKED)
|
if(sec == NOT_CHECKED)
|
||||||
{
|
{
|
||||||
const TerrainTile *t = getTile(curPos);
|
const TerrainTile *t = getTile(curPos);
|
||||||
@ -3156,7 +3156,7 @@ void SectorMap::exploreNewSector(crint3 pos, int num, CCallback * cbp)
|
|||||||
s.tiles.push_back(curPos);
|
s.tiles.push_back(curPos);
|
||||||
foreach_neighbour(cbp, curPos, [&](CCallback * cbp, crint3 neighPos)
|
foreach_neighbour(cbp, curPos, [&](CCallback * cbp, crint3 neighPos)
|
||||||
{
|
{
|
||||||
if(retreiveTile(neighPos) == NOT_CHECKED)
|
if(retrieveTile(neighPos) == NOT_CHECKED)
|
||||||
{
|
{
|
||||||
toVisit.push(neighPos);
|
toVisit.push(neighPos);
|
||||||
//parent[neighPos] = curPos;
|
//parent[neighPos] = curPos;
|
||||||
@ -3339,8 +3339,8 @@ For ship construction etc, another function (goal?) is needed
|
|||||||
{
|
{
|
||||||
int3 ret(-1,-1,-1);
|
int3 ret(-1,-1,-1);
|
||||||
|
|
||||||
int sourceSector = retreiveTile(h->visitablePos()),
|
int sourceSector = retrieveTile(h->visitablePos()),
|
||||||
destinationSector = retreiveTile(dst);
|
destinationSector = retrieveTile(dst);
|
||||||
|
|
||||||
const Sector *src = &infoOnSectors[sourceSector],
|
const Sector *src = &infoOnSectors[sourceSector],
|
||||||
*dest = &infoOnSectors[destinationSector];
|
*dest = &infoOnSectors[destinationSector];
|
||||||
@ -3360,7 +3360,7 @@ For ship construction etc, another function (goal?) is needed
|
|||||||
|
|
||||||
for(int3 ep : s->embarkmentPoints)
|
for(int3 ep : s->embarkmentPoints)
|
||||||
{
|
{
|
||||||
Sector *neigh = &infoOnSectors[retreiveTile(ep)];
|
Sector * neigh = &infoOnSectors[retrieveTile(ep)];
|
||||||
//preds[s].push_back(neigh);
|
//preds[s].push_back(neigh);
|
||||||
if(!preds[neigh])
|
if(!preds[neigh])
|
||||||
{
|
{
|
||||||
@ -3397,7 +3397,7 @@ For ship construction etc, another function (goal?) is needed
|
|||||||
{
|
{
|
||||||
const TerrainTile *t = getTile(pos);
|
const TerrainTile *t = getTile(pos);
|
||||||
return t && t->visitableObjects.size() == 1 && t->topVisitableId() == Obj::BOAT
|
return t && t->visitableObjects.size() == 1 && t->topVisitableId() == Obj::BOAT
|
||||||
&& retreiveTile(pos) == sectorToReach->id;
|
&& retrieveTile(pos) == sectorToReach->id;
|
||||||
});
|
});
|
||||||
|
|
||||||
if(firstEP != src->embarkmentPoints.end())
|
if(firstEP != src->embarkmentPoints.end())
|
||||||
@ -3424,7 +3424,7 @@ For ship construction etc, another function (goal?) is needed
|
|||||||
|
|
||||||
shipyards.erase(boost::remove_if(shipyards, [=](const IShipyard *shipyard) -> bool
|
shipyards.erase(boost::remove_if(shipyards, [=](const IShipyard *shipyard) -> bool
|
||||||
{
|
{
|
||||||
return shipyard->shipyardStatus() != 0 || retreiveTile(shipyard->bestLocation()) != sectorToReach->id;
|
return shipyard->shipyardStatus() != 0 || retrieveTile(shipyard->bestLocation()) != sectorToReach->id;
|
||||||
}),shipyards.end());
|
}),shipyards.end());
|
||||||
|
|
||||||
if(!shipyards.size())
|
if(!shipyards.size())
|
||||||
@ -3531,20 +3531,20 @@ void SectorMap::makeParentBFS(crint3 source)
|
|||||||
{
|
{
|
||||||
parent.clear();
|
parent.clear();
|
||||||
|
|
||||||
int mySector = retreiveTile(source);
|
int mySector = retrieveTile(source);
|
||||||
std::queue<int3> toVisit;
|
std::queue<int3> toVisit;
|
||||||
toVisit.push(source);
|
toVisit.push(source);
|
||||||
while(!toVisit.empty())
|
while(!toVisit.empty())
|
||||||
{
|
{
|
||||||
int3 curPos = toVisit.front();
|
int3 curPos = toVisit.front();
|
||||||
toVisit.pop();
|
toVisit.pop();
|
||||||
TSectorID &sec = retreiveTile(curPos);
|
TSectorID & sec = retrieveTile(curPos);
|
||||||
assert(sec == mySector); //consider only tiles from the same sector
|
assert(sec == mySector); //consider only tiles from the same sector
|
||||||
UNUSED(sec);
|
UNUSED(sec);
|
||||||
|
|
||||||
foreach_neighbour(curPos, [&](crint3 neighPos)
|
foreach_neighbour(curPos, [&](crint3 neighPos)
|
||||||
{
|
{
|
||||||
if(retreiveTile(neighPos) == mySector && !vstd::contains(parent, neighPos))
|
if(retrieveTile(neighPos) == mySector && !vstd::contains(parent, neighPos))
|
||||||
{
|
{
|
||||||
if (cb->canMoveBetween(curPos, neighPos))
|
if (cb->canMoveBetween(curPos, neighPos))
|
||||||
{
|
{
|
||||||
@ -3556,9 +3556,9 @@ void SectorMap::makeParentBFS(crint3 source)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SectorMap::TSectorID & SectorMap::retreiveTile(crint3 pos)
|
SectorMap::TSectorID & SectorMap::retrieveTile(crint3 pos)
|
||||||
{
|
{
|
||||||
return retreiveTileN(sector, pos);
|
return retrieveTileN(sector, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
TerrainTile* SectorMap::getTile(crint3 pos) const
|
TerrainTile* SectorMap::getTile(crint3 pos) const
|
||||||
@ -3570,13 +3570,13 @@ TerrainTile* SectorMap::getTile(crint3 pos) const
|
|||||||
|
|
||||||
std::vector<const CGObjectInstance *> SectorMap::getNearbyObjs(HeroPtr h, bool sectorsAround)
|
std::vector<const CGObjectInstance *> SectorMap::getNearbyObjs(HeroPtr h, bool sectorsAround)
|
||||||
{
|
{
|
||||||
const Sector *heroSector = &infoOnSectors[retreiveTile(h->visitablePos())];
|
const Sector * heroSector = &infoOnSectors[retrieveTile(h->visitablePos())];
|
||||||
if(sectorsAround)
|
if(sectorsAround)
|
||||||
{
|
{
|
||||||
std::vector<const CGObjectInstance *> ret;
|
std::vector<const CGObjectInstance *> ret;
|
||||||
for(auto embarkPoint : heroSector->embarkmentPoints)
|
for(auto embarkPoint : heroSector->embarkmentPoints)
|
||||||
{
|
{
|
||||||
const Sector *embarkSector = &infoOnSectors[retreiveTile(embarkPoint)];
|
const Sector * embarkSector = &infoOnSectors[retrieveTile(embarkPoint)];
|
||||||
range::copy(embarkSector->visitableObjs, std::back_inserter(ret));
|
range::copy(embarkSector->visitableObjs, std::back_inserter(ret));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -109,9 +109,9 @@ struct SectorMap
|
|||||||
|
|
||||||
bool markIfBlocked(TSectorID &sec, crint3 pos, const TerrainTile *t);
|
bool markIfBlocked(TSectorID &sec, crint3 pos, const TerrainTile *t);
|
||||||
bool markIfBlocked(TSectorID &sec, crint3 pos);
|
bool markIfBlocked(TSectorID &sec, crint3 pos);
|
||||||
TSectorID & retreiveTile(crint3 pos);
|
TSectorID & retrieveTile(crint3 pos);
|
||||||
TSectorID & retreiveTileN(TSectorArray &vectors, const int3 &pos);
|
TSectorID & retrieveTileN(TSectorArray & vectors, const int3 & pos);
|
||||||
const TSectorID & retreiveTileN(const TSectorArray &vectors, const int3 &pos);
|
const TSectorID & retrieveTileN(const TSectorArray &vectors, const int3 &pos);
|
||||||
TerrainTile* getTile(crint3 pos) const;
|
TerrainTile* getTile(crint3 pos) const;
|
||||||
std::vector<const CGObjectInstance *> getNearbyObjs(HeroPtr h, bool sectorsAround);
|
std::vector<const CGObjectInstance *> getNearbyObjs(HeroPtr h, bool sectorsAround);
|
||||||
|
|
||||||
@ -297,8 +297,8 @@ public:
|
|||||||
void validateObject(const CGObjectInstance *obj); //checks if object is still visible and if not, removes references to it
|
void validateObject(const CGObjectInstance *obj); //checks if object is still visible and if not, removes references to it
|
||||||
void validateObject(ObjectIdRef obj); //checks if object is still visible and if not, removes references to it
|
void validateObject(ObjectIdRef obj); //checks if object is still visible and if not, removes references to it
|
||||||
void validateVisitableObjs();
|
void validateVisitableObjs();
|
||||||
void retreiveVisitableObjs(std::vector<const CGObjectInstance *> &out, bool includeOwned = false) const;
|
void retrieveVisitableObjs(std::vector<const CGObjectInstance *> &out, bool includeOwned = false) const;
|
||||||
void retreiveVisitableObjs();
|
void retrieveVisitableObjs();
|
||||||
std::vector<const CGObjectInstance *> getFlaggedObjects() const;
|
std::vector<const CGObjectInstance *> getFlaggedObjects() const;
|
||||||
|
|
||||||
const CGObjectInstance *lookForArt(int aid) const;
|
const CGObjectInstance *lookForArt(int aid) const;
|
||||||
|
@ -178,7 +178,7 @@ void CClient::run()
|
|||||||
{
|
{
|
||||||
while(!terminate)
|
while(!terminate)
|
||||||
{
|
{
|
||||||
CPack *pack = serv->retreivePack(); //get the package from the server
|
CPack * pack = serv->retrievePack(); //get the package from the server
|
||||||
|
|
||||||
if (terminate)
|
if (terminate)
|
||||||
{
|
{
|
||||||
|
@ -1309,7 +1309,7 @@ bool CArtifactSet::isPositionFree(ArtifactPosition pos, bool onlyLockCheck) cons
|
|||||||
return true; //no slot means not used
|
return true; //no slot means not used
|
||||||
}
|
}
|
||||||
|
|
||||||
ArtSlotInfo & CArtifactSet::retreiveNewArtSlot(ArtifactPosition slot)
|
ArtSlotInfo & CArtifactSet::retrieveNewArtSlot(ArtifactPosition slot)
|
||||||
{
|
{
|
||||||
assert(!vstd::contains(artifactsWorn, slot));
|
assert(!vstd::contains(artifactsWorn, slot));
|
||||||
ArtSlotInfo &ret = slot < GameConstants::BACKPACK_START
|
ArtSlotInfo &ret = slot < GameConstants::BACKPACK_START
|
||||||
@ -1321,7 +1321,7 @@ ArtSlotInfo & CArtifactSet::retreiveNewArtSlot(ArtifactPosition slot)
|
|||||||
|
|
||||||
void CArtifactSet::setNewArtSlot(ArtifactPosition slot, CArtifactInstance *art, bool locked)
|
void CArtifactSet::setNewArtSlot(ArtifactPosition slot, CArtifactInstance *art, bool locked)
|
||||||
{
|
{
|
||||||
ArtSlotInfo &asi = retreiveNewArtSlot(slot);
|
ArtSlotInfo & asi = retrieveNewArtSlot(slot);
|
||||||
asi.artifact = art;
|
asi.artifact = art;
|
||||||
asi.locked = locked;
|
asi.locked = locked;
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ public:
|
|||||||
std::vector<ArtSlotInfo> artifactsInBackpack; //hero's artifacts from bag
|
std::vector<ArtSlotInfo> artifactsInBackpack; //hero's artifacts from bag
|
||||||
std::map<ArtifactPosition, ArtSlotInfo> artifactsWorn; //map<position,artifact_id>; positions: 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5
|
std::map<ArtifactPosition, ArtSlotInfo> artifactsWorn; //map<position,artifact_id>; positions: 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5
|
||||||
|
|
||||||
ArtSlotInfo &retreiveNewArtSlot(ArtifactPosition slot);
|
ArtSlotInfo & retrieveNewArtSlot(ArtifactPosition slot);
|
||||||
void setNewArtSlot(ArtifactPosition slot, CArtifactInstance *art, bool locked);
|
void setNewArtSlot(ArtifactPosition slot, CArtifactInstance *art, bool locked);
|
||||||
void eraseArtSlot(ArtifactPosition slot);
|
void eraseArtSlot(ArtifactPosition slot);
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "IGameEventsReceiver.h"
|
#include "IGameEventsReceiver.h"
|
||||||
|
|
||||||
class IGameEventRealizer;
|
class IGameEventRealizer;
|
||||||
class CPrivilagedInfoCallback;
|
class CPrivilegedInfoCallback;
|
||||||
|
|
||||||
class CScriptingModule : public IGameEventsReceiver, public IBattleEventsReceiver
|
class CScriptingModule : public IGameEventsReceiver, public IBattleEventsReceiver
|
||||||
{
|
{
|
||||||
@ -20,7 +20,7 @@ public:
|
|||||||
virtual void executeUserCommand(const std::string &cmd){};
|
virtual void executeUserCommand(const std::string &cmd){};
|
||||||
virtual void init(){}; //called upon the start of game (after map randomization, before first turn)
|
virtual void init(){}; //called upon the start of game (after map randomization, before first turn)
|
||||||
virtual void giveActionCB(IGameEventRealizer *cb){};
|
virtual void giveActionCB(IGameEventRealizer *cb){};
|
||||||
virtual void giveInfoCB(CPrivilagedInfoCallback *cb){};
|
virtual void giveInfoCB(CPrivilegedInfoCallback *cb){};
|
||||||
|
|
||||||
CScriptingModule(){}
|
CScriptingModule(){}
|
||||||
virtual ~CScriptingModule(){}
|
virtual ~CScriptingModule(){}
|
||||||
|
@ -559,7 +559,7 @@ const std::shared_ptr<Bonus> CBonusSystemNode::getBonusLocalFirst( const CSelect
|
|||||||
return (const_cast<CBonusSystemNode*>(this))->getBonusLocalFirst(selector);
|
return (const_cast<CBonusSystemNode*>(this))->getBonusLocalFirst(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBonusSystemNode::getParents(TCNodes &out) const /*retreives list of parent nodes (nodes to inherit bonuses from) */
|
void CBonusSystemNode::getParents(TCNodes & out) const /*retrieves list of parent nodes (nodes to inherit bonuses from) */
|
||||||
{
|
{
|
||||||
for (auto & elem : parents)
|
for (auto & elem : parents)
|
||||||
{
|
{
|
||||||
@ -1238,7 +1238,7 @@ namespace Selector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const CStack * retreiveStackBattle(const CBonusSystemNode *node)
|
const CStack * retrieveStackBattle(const CBonusSystemNode * node)
|
||||||
{
|
{
|
||||||
switch(node->getNodeType())
|
switch(node->getNodeType())
|
||||||
{
|
{
|
||||||
@ -1249,7 +1249,7 @@ const CStack * retreiveStackBattle(const CBonusSystemNode *node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const CStackInstance * retreiveStackInstance(const CBonusSystemNode *node)
|
const CStackInstance * retrieveStackInstance(const CBonusSystemNode * node)
|
||||||
{
|
{
|
||||||
switch(node->getNodeType())
|
switch(node->getNodeType())
|
||||||
{
|
{
|
||||||
@ -1271,7 +1271,7 @@ const CCreature * retrieveCreature(const CBonusSystemNode *node)
|
|||||||
case CBonusSystemNode::STACK_BATTLE:
|
case CBonusSystemNode::STACK_BATTLE:
|
||||||
return (static_cast<const CStack*>(node))->type;
|
return (static_cast<const CStack*>(node))->type;
|
||||||
default:
|
default:
|
||||||
const CStackInstance *csi = retreiveStackInstance(node);
|
const CStackInstance * csi = retrieveStackInstance(node);
|
||||||
if(csi)
|
if(csi)
|
||||||
return csi->type;
|
return csi->type;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -1491,7 +1491,7 @@ RankRangeLimiter::RankRangeLimiter()
|
|||||||
|
|
||||||
int RankRangeLimiter::limit(const BonusLimitationContext &context) const
|
int RankRangeLimiter::limit(const BonusLimitationContext &context) const
|
||||||
{
|
{
|
||||||
const CStackInstance *csi = retreiveStackInstance(&context.node);
|
const CStackInstance * csi = retrieveStackInstance(&context.node);
|
||||||
if(csi)
|
if(csi)
|
||||||
{
|
{
|
||||||
if (csi->getNodeType() == CBonusSystemNode::COMMANDER) //no stack exp bonuses for commander creatures
|
if (csi->getNodeType() == CBonusSystemNode::COMMANDER) //no stack exp bonuses for commander creatures
|
||||||
@ -1503,14 +1503,14 @@ int RankRangeLimiter::limit(const BonusLimitationContext &context) const
|
|||||||
|
|
||||||
int StackOwnerLimiter::limit(const BonusLimitationContext &context) const
|
int StackOwnerLimiter::limit(const BonusLimitationContext &context) const
|
||||||
{
|
{
|
||||||
const CStack *s = retreiveStackBattle(&context.node);
|
const CStack * s = retrieveStackBattle(&context.node);
|
||||||
if(s)
|
if(s)
|
||||||
return s->owner != owner;
|
return s->owner != owner;
|
||||||
|
|
||||||
const CStackInstance *csi = retreiveStackInstance(&context.node);
|
const CStackInstance * csi = retrieveStackInstance(&context.node);
|
||||||
if(csi && csi->armyObj)
|
if(csi && csi->armyObj)
|
||||||
return csi->armyObj->tempOwner != owner;
|
return csi->armyObj->tempOwner != owner;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
StackOwnerLimiter::StackOwnerLimiter()
|
StackOwnerLimiter::StackOwnerLimiter()
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "mapping/CMap.h"
|
#include "mapping/CMap.h"
|
||||||
#include "CPlayerState.h"
|
#include "CPlayerState.h"
|
||||||
|
|
||||||
void CPrivilagedInfoCallback::getFreeTiles (std::vector<int3> &tiles) const
|
void CPrivilegedInfoCallback::getFreeTiles(std::vector<int3> & tiles) const
|
||||||
{
|
{
|
||||||
std::vector<int> floors;
|
std::vector<int> floors;
|
||||||
for (int b = 0; b < (gs->map->twoLevel ? 2 : 1); ++b)
|
for (int b = 0; b < (gs->map->twoLevel ? 2 : 1); ++b)
|
||||||
@ -52,7 +52,7 @@ void CPrivilagedInfoCallback::getFreeTiles (std::vector<int3> &tiles) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPrivilagedInfoCallback::getTilesInRange(std::unordered_set<int3, ShashInt3> &tiles, int3 pos, int radious, boost::optional<PlayerColor> player, int mode, int3::EDistanceFormula distanceFormula) const
|
void CPrivilegedInfoCallback::getTilesInRange(std::unordered_set<int3, ShashInt3> & tiles, int3 pos, int radious, boost::optional<PlayerColor> player, int mode, int3::EDistanceFormula distanceFormula) const
|
||||||
{
|
{
|
||||||
if(!!player && *player >= PlayerColor::PLAYER_LIMIT)
|
if(!!player && *player >= PlayerColor::PLAYER_LIMIT)
|
||||||
{
|
{
|
||||||
@ -84,7 +84,7 @@ void CPrivilagedInfoCallback::getTilesInRange(std::unordered_set<int3, ShashInt3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPrivilagedInfoCallback::getAllTiles(std::unordered_set<int3, ShashInt3> &tiles, boost::optional<PlayerColor> Player, int level, int surface ) const
|
void CPrivilegedInfoCallback::getAllTiles(std::unordered_set<int3, ShashInt3> & tiles, boost::optional<PlayerColor> Player, int level, int surface) const
|
||||||
{
|
{
|
||||||
if(!!Player && *Player >= PlayerColor::PLAYER_LIMIT)
|
if(!!Player && *Player >= PlayerColor::PLAYER_LIMIT)
|
||||||
{
|
{
|
||||||
@ -120,7 +120,7 @@ void CPrivilagedInfoCallback::getAllTiles(std::unordered_set<int3, ShashInt3> &t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPrivilagedInfoCallback::pickAllowedArtsSet(std::vector<const CArtifact*> &out, CRandomGenerator & rand)
|
void CPrivilegedInfoCallback::pickAllowedArtsSet(std::vector<const CArtifact *> & out, CRandomGenerator & rand)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 3 ; j++)
|
for (int j = 0; j < 3 ; j++)
|
||||||
out.push_back(VLC->arth->artifacts[VLC->arth->pickRandomArtifact(rand, CArtifact::ART_TREASURE)]);
|
out.push_back(VLC->arth->artifacts[VLC->arth->pickRandomArtifact(rand, CArtifact::ART_TREASURE)]);
|
||||||
@ -130,7 +130,7 @@ void CPrivilagedInfoCallback::pickAllowedArtsSet(std::vector<const CArtifact*> &
|
|||||||
out.push_back(VLC->arth->artifacts[VLC->arth->pickRandomArtifact(rand, CArtifact::ART_MAJOR)]);
|
out.push_back(VLC->arth->artifacts[VLC->arth->pickRandomArtifact(rand, CArtifact::ART_MAJOR)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPrivilagedInfoCallback::getAllowedSpells(std::vector<SpellID> &out, ui16 level)
|
void CPrivilegedInfoCallback::getAllowedSpells(std::vector<SpellID> & out, ui16 level)
|
||||||
{
|
{
|
||||||
for (ui32 i = 0; i < gs->map->allowedSpell.size(); i++) //spellh size appears to be greater (?)
|
for (ui32 i = 0; i < gs->map->allowedSpell.size(); i++) //spellh size appears to be greater (?)
|
||||||
{
|
{
|
||||||
@ -143,13 +143,13 @@ void CPrivilagedInfoCallback::getAllowedSpells(std::vector<SpellID> &out, ui16 l
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CGameState * CPrivilagedInfoCallback::gameState ()
|
CGameState * CPrivilegedInfoCallback::gameState()
|
||||||
{
|
{
|
||||||
return gs;
|
return gs;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Loader>
|
template<typename Loader>
|
||||||
void CPrivilagedInfoCallback::loadCommonState(Loader &in)
|
void CPrivilegedInfoCallback::loadCommonState(Loader & in)
|
||||||
{
|
{
|
||||||
logGlobal->info("Loading lib part of game...");
|
logGlobal->info("Loading lib part of game...");
|
||||||
in.checkMagicBytes(SAVEGAME_MAGIC);
|
in.checkMagicBytes(SAVEGAME_MAGIC);
|
||||||
@ -171,7 +171,7 @@ void CPrivilagedInfoCallback::loadCommonState(Loader &in)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Saver>
|
template<typename Saver>
|
||||||
void CPrivilagedInfoCallback::saveCommonState(Saver &out) const
|
void CPrivilegedInfoCallback::saveCommonState(Saver & out) const
|
||||||
{
|
{
|
||||||
logGlobal->info("Saving lib part of game...");
|
logGlobal->info("Saving lib part of game...");
|
||||||
out.putMagicBytes(SAVEGAME_MAGIC);
|
out.putMagicBytes(SAVEGAME_MAGIC);
|
||||||
@ -186,9 +186,9 @@ void CPrivilagedInfoCallback::saveCommonState(Saver &out) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// hardly memory usage for `-gdwarf-4` flag
|
// hardly memory usage for `-gdwarf-4` flag
|
||||||
template DLL_LINKAGE void CPrivilagedInfoCallback::loadCommonState<CLoadIntegrityValidator>(CLoadIntegrityValidator&);
|
template DLL_LINKAGE void CPrivilegedInfoCallback::loadCommonState<CLoadIntegrityValidator>(CLoadIntegrityValidator &);
|
||||||
template DLL_LINKAGE void CPrivilagedInfoCallback::loadCommonState<CLoadFile>(CLoadFile&);
|
template DLL_LINKAGE void CPrivilegedInfoCallback::loadCommonState<CLoadFile>(CLoadFile &);
|
||||||
template DLL_LINKAGE void CPrivilagedInfoCallback::saveCommonState<CSaveFile>(CSaveFile&) const;
|
template DLL_LINKAGE void CPrivilegedInfoCallback::saveCommonState<CSaveFile>(CSaveFile &) const;
|
||||||
|
|
||||||
TerrainTile * CNonConstInfoCallback::getTile( int3 pos )
|
TerrainTile * CNonConstInfoCallback::getTile( int3 pos )
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,7 @@ class CStackBasicDescriptor;
|
|||||||
class CGCreature;
|
class CGCreature;
|
||||||
struct ShashInt3;
|
struct ShashInt3;
|
||||||
|
|
||||||
class DLL_LINKAGE CPrivilagedInfoCallback : public CGameInfoCallback
|
class DLL_LINKAGE CPrivilegedInfoCallback : public CGameInfoCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CGameState * gameState();
|
CGameState * gameState();
|
||||||
@ -97,7 +97,7 @@ public:
|
|||||||
virtual void changeFogOfWar(std::unordered_set<int3, ShashInt3> &tiles, PlayerColor player, bool hide) = 0;
|
virtual void changeFogOfWar(std::unordered_set<int3, ShashInt3> &tiles, PlayerColor player, bool hide) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DLL_LINKAGE CNonConstInfoCallback : public CPrivilagedInfoCallback
|
class DLL_LINKAGE CNonConstInfoCallback : public CPrivilegedInfoCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PlayerState *getPlayer(PlayerColor color, bool verbose = true);
|
PlayerState *getPlayer(PlayerColor color, bool verbose = true);
|
||||||
@ -111,7 +111,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Interface class for handling general game logic and actions
|
/// Interface class for handling general game logic and actions
|
||||||
class DLL_LINKAGE IGameCallback : public CPrivilagedInfoCallback, public IGameEventCallback
|
class DLL_LINKAGE IGameCallback : public CPrivilegedInfoCallback, public IGameEventCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~IGameCallback(){};
|
virtual ~IGameCallback(){};
|
||||||
|
@ -34,7 +34,7 @@ namespace SiegeStuffThatShouldBeMovedToHandlers // <=== TODO
|
|||||||
*Maximum damage for Castle, Conflux is 120, Necropolis, Inferno, Fortress 125, Stronghold, Turret, and Dungeon 130 (for all three Turrets).
|
*Maximum damage for Castle, Conflux is 120, Necropolis, Inferno, Fortress 125, Stronghold, Turret, and Dungeon 130 (for all three Turrets).
|
||||||
*Artillery allows the player to control the Turrets.
|
*Artillery allows the player to control the Turrets.
|
||||||
*/
|
*/
|
||||||
static void retreiveTurretDamageRange(const CGTownInstance * town, const battle::Unit * turret, double & outMinDmg, double & outMaxDmg)//does not match OH3 yet, but damage is somewhat close
|
static void retrieveTurretDamageRange(const CGTownInstance * town, const battle::Unit * turret, double & outMinDmg, double & outMaxDmg)//does not match OH3 yet, but damage is somewhat close
|
||||||
{
|
{
|
||||||
assert(turret->creatureIndex() == CreatureID::ARROW_TOWERS);
|
assert(turret->creatureIndex() == CreatureID::ARROW_TOWERS);
|
||||||
assert(town);
|
assert(town);
|
||||||
@ -647,7 +647,7 @@ TDmgRange CBattleInfoCallback::calculateDmgRange(const BattleAttackInfo & info)
|
|||||||
|
|
||||||
if(info.attacker->creatureIndex() == CreatureID::ARROW_TOWERS)
|
if(info.attacker->creatureIndex() == CreatureID::ARROW_TOWERS)
|
||||||
{
|
{
|
||||||
SiegeStuffThatShouldBeMovedToHandlers::retreiveTurretDamageRange(battleGetDefendedTown(), info.attacker, minDmg, maxDmg);
|
SiegeStuffThatShouldBeMovedToHandlers::retrieveTurretDamageRange(battleGetDefendedTown(), info.attacker, minDmg, maxDmg);
|
||||||
TDmgRange unmodifiableTowerDamage = std::make_pair(int64_t(minDmg), int64_t(maxDmg));
|
TDmgRange unmodifiableTowerDamage = std::make_pair(int64_t(minDmg), int64_t(maxDmg));
|
||||||
return unmodifiableTowerDamage;
|
return unmodifiableTowerDamage;
|
||||||
}
|
}
|
||||||
@ -657,15 +657,15 @@ TDmgRange CBattleInfoCallback::calculateDmgRange(const BattleAttackInfo & info)
|
|||||||
|
|
||||||
if(attackerBonuses->hasBonus(selectorSiedgeWeapon, cachingStrSiedgeWeapon) && info.attacker->creatureIndex() != CreatureID::ARROW_TOWERS) //any siege weapon, but only ballista can attack (second condition - not arrow turret)
|
if(attackerBonuses->hasBonus(selectorSiedgeWeapon, cachingStrSiedgeWeapon) && info.attacker->creatureIndex() != CreatureID::ARROW_TOWERS) //any siege weapon, but only ballista can attack (second condition - not arrow turret)
|
||||||
{ //minDmg and maxDmg are multiplied by hero attack + 1
|
{ //minDmg and maxDmg are multiplied by hero attack + 1
|
||||||
auto retreiveHeroPrimSkill = [&](int skill) -> int
|
auto retrieveHeroPrimSkill = [&](int skill) -> int
|
||||||
{
|
{
|
||||||
const std::shared_ptr<Bonus> b = attackerBonuses->getBonus(Selector::sourceTypeSel(Bonus::HERO_BASE_SKILL).And(Selector::typeSubtype(Bonus::PRIMARY_SKILL, skill)));
|
const std::shared_ptr<Bonus> b = attackerBonuses->getBonus(Selector::sourceTypeSel(Bonus::HERO_BASE_SKILL).And(Selector::typeSubtype(Bonus::PRIMARY_SKILL, skill)));
|
||||||
return b ? b->val : 0; //if there is no hero or no info on his primary skill, return 0
|
return b ? b->val : 0; //if there is no hero or no info on his primary skill, return 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
minDmg *= retreiveHeroPrimSkill(PrimarySkill::ATTACK) + 1;
|
minDmg *= retrieveHeroPrimSkill(PrimarySkill::ATTACK) + 1;
|
||||||
maxDmg *= retreiveHeroPrimSkill(PrimarySkill::ATTACK) + 1;
|
maxDmg *= retrieveHeroPrimSkill(PrimarySkill::ATTACK) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
double attackDefenceDifference = 0.0;
|
double attackDefenceDifference = 0.0;
|
||||||
|
@ -214,7 +214,7 @@ void CConnection::reportState(vstd::CLoggerBase * out)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CPack * CConnection::retreivePack()
|
CPack * CConnection::retrievePack()
|
||||||
{
|
{
|
||||||
CPack *ret = nullptr;
|
CPack *ret = nullptr;
|
||||||
boost::unique_lock<boost::mutex> lock(*rmx);
|
boost::unique_lock<boost::mutex> lock(*rmx);
|
||||||
|
@ -77,7 +77,7 @@ public:
|
|||||||
CConnection &operator&(const T&);
|
CConnection &operator&(const T&);
|
||||||
virtual ~CConnection();
|
virtual ~CConnection();
|
||||||
|
|
||||||
CPack *retreivePack(); //gets from server next pack (allocates it with new)
|
CPack * retrievePack(); //gets from server next pack (allocates it with new)
|
||||||
void sendPackToServer(const CPack &pack, PlayerColor player, ui32 requestID);
|
void sendPackToServer(const CPack &pack, PlayerColor player, ui32 requestID);
|
||||||
|
|
||||||
void disableStackSendingByID();
|
void disableStackSendingByID();
|
||||||
|
@ -2759,7 +2759,7 @@ void ERMInterpreter::executeUserCommand(const std::string &cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ERMInterpreter::giveInfoCB(CPrivilagedInfoCallback *cb)
|
void ERMInterpreter::giveInfoCB(CPrivilegedInfoCallback *cb)
|
||||||
{
|
{
|
||||||
icb = cb;
|
icb = cb;
|
||||||
}
|
}
|
||||||
|
@ -841,7 +841,7 @@ public:
|
|||||||
virtual void heroVisit(const CGHeroInstance *visitor, const CGObjectInstance *visitedObj, bool start) override;
|
virtual void heroVisit(const CGHeroInstance *visitor, const CGObjectInstance *visitedObj, bool start) override;
|
||||||
virtual void init() override;//sets up environment etc.
|
virtual void init() override;//sets up environment etc.
|
||||||
virtual void executeUserCommand(const std::string &cmd) override;
|
virtual void executeUserCommand(const std::string &cmd) override;
|
||||||
virtual void giveInfoCB(CPrivilagedInfoCallback *cb) override;
|
virtual void giveInfoCB(CPrivilegedInfoCallback *cb) override;
|
||||||
virtual void giveActionCB(IGameEventRealizer *cb) override;
|
virtual void giveActionCB(IGameEventRealizer *cb) override;
|
||||||
|
|
||||||
virtual void battleStart(const CCreatureSet *army1, const CCreatureSet *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, bool side) override;
|
virtual void battleStart(const CCreatureSet *army1, const CCreatureSet *army2, int3 tile, const CGHeroInstance *hero1, const CGHeroInstance *hero2, bool side) override;
|
||||||
|
@ -59,7 +59,7 @@ class ParseErrorException : public std::exception
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string CERMPreprocessor::retreiveCommandLine()
|
std::string CERMPreprocessor::retrieveCommandLine()
|
||||||
{
|
{
|
||||||
std::string wholeCommand;
|
std::string wholeCommand;
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ std::vector<LineInfo> ERMParser::parseFile()
|
|||||||
{
|
{
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
std::string command = preproc.retreiveCommandLine();
|
std::string command = preproc.retrieveCommandLine();
|
||||||
if(command.length() == 0)
|
if(command.length() == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class CERMPreprocessor
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CERMPreprocessor(const std::string &Fname);
|
CERMPreprocessor(const std::string &Fname);
|
||||||
std::string retreiveCommandLine();
|
std::string retrieveCommandLine();
|
||||||
int getCurLineNo() const
|
int getCurLineNo() const
|
||||||
{
|
{
|
||||||
return lineNo;
|
return lineNo;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "ERMInterpreter.h"
|
#include "ERMInterpreter.h"
|
||||||
|
|
||||||
IGameEventRealizer *acb;
|
IGameEventRealizer *acb;
|
||||||
CPrivilagedInfoCallback *icb;
|
CPrivilegedInfoCallback *icb;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
@ -12,4 +12,4 @@
|
|||||||
#include "../../lib/CScriptingModule.h"
|
#include "../../lib/CScriptingModule.h"
|
||||||
|
|
||||||
extern IGameEventRealizer *acb;
|
extern IGameEventRealizer *acb;
|
||||||
extern CPrivilagedInfoCallback *icb;
|
extern CPrivilegedInfoCallback *icb;
|
||||||
|
Loading…
Reference in New Issue
Block a user