1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-02 00:10:22 +02:00

Use some constants in SRSLPraserHelpers

This commit is contained in:
AlexVinS 2014-11-13 08:13:06 +03:00
parent 4042757f93
commit bab7198cd7
2 changed files with 6 additions and 5 deletions

View File

@ -202,6 +202,7 @@ public:
//internal, for use only by Mechanics classes. applying secondary skills
ui32 calculateBonus(ui32 baseDamage, const CGHeroInstance * caster, const CStack * affectedCreature) const;
///calculate spell damage on stack taking caster`s secondary skills and affectedCreature`s bonuses into account
ui32 calculateDamage(const CGHeroInstance * caster, const CStack * affectedCreature, int spellSchoolLevel, int usedSpellPower) const;
///calculate healed HP for all spells casted by hero

View File

@ -20,7 +20,7 @@ namespace SRSLPraserHelpers
{
static int XYToHex(int x, int y)
{
return x + 17 * y;
return x + GameConstants::BFIELD_WIDTH * y;
}
static int XYToHex(std::pair<int, int> xy)
@ -30,12 +30,12 @@ namespace SRSLPraserHelpers
static int hexToY(int battleFieldPosition)
{
return battleFieldPosition/17;
return battleFieldPosition/GameConstants::BFIELD_WIDTH;
}
static int hexToX(int battleFieldPosition)
{
int pos = battleFieldPosition - hexToY(battleFieldPosition) * 17;
int pos = battleFieldPosition - hexToY(battleFieldPosition) * GameConstants::BFIELD_WIDTH;
return pos;
}
@ -74,10 +74,10 @@ namespace SRSLPraserHelpers
static bool isGoodHex(std::pair<int, int> xy)
{
return xy.first >=0 && xy.first < 17 && xy.second >= 0 && xy.second < 11;
return xy.first >=0 && xy.first < GameConstants::BFIELD_WIDTH && xy.second >= 0 && xy.second < GameConstants::BFIELD_HEIGHT;
}
//helper function for std::set<ui16> CSpell::rangeInHexes(unsigned int centralHex, ui8 schoolLvl ) const
//helper function for rangeInHexes
static std::set<ui16> getInRange(unsigned int center, int low, int high)
{
std::set<ui16> ret;