1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Rename ambiguos 'clear' to 'clearSlots'

A lot of map objects inherit from CCreatureSet and as result - get
clean() method that resets object army
This commit is contained in:
Ivan Savenko 2023-08-07 19:13:02 +03:00
parent f0ede46186
commit e57f8742cd
7 changed files with 13 additions and 13 deletions

View File

@ -170,7 +170,7 @@ std::vector<SlotInfo> ArmyManager::getBestArmy(const IBonusBearer * armyCarrier,
std::vector<SlotInfo> newArmy;
uint64_t newValue = 0;
newArmyInstance.clear();
newArmyInstance.clearSlots();
for(auto & slot : sortedSlots)
{

View File

@ -445,7 +445,7 @@ void CCreatureSet::setStackExp(const SlotID & slot, TExpType exp)
stacks[slot]->experience = exp;
}
void CCreatureSet::clear()
void CCreatureSet::clearSlots()
{
while(!stacks.empty())
{
@ -533,12 +533,12 @@ void CCreatureSet::changeStackCount(const SlotID & slot, TQuantity toAdd)
CCreatureSet::~CCreatureSet()
{
clear();
clearSlots();
}
void CCreatureSet::setToArmy(CSimpleArmy &src)
{
clear();
clearSlots();
while(src)
{
auto i = src.army.begin();
@ -1050,7 +1050,7 @@ void CStackBasicDescriptor::serializeJson(JsonSerializeFormat & handler)
}
}
void CSimpleArmy::clear()
void CSimpleArmy::clearSlots()
{
army.clear();
}

View File

@ -181,7 +181,7 @@ using TCreatureQueue = std::priority_queue<TPairCreatureSlot, std::vector<TPairC
class IArmyDescriptor
{
public:
virtual void clear() = 0;
virtual void clearSlots() = 0;
virtual bool setCreature(SlotID slot, CreatureID cre, TQuantity count) = 0;
};
@ -190,7 +190,7 @@ class DLL_LINKAGE CSimpleArmy : public IArmyDescriptor
{
public:
TSimpleSlots army;
void clear() override;
void clearSlots() override;
bool setCreature(SlotID slot, CreatureID cre, TQuantity count) override;
operator bool() const;
@ -226,7 +226,7 @@ public:
void addToSlot(const SlotID & slot, const CreatureID & cre, TQuantity count, bool allowMerging = true); //Adds stack to slot. Slot must be empty or with same type creature
void addToSlot(const SlotID & slot, CStackInstance * stack, bool allowMerging = true); //Adds stack to slot. Slot must be empty or with same type creature
void clear() override;
void clearSlots() override;
void setFormation(bool tight);
CArmedInstance *castToArmyObj();

View File

@ -335,7 +335,7 @@ struct DLL_LINKAGE SetAvailableHero : public CPackForClient
{
SetAvailableHero()
{
army.clear();
army.clearSlots();
}
void applyGs(CGameState * gs);

View File

@ -58,7 +58,7 @@ std::string CBank::getHoverText(PlayerColor player) const
void CBank::setConfig(const BankConfig & config)
{
bc = std::make_unique<BankConfig>(config);
clear(); // remove all stacks, if any
clearSlots(); // remove all stacks, if any
for(const auto & stack : config.guards)
setCreature (SlotID(stacksCount()), stack.type->getId(), stack.count);

View File

@ -222,7 +222,7 @@ bool RewardsWidget::commitChanges()
pandora->resources = ResourceSet();
pandora->artifacts.clear();
pandora->spells.clear();
pandora->creatures.clear();
pandora->creatures.clearSlots();
for(int row = 0; row < rewards; ++row)
{

View File

@ -112,7 +112,7 @@ void HeroPoolProcessor::onHeroEscaped(const PlayerColor & color, const CGHeroIns
sah.slotID = selectSlotForRole(color, sah.roleID);
sah.player = color;
sah.hid = hero->subID;
sah.army.clear();
sah.army.clearSlots();
sah.army.setCreature(SlotID(0), hero->type->initialArmy.at(0).creature, 1);
gameHandler->sendAndApply(&sah);
@ -148,7 +148,7 @@ void HeroPoolProcessor::selectNewHeroForSlot(const PlayerColor & color, TavernHe
else
{
sah.roleID = TavernSlotRole::SINGLE_UNIT;
sah.army.clear();
sah.army.clearSlots();
sah.army.setCreature(SlotID(0), newHero->type->initialArmy[0].creature, 1);
}
}