mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Renamed getUpgradeInfo -> fillUpgradeInfo
This commit is contained in:
parent
eb20a4b208
commit
405b2976d5
@ -731,7 +731,7 @@ bool AIGateway::makePossibleUpgrades(const CArmedInstance * obj)
|
||||
if(const CStackInstance * s = obj->getStackPtr(SlotID(i)))
|
||||
{
|
||||
UpgradeInfo ui;
|
||||
myCb->getUpgradeInfo(obj, SlotID(i), ui);
|
||||
myCb->fillUpgradeInfo(obj, SlotID(i), ui);
|
||||
if(ui.oldID >= 0 && nullkiller->getFreeResources().canAfford(ui.cost[0] * s->count))
|
||||
{
|
||||
myCb->upgradeCreature(obj, SlotID(i), ui.newID[0]);
|
||||
|
@ -753,13 +753,13 @@ void makePossibleUpgrades(const CArmedInstance * obj)
|
||||
|
||||
for(int i = 0; i < GameConstants::ARMY_SIZE; i++)
|
||||
{
|
||||
if(const CStackInstance * s = obj->getStackPtr(SlotID(i)))
|
||||
{
|
||||
UpgradeInfo ui;
|
||||
cb->getUpgradeInfo(obj, SlotID(i), ui);
|
||||
if(ui.oldID >= 0 && cb->getResourceAmount().canAfford(ui.cost[0] * s->count))
|
||||
{
|
||||
cb->upgradeCreature(obj, SlotID(i), ui.newID[0]);
|
||||
if(const CStackInstance * s = obj->getStackPtr(SlotID(i)))
|
||||
{
|
||||
UpgradeInfo ui;
|
||||
cb->fillUpgradeInfo(obj, SlotID(i), ui);
|
||||
if(ui.oldID >= 0 && cb->getResourceAmount().canAfford(ui.cost[0] * s->count))
|
||||
{
|
||||
cb->upgradeCreature(obj, SlotID(i), ui.newID[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ std::function<void()> CGarrisonSlot::getDismiss() const
|
||||
bool CGarrisonSlot::viewInfo()
|
||||
{
|
||||
UpgradeInfo pom;
|
||||
LOCPLINT->cb->getUpgradeInfo(getObj(), ID, pom);
|
||||
LOCPLINT->cb->fillUpgradeInfo(getObj(), ID, pom);
|
||||
|
||||
bool canUpgrade = getObj()->tempOwner == LOCPLINT->playerID && pom.oldID>=0; //upgrade is possible
|
||||
std::function<void(CreatureID)> upgr = nullptr;
|
||||
|
@ -1763,7 +1763,7 @@ void CHillFortWindow::updateGarrisons()
|
||||
if(newState != -1)
|
||||
{
|
||||
UpgradeInfo info;
|
||||
LOCPLINT->cb->getUpgradeInfo(hero, SlotID(i), info);
|
||||
LOCPLINT->cb->fillUpgradeInfo(hero, SlotID(i), info);
|
||||
if(info.newID.size())//we have upgrades here - update costs
|
||||
{
|
||||
costs[i] = info.cost[0] * hero->getStackCount(SlotID(i));
|
||||
@ -1868,7 +1868,7 @@ void CHillFortWindow::makeDeal(SlotID slot)
|
||||
if(slot.getNum() ==i || ( slot.getNum() == slotsCount && currState[i] == 2 ))//this is activated slot or "upgrade all"
|
||||
{
|
||||
UpgradeInfo info;
|
||||
LOCPLINT->cb->getUpgradeInfo(hero, SlotID(i), info);
|
||||
LOCPLINT->cb->fillUpgradeInfo(hero, SlotID(i), info);
|
||||
LOCPLINT->cb->upgradeCreature(hero, SlotID(i), info.newID[0]);
|
||||
}
|
||||
}
|
||||
@ -1899,7 +1899,7 @@ int CHillFortWindow::getState(SlotID slot)
|
||||
return -1;
|
||||
|
||||
UpgradeInfo info;
|
||||
LOCPLINT->cb->getUpgradeInfo(hero, slot, info);
|
||||
LOCPLINT->cb->fillUpgradeInfo(hero, slot, info);
|
||||
if(!info.newID.size())//already upgraded
|
||||
return 1;
|
||||
|
||||
|
@ -166,13 +166,13 @@ const CGTownInstance* CGameInfoCallback::getTown(ObjectInstanceID objid) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CGameInfoCallback::getUpgradeInfo(const CArmedInstance *obj, SlotID stackPos, UpgradeInfo &out) const
|
||||
void CGameInfoCallback::fillUpgradeInfo(const CArmedInstance *obj, SlotID stackPos, UpgradeInfo &out) const
|
||||
{
|
||||
//boost::shared_lock<boost::shared_mutex> lock(*gs->mx);
|
||||
ERROR_RET_IF(!canGetFullInfo(obj), "Cannot get info about not owned object!");
|
||||
ERROR_RET_IF(!obj->hasStackAtSlot(stackPos), "There is no such stack!");
|
||||
gs->getUpgradeInfo(obj, stackPos, out);
|
||||
//return gs->getUpgradeInfo(obj->getStack(stackPos));
|
||||
gs->fillUpgradeInfo(obj, stackPos, out);
|
||||
//return gs->fillUpgradeInfo(obj->getStack(stackPos));
|
||||
}
|
||||
|
||||
const StartInfo * CGameInfoCallback::getStartInfo(bool beforeRandomization) const
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
|
||||
|
||||
// //armed object
|
||||
// void getUpgradeInfo(const CArmedInstance *obj, SlotID stackPos, UpgradeInfo &out)const;
|
||||
// void fillUpgradeInfo(const CArmedInstance *obj, SlotID stackPos, UpgradeInfo &out)const;
|
||||
|
||||
//hero
|
||||
virtual const CGHeroInstance * getHero(ObjectInstanceID objid) const = 0;
|
||||
@ -164,7 +164,7 @@ public:
|
||||
|
||||
|
||||
//armed object
|
||||
virtual void getUpgradeInfo(const CArmedInstance *obj, SlotID stackPos, UpgradeInfo &out)const;
|
||||
virtual void fillUpgradeInfo(const CArmedInstance *obj, SlotID stackPos, UpgradeInfo &out)const;
|
||||
|
||||
//hero
|
||||
virtual const CGHeroInstance * getHero(ObjectInstanceID objid) const override;
|
||||
|
@ -1957,15 +1957,15 @@ BattleField CGameState::battleGetBattlefieldType(int3 tile, CRandomGenerator & r
|
||||
}
|
||||
|
||||
|
||||
void CGameState::getUpgradeInfo(const CArmedInstance *obj, SlotID stackPos, UpgradeInfo &out) const
|
||||
void CGameState::fillUpgradeInfo(const CArmedInstance *obj, SlotID stackPos, UpgradeInfo &out) const
|
||||
{
|
||||
assert(obj);
|
||||
assert(obj->hasStackAtSlot(stackPos));
|
||||
|
||||
out = getUpgradeInfo(obj->getStack(stackPos));
|
||||
out = fillUpgradeInfo(obj->getStack(stackPos));
|
||||
}
|
||||
|
||||
UpgradeInfo CGameState::getUpgradeInfo(const CStackInstance &stack) const
|
||||
UpgradeInfo CGameState::fillUpgradeInfo(const CStackInstance &stack) const
|
||||
{
|
||||
UpgradeInfo ret;
|
||||
const CCreature *base = stack.type;
|
||||
|
@ -179,7 +179,7 @@ public:
|
||||
void apply(CPack *pack);
|
||||
BattleField battleGetBattlefieldType(int3 tile, CRandomGenerator & rand);
|
||||
|
||||
void getUpgradeInfo(const CArmedInstance *obj, SlotID stackPos, UpgradeInfo &out) const override;
|
||||
void fillUpgradeInfo(const CArmedInstance *obj, SlotID stackPos, UpgradeInfo &out) const override;
|
||||
PlayerRelations::PlayerRelations getPlayerRelations(PlayerColor color1, PlayerColor color2) const override;
|
||||
bool checkForVisitableDir(const int3 & src, const int3 & dst) const; //check if src tile is visitable from dst tile
|
||||
void calculatePaths(const CGHeroInstance *hero, CPathsInfo &out) override; //calculates possible paths for hero, by default uses current hero position and movement left; returns pointer to newly allocated CPath or nullptr if path does not exists
|
||||
@ -294,7 +294,7 @@ private:
|
||||
std::pair<Obj,int> pickObject(CGObjectInstance *obj); //chooses type of object to be randomized, returns <type, subtype>
|
||||
int pickUnusedHeroTypeRandomly(PlayerColor owner); // picks a unused hero type randomly
|
||||
int pickNextHeroType(PlayerColor owner); // picks next free hero type of the H3 hero init sequence -> chosen starting hero, then unused hero type randomly
|
||||
UpgradeInfo getUpgradeInfo(const CStackInstance &stack) const;
|
||||
UpgradeInfo fillUpgradeInfo(const CStackInstance &stack) const;
|
||||
|
||||
// ---- data -----
|
||||
std::shared_ptr<CApplier<CBaseForGSApply>> applier;
|
||||
|
@ -3717,7 +3717,7 @@ bool CGameHandler::upgradeCreature(ObjectInstanceID objid, SlotID pos, CreatureI
|
||||
COMPLAIN_RET("Cannot upgrade, no stack at slot " + boost::to_string(pos));
|
||||
}
|
||||
UpgradeInfo ui;
|
||||
getUpgradeInfo(obj, pos, ui);
|
||||
fillUpgradeInfo(obj, pos, ui);
|
||||
PlayerColor player = obj->tempOwner;
|
||||
const PlayerState *p = getPlayerState(player);
|
||||
int crQuantity = obj->stacks.at(pos)->count;
|
||||
|
Loading…
Reference in New Issue
Block a user