From 405b2976d5307fd86f9088e01c0866588da935f5 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sun, 25 Dec 2022 14:03:43 +0200 Subject: [PATCH] Renamed getUpgradeInfo -> fillUpgradeInfo --- AI/Nullkiller/AIGateway.cpp | 2 +- AI/VCAI/VCAI.cpp | 14 +++++++------- client/widgets/CGarrisonInt.cpp | 2 +- client/windows/GUIClasses.cpp | 6 +++--- lib/CGameInfoCallback.cpp | 6 +++--- lib/CGameInfoCallback.h | 4 ++-- lib/CGameState.cpp | 6 +++--- lib/CGameState.h | 4 ++-- server/CGameHandler.cpp | 2 +- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/AI/Nullkiller/AIGateway.cpp b/AI/Nullkiller/AIGateway.cpp index a95412eb1..97e5c7b9d 100644 --- a/AI/Nullkiller/AIGateway.cpp +++ b/AI/Nullkiller/AIGateway.cpp @@ -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]); diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index ea6cb07c2..d51de3348 100644 --- a/AI/VCAI/VCAI.cpp +++ b/AI/VCAI/VCAI.cpp @@ -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]); } } } diff --git a/client/widgets/CGarrisonInt.cpp b/client/widgets/CGarrisonInt.cpp index caeb23f1a..a7e46991d 100644 --- a/client/widgets/CGarrisonInt.cpp +++ b/client/widgets/CGarrisonInt.cpp @@ -163,7 +163,7 @@ std::function 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 upgr = nullptr; diff --git a/client/windows/GUIClasses.cpp b/client/windows/GUIClasses.cpp index b67319a1f..8ceaed783 100644 --- a/client/windows/GUIClasses.cpp +++ b/client/windows/GUIClasses.cpp @@ -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; diff --git a/lib/CGameInfoCallback.cpp b/lib/CGameInfoCallback.cpp index aa5121da1..6d13e7399 100644 --- a/lib/CGameInfoCallback.cpp +++ b/lib/CGameInfoCallback.cpp @@ -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 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 diff --git a/lib/CGameInfoCallback.h b/lib/CGameInfoCallback.h index 96e2b71b7..3b7dc7863 100644 --- a/lib/CGameInfoCallback.h +++ b/lib/CGameInfoCallback.h @@ -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; diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index a36dcbab1..eb129b066 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -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; diff --git a/lib/CGameState.h b/lib/CGameState.h index b15f10bd9..1e747fc4b 100644 --- a/lib/CGameState.h +++ b/lib/CGameState.h @@ -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 pickObject(CGObjectInstance *obj); //chooses type of object to be randomized, returns 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> applier; diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index f94da3576..2a92c0211 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -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;