mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-25 21:38:59 +02:00
* cleaner code is better :)
This commit is contained in:
parent
ecf33cca91
commit
aac1c0b4e7
@ -2280,29 +2280,16 @@ std::vector<THex> CStack::getHexes() const
|
||||
{
|
||||
std::vector<THex> hexes;
|
||||
hexes.push_back(THex(position));
|
||||
if (doubleWide())
|
||||
{
|
||||
if (attackerOwned)
|
||||
hexes.push_back(THex(position - 1));
|
||||
else
|
||||
hexes.push_back(THex(position + 1));
|
||||
}
|
||||
THex occupied = occupiedHex();
|
||||
if(occupied.isValid())
|
||||
hexes.push_back(occupied);
|
||||
|
||||
return hexes;
|
||||
}
|
||||
|
||||
bool CStack::coversPos(ui16 pos) const
|
||||
bool CStack::coversPos(THex pos) const
|
||||
{
|
||||
if (pos == position)
|
||||
return true;
|
||||
if (doubleWide())
|
||||
{
|
||||
if (attackerOwned)
|
||||
return (pos == position - 1);
|
||||
else
|
||||
return (pos == position + 1);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
return vstd::contains(getHexes(), pos);
|
||||
}
|
||||
|
||||
std::vector<si32> CStack::activeSpells() const
|
||||
|
@ -184,7 +184,7 @@ public:
|
||||
bool doubleWide() const;
|
||||
THex occupiedHex() const; //returns number of occupied hex (not the position) if stack is double wide; otherwise -1
|
||||
std::vector<THex> getHexes() const; //up to two occupied hexes, starting from front
|
||||
bool coversPos(ui16 position) const; //checks also if unit is double-wide
|
||||
bool coversPos(THex position) const; //checks also if unit is double-wide
|
||||
|
||||
void prepareAttacked(BattleStackAttacked &bsa) const; //requires bsa.damageAmout filled
|
||||
|
||||
|
@ -1372,7 +1372,7 @@ struct BattleSpellCast : public CPackForClient//3009
|
||||
ui8 side; //which hero did cast spell: 0 - attacker, 1 - defender
|
||||
ui32 id; //id of spell
|
||||
ui8 skill; //caster's skill level
|
||||
ui16 tile; //destination tile (may not be set in some global/mass spells
|
||||
THex tile; //destination tile (may not be set in some global/mass spells
|
||||
std::vector<ui32> resisted; //ids of creatures that resisted this spell
|
||||
std::set<ui32> affectedCres; //ids of creatures affected by this spell, generally used if spell does not set any effect (like dispel or cure)
|
||||
TCreature attackerType;//id of caster to generate console message; -1 if not set (eg. spell casted by artifact)
|
||||
|
@ -3433,7 +3433,7 @@ void CGameHandler::playerMessage( ui8 player, const std::string &message )
|
||||
}
|
||||
}
|
||||
|
||||
void CGameHandler::handleSpellCasting( int spellID, int spellLvl, int destination, ui8 casterSide, ui8 casterColor, const CGHeroInstance * caster, const CGHeroInstance * secHero, int usedSpellPower, SpellCasting::ECastingMode mode, const CStack * stack)
|
||||
void CGameHandler::handleSpellCasting( int spellID, int spellLvl, THex destination, ui8 casterSide, ui8 casterColor, const CGHeroInstance * caster, const CGHeroInstance * secHero, int usedSpellPower, SpellCasting::ECastingMode mode, const CStack * stack)
|
||||
{
|
||||
const CSpell *spell = VLC->spellh->spells[spellID];
|
||||
|
||||
|
@ -193,7 +193,7 @@ public:
|
||||
|
||||
void playerMessage( ui8 player, const std::string &message);
|
||||
bool makeBattleAction(BattleAction &ba);
|
||||
void handleSpellCasting(int spellID, int spellLvl, int destination, ui8 casterSide, ui8 casterColor, const CGHeroInstance * caster, const CGHeroInstance * secHero, int usedSpellPower, SpellCasting::ECastingMode mode, const CStack * stack);
|
||||
void handleSpellCasting(int spellID, int spellLvl, THex destination, ui8 casterSide, ui8 casterColor, const CGHeroInstance * caster, const CGHeroInstance * secHero, int usedSpellPower, SpellCasting::ECastingMode mode, const CStack * stack);
|
||||
bool makeCustomAction(BattleAction &ba);
|
||||
bool queryReply( ui32 qid, ui32 answer );
|
||||
bool hireHero( const CGObjectInstance *obj, ui8 hid, ui8 player );
|
||||
|
Loading…
x
Reference in New Issue
Block a user