1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Use constant for summoned creature slot

This commit is contained in:
AlexVinS 2015-10-15 17:43:03 +03:00
parent c94bea51e3
commit f6b9015324
4 changed files with 5 additions and 3 deletions

View File

@ -19,6 +19,7 @@
#include "spells/CSpellHandler.h" #include "spells/CSpellHandler.h"
const SlotID SlotID::COMMANDER_SLOT_PLACEHOLDER = SlotID(-2); const SlotID SlotID::COMMANDER_SLOT_PLACEHOLDER = SlotID(-2);
const SlotID SlotID::SUMMONED_SLOT_PLACEHOLDER = SlotID(255);
const PlayerColor PlayerColor::CANNOT_DETERMINE = PlayerColor(253); const PlayerColor PlayerColor::CANNOT_DETERMINE = PlayerColor(253);
const PlayerColor PlayerColor::UNFLAGGABLE = PlayerColor(254); const PlayerColor PlayerColor::UNFLAGGABLE = PlayerColor(254);
const PlayerColor PlayerColor::NEUTRAL = PlayerColor(255); const PlayerColor PlayerColor::NEUTRAL = PlayerColor(255);

View File

@ -216,6 +216,7 @@ class SlotID : public BaseForID<SlotID, si32>
friend class CNonConstInfoCallback; friend class CNonConstInfoCallback;
DLL_LINKAGE static const SlotID COMMANDER_SLOT_PLACEHOLDER; DLL_LINKAGE static const SlotID COMMANDER_SLOT_PLACEHOLDER;
DLL_LINKAGE static const SlotID SUMMONED_SLOT_PLACEHOLDER; ///<for all summoned creatures, only during battle
bool validSlot() const bool validSlot() const
{ {

View File

@ -1567,7 +1567,7 @@ DLL_LINKAGE void BattleStackAdded::applyGs(CGameState *gs)
} }
CStackBasicDescriptor csbd(creID, amount); CStackBasicDescriptor csbd(creID, amount);
CStack * addedStack = gs->curB->generateNewStack(csbd, attacker, SlotID(255), pos); //TODO: netpacks? CStack * addedStack = gs->curB->generateNewStack(csbd, attacker, SlotID::SUMMONED_SLOT_PLACEHOLDER, pos); //TODO: netpacks?
if (summoned) if (summoned)
addedStack->state.insert(EBattleStackState::SUMMONED); addedStack->state.insert(EBattleStackState::SUMMONED);

View File

@ -5862,7 +5862,7 @@ CasualtiesAfterBattle::CasualtiesAfterBattle(const CArmedInstance * _army, Battl
//FIXME: this info is also used in BattleInfo::calculateCasualties, refactor //FIXME: this info is also used in BattleInfo::calculateCasualties, refactor
st->count = std::max (0, st->count - st->resurrected); st->count = std::max (0, st->count - st->resurrected);
if (!st->count && !st->base) //we can imagine stacks of war mahcines that are not spawned by artifacts? if (!st->count && !st->base) //we can imagine stacks of war machines that are not spawned by artifacts?
{ {
auto warMachine = VLC->arth->creatureToMachineID(st->type->idNumber); auto warMachine = VLC->arth->creatureToMachineID(st->type->idNumber);
if (warMachine != ArtifactID::NONE) if (warMachine != ArtifactID::NONE)
@ -5875,7 +5875,7 @@ CasualtiesAfterBattle::CasualtiesAfterBattle(const CArmedInstance * _army, Battl
if(army->slotEmpty(st->slot)) if(army->slotEmpty(st->slot))
{ {
if(st->slot == SlotID(255) && !vstd::contains(st->state, EBattleStackState::SUMMONED) && st->alive()) if(st->slot == SlotID::SUMMONED_SLOT_PLACEHOLDER && !vstd::contains(st->state, EBattleStackState::SUMMONED) && st->alive())
{ {
//this stack was permanently summoned //this stack was permanently summoned
const CreatureID summonedType = st->type->idNumber; const CreatureID summonedType = st->type->idNumber;