1
0
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:
Ivan Savenko 2022-12-25 14:03:43 +02:00
parent eb20a4b208
commit 405b2976d5
9 changed files with 23 additions and 23 deletions

View File

@ -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]);

View File

@ -756,7 +756,7 @@ void makePossibleUpgrades(const CArmedInstance * obj)
if(const CStackInstance * s = obj->getStackPtr(SlotID(i)))
{
UpgradeInfo ui;
cb->getUpgradeInfo(obj, SlotID(i), 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]);

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;