diff --git a/fheroes2.cfg b/fheroes2.cfg index 6170035..92868e1 100755 --- a/fheroes2.cfg +++ b/fheroes2.cfg @@ -1,9 +1,7 @@ sound = off -sound volume = 1 music = off -music volume = 1 fullscreen = off -videomode = 800x600 +videomode = 1024x768 heroes speed = 10 ai speed = 10 battle speed = 10 diff --git a/src/Installer/Installer/fh2enh.zip b/src/Installer/Installer/fh2enh.zip index 19a5578..bc9f9fe 100644 Binary files a/src/Installer/Installer/fh2enh.zip and b/src/Installer/Installer/fh2enh.zip differ diff --git a/src/fheroes2/ai/ai_action.cpp b/src/fheroes2/ai/ai_action.cpp index 6ac1318..808305c 100644 --- a/src/fheroes2/ai/ai_action.cpp +++ b/src/fheroes2/ai/ai_action.cpp @@ -1063,7 +1063,7 @@ void AIToShrine(Heroes& hero, uint32_t obj, s32 dst_index) // check present spell (skip bag artifacts) !hero.HaveSpell(spell, true) && // check valid level spell and wisdom skill - !(3 == spell_level && Skill::Level::NONE == hero.GetLevelSkill(Skill::Secondary::WISDOM))) + !(3 == spell_level && Skill::Level::NONE == hero.GetLevelSkill(Skill::SkillT::WISDOM))) { hero.AppendSpellToBook(spell); hero.SetVisited(dst_index); @@ -1137,7 +1137,7 @@ void AIToArtesianSpring(Heroes& hero, uint32_t obj, s32 dst_index) void AIToXanadu(Heroes& hero, uint32_t obj, s32 dst_index) { const Maps::Tiles& tile = world.GetTiles(dst_index); - const uint32_t level1 = hero.GetLevelSkill(Skill::Secondary::DIPLOMACY); + const uint32_t level1 = hero.GetLevelSkill(Skill::SkillT::DIPLOMACY); const uint32_t level2 = hero.GetLevel(); if (!hero.isVisited(tile) && @@ -1260,7 +1260,7 @@ void AIToPoorLuckObject(Heroes& hero, uint32_t obj, s32 dst_index) // check magick book if (hero.HaveSpellBook() && // check skill level for wisdom - Skill::Level::EXPERT == hero.GetLevelSkill(Skill::Secondary::WISDOM)) + Skill::Level::EXPERT == hero.GetLevelSkill(Skill::SkillT::WISDOM)) { hero.AppendSpellToBook(spell); } @@ -1684,7 +1684,7 @@ bool AI::HeroesValidObject(const Heroes& hero, s32 index) !hero.HaveSpell(spell) && // check valid level spell and wisdom skill !(3 == spell.Level() && - Skill::Level::NONE == hero.GetLevelSkill(Skill::Secondary::WISDOM))) + Skill::Level::NONE == hero.GetLevelSkill(Skill::SkillT::WISDOM))) return true; } break; @@ -1742,7 +1742,7 @@ bool AI::HeroesValidObject(const Heroes& hero, s32 index) case MP2::OBJ_XANADU: { - const uint32_t level1 = hero.GetLevelSkill(Skill::Secondary::DIPLOMACY); + const uint32_t level1 = hero.GetLevelSkill(Skill::SkillT::DIPLOMACY); const uint32_t level2 = hero.GetLevel(); if (!hero.isVisited(tile) && diff --git a/src/fheroes2/army/army.cpp b/src/fheroes2/army/army.cpp index b5f44fa..e819514 100644 --- a/src/fheroes2/army/army.cpp +++ b/src/fheroes2/army/army.cpp @@ -1304,12 +1304,12 @@ JoinCount Army::GetJoinSolution(const Heroes& hero, const Maps::Tiles& tile, con { if (join_free || join_force) return {JOIN_FREE, troop.GetCount()}; - if (hero.HasSecondarySkill(Skill::Secondary::DIPLOMACY)) + if (hero.HasSecondarySkill(Skill::SkillT::DIPLOMACY)) { // skill diplomacy const uint32_t to_join = Monster::GetCountFromHitPoints(troop._monster, troop.GetHitPointsTroop() * - hero.GetSecondaryValues(Skill::Secondary::DIPLOMACY) + hero.GetSecondaryValues(Skill::SkillT::DIPLOMACY) / 100); diff --git a/src/fheroes2/battle/battle_arena.cpp b/src/fheroes2/battle/battle_arena.cpp index 1b822dc..913b86d 100644 --- a/src/fheroes2/battle/battle_arena.cpp +++ b/src/fheroes2/battle/battle_arena.cpp @@ -1079,7 +1079,7 @@ uint32_t Battle::Arena::GetObstaclesPenalty(const Unit& attacker, const Unit& de if (castle) { // archery skill - if (enemy && Skill::Level::NONE != enemy->GetLevelSkill(Skill::Secondary::ARCHERY)) return 0; + if (enemy && Skill::Level::NONE != enemy->GetLevelSkill(Skill::SkillT::ARCHERY)) return 0; // attacker is castle owner if (attacker.GetColor() == castle->GetColor() && @@ -1153,7 +1153,7 @@ uint32_t Battle::Arena::GetObstaclesPenalty(const Unit& attacker, const Unit& de if (enemy) { - switch (enemy->GetLevelSkill(Skill::Secondary::ARCHERY)) + switch (enemy->GetLevelSkill(Skill::SkillT::ARCHERY)) { case Skill::Level::BASIC: if (result < 2) return 0; diff --git a/src/fheroes2/battle/battle_army.cpp b/src/fheroes2/battle/battle_army.cpp index 47ee56b..a91fb14 100644 --- a/src/fheroes2/battle/battle_army.cpp +++ b/src/fheroes2/battle/battle_army.cpp @@ -275,7 +275,7 @@ uint32_t Battle::Force::GetSurrenderCost() const if (commander) { - switch (commander->GetLevelSkill(Skill::Secondary::DIPLOMACY)) + switch (commander->GetLevelSkill(Skill::SkillT::DIPLOMACY)) { // 40% case Skill::Level::BASIC: diff --git a/src/fheroes2/battle/battle_catapult.cpp b/src/fheroes2/battle/battle_catapult.cpp index f0d7a55..92aa3f3 100644 --- a/src/fheroes2/battle/battle_catapult.cpp +++ b/src/fheroes2/battle/battle_catapult.cpp @@ -29,7 +29,7 @@ Battle::Catapult::Catapult(const HeroBase& hero, bool fortification) : cat_shots(1), cat_first(20), cat_miss(true) /*, cat_fort(fortification) */ { - switch (hero.GetLevelSkill(Skill::Secondary::BALLISTICS)) + switch (hero.GetLevelSkill(Skill::SkillT::BALLISTICS)) { case Skill::Level::BASIC: cat_first = 40; diff --git a/src/fheroes2/battle/battle_main.cpp b/src/fheroes2/battle/battle_main.cpp index 016f841..2e9964e 100644 --- a/src/fheroes2/battle/battle_main.cpp +++ b/src/fheroes2/battle/battle_main.cpp @@ -133,13 +133,13 @@ Battle::Result Battle::Loader(Army& army1, Army& army2, s32 mapsindex) // eagle eye capability if (hero_wins && hero_loss && - hero_wins->GetLevelSkill(Skill::Secondary::EAGLEEYE) && + hero_wins->GetLevelSkill(Skill::SkillT::EAGLEEYE) && hero_loss->isHeroes()) EagleEyeSkillAction(*hero_wins, arena.GetUsageSpells(), hero_wins->isControlHuman()); // necromancy capability if (hero_wins && - hero_wins->GetLevelSkill(Skill::Secondary::NECROMANCY)) + hero_wins->GetLevelSkill(Skill::SkillT::NECROMANCY)) NecromancySkillAction(*hero_wins, result.killed, hero_wins->isControlHuman()); @@ -197,7 +197,7 @@ void Battle::EagleEyeSkillAction(HeroBase& hero, const SpellStorage& spells, boo SpellStorage new_spells; new_spells._items.reserve(10); - const Skill::Secondary eagleeye(Skill::Secondary::EAGLEEYE, hero.GetLevelSkill(Skill::Secondary::EAGLEEYE)); + const Skill::Secondary eagleeye(Skill::SkillT::EAGLEEYE, hero.GetLevelSkill(Skill::SkillT::EAGLEEYE)); // filter spells for (auto sp : spells._items) @@ -257,7 +257,7 @@ void Battle::NecromancySkillAction(HeroBase& hero, uint32_t killed, bool local) // fix over 60% if (percent > 60) percent = 60; - percent += hero.GetSecondaryValues(Skill::Secondary::NECROMANCY); + percent += hero.GetSecondaryValues(Skill::SkillT::NECROMANCY); // hard fix overflow if (percent > 90) percent = 90; diff --git a/src/fheroes2/battle/battle_troop.cpp b/src/fheroes2/battle/battle_troop.cpp index 11d0f02..8020d41 100644 --- a/src/fheroes2/battle/battle_troop.cpp +++ b/src/fheroes2/battle/battle_troop.cpp @@ -838,7 +838,7 @@ uint32_t Battle::Unit::CalculateDamageUnit(const Unit& enemy, double dmg) const // check skill archery +%10, +%25, +%50 if (GetCommander()) { - dmg += dmg * GetCommander()->GetSecondaryValues(Skill::Secondary::ARCHERY) / 100; + dmg += dmg * GetCommander()->GetSecondaryValues(Skill::SkillT::ARCHERY) / 100; } // check castle defense diff --git a/src/fheroes2/castle/captain.cpp b/src/fheroes2/castle/captain.cpp index 81fdbc8..5d24879 100644 --- a/src/fheroes2/castle/captain.cpp +++ b/src/fheroes2/castle/captain.cpp @@ -113,12 +113,12 @@ int Captain::GetType() const return CAPTAIN; } -int Captain::GetLevelSkill(int) const +int Captain::GetLevelSkill(Skill::SkillT) const { return 0; } -uint32_t Captain::GetSecondaryValues(int) const +uint32_t Captain::GetSecondaryValues(Skill::SkillT) const { return 0; } diff --git a/src/fheroes2/castle/captain.h b/src/fheroes2/castle/captain.h index c56080f..61345c1 100644 --- a/src/fheroes2/castle/captain.h +++ b/src/fheroes2/castle/captain.h @@ -58,9 +58,9 @@ class Captain : public HeroBase const Castle* inCastle() const; - int GetLevelSkill(int) const; + int GetLevelSkill(Skill::SkillT) const override; - uint32_t GetSecondaryValues(int) const; + uint32_t GetSecondaryValues(Skill::SkillT) const; const Army& GetArmy() const; diff --git a/src/fheroes2/dialog/dialog.h b/src/fheroes2/dialog/dialog.h index 973ec8d..675fd23 100644 --- a/src/fheroes2/dialog/dialog.h +++ b/src/fheroes2/dialog/dialog.h @@ -24,6 +24,7 @@ #include #include "gamedefs.h" #include "sprites.h" +#include "skill.h" #define SHADOWWIDTH 16 #define BOXAREA_WIDTH 245 @@ -106,7 +107,7 @@ namespace Dialog void ExtSettings(bool); - int LevelUpSelectSkill(const std::string&, const std::string&, const Skill::Secondary&, const Skill::Secondary&, + Skill::SkillT LevelUpSelectSkill(const std::string&, const std::string&, const Skill::Secondary&, const Skill::Secondary&, Heroes&); bool SelectGoldOrExp(const std::string&, const std::string&, uint32_t gold, uint32_t expr, const Heroes&); diff --git a/src/fheroes2/dialog/dialog_levelup.cpp b/src/fheroes2/dialog/dialog_levelup.cpp index 88a36fa..7aca2d6 100644 --- a/src/fheroes2/dialog/dialog_levelup.cpp +++ b/src/fheroes2/dialog/dialog_levelup.cpp @@ -40,7 +40,7 @@ void DialogPrimaryOnly(const string& name, const string& primary) Message("", message, Font::BIG, Dialog::OK); } -int DialogOneSecondary(const string& name, const string& primary, const Skill::Secondary& sec) +Skill::SkillT DialogOneSecondary(const string& name, const string& primary, const Skill::Secondary& sec) { string message = _("%{name} has gained a level."); message.append("\n \n"); @@ -69,7 +69,7 @@ int DialogOneSecondary(const string& name, const string& primary, const Skill::S return sec.Skill(); } -int DialogSelectSecondary(const string& name, const string& primary, const Skill::Secondary& sec1, +Skill::SkillT DialogSelectSecondary(const string& name, const string& primary, const Skill::Secondary& sec1, const Skill::Secondary& sec2, Heroes& hero) { string header = _("%{name} has gained a level."); @@ -213,18 +213,18 @@ int DialogSelectSecondary(const string& name, const string& primary, const Skill } cursor.Hide(); - return Skill::Secondary::UNKNOWN; + return Skill::SkillT::UNKNOWN; } -int Dialog::LevelUpSelectSkill(const string& name, const string& primary, const Skill::Secondary& sec1, +Skill::SkillT Dialog::LevelUpSelectSkill(const string& name, const string& primary, const Skill::Secondary& sec1, const Skill::Secondary& sec2, Heroes& hero) { - int result = Skill::Secondary::UNKNOWN; + Skill::SkillT result = Skill::SkillT::UNKNOWN; - if (Skill::Secondary::UNKNOWN == sec1.Skill() && Skill::Secondary::UNKNOWN == sec2.Skill()) + if (Skill::SkillT::UNKNOWN == sec1.Skill() && Skill::SkillT::UNKNOWN == sec2.Skill()) DialogPrimaryOnly(name, primary); - else if (Skill::Secondary::UNKNOWN == sec1.Skill() || Skill::Secondary::UNKNOWN == sec2.Skill()) - result = DialogOneSecondary(name, primary, Skill::Secondary::UNKNOWN == sec2.Skill() ? sec1 : sec2); + else if (Skill::SkillT::UNKNOWN == sec1.Skill() || Skill::SkillT::UNKNOWN == sec2.Skill()) + result = DialogOneSecondary(name, primary, Skill::SkillT::UNKNOWN == sec2.Skill() ? sec1 : sec2); else result = DialogSelectSecondary(name, primary, sec1, sec2, hero); diff --git a/src/fheroes2/dialog/dialog_quickinfo.cpp b/src/fheroes2/dialog/dialog_quickinfo.cpp index aecd421..affc856 100644 --- a/src/fheroes2/dialog/dialog_quickinfo.cpp +++ b/src/fheroes2/dialog/dialog_quickinfo.cpp @@ -285,7 +285,7 @@ string ShowGroundInfo(const Maps::Tiles& tile, bool show, const Heroes* hero) if (!(dir != Direction::UNKNOWN)) return str; uint32_t cost = Maps::Ground::GetPenalty(tile.GetIndex(), Direction::Reflect(dir), - hero->GetLevelSkill(Skill::Secondary::PATHFINDING)); + hero->GetLevelSkill(Skill::SkillT::PATHFINDING)); if (cost) { str.append("\n"); @@ -675,7 +675,7 @@ void Dialog::QuickInfo(const Castle& castle) (castle.isFriends(conf.CurrentColor()) || // show guardians (scouting: advanced) from_hero && - Skill::Level::ADVANCED <= from_hero->GetSecondaryValues(Skill::Secondary::SCOUTING))) + Skill::Level::ADVANCED <= from_hero->GetSecondaryValues(Skill::SkillT::SCOUTING))) { // heroes name text.Set(guardian->GetName(), Font::SMALL); @@ -708,7 +708,7 @@ void Dialog::QuickInfo(const Castle& castle) // show limited Army::DrawMons32LineWithScoute(castle.GetArmy().m_troops, cur_rt.x - 5, cur_rt.y + 100, 192, 0, 0, from_hero && from_hero->CanScouteTile(castle.GetIndex()) - ? from_hero->GetSecondaryValues(Skill::Secondary::SCOUTING) + ? from_hero->GetSecondaryValues(Skill::SkillT::SCOUTING) : Skill::Level::NONE); cursor.Show(); @@ -940,7 +940,7 @@ void Dialog::QuickInfo(const Heroes& hero) // show limited Army::DrawMons32LineWithScoute(hero.GetArmy().m_troops, cur_rt.x - 5, cur_rt.y + 114, 160, 0, 0, from_hero && from_hero->CanScouteTile(hero.GetIndex()) - ? from_hero->GetSecondaryValues(Skill::Secondary::SCOUTING) + ? from_hero->GetSecondaryValues(Skill::SkillT::SCOUTING) : Skill::Level::NONE); cursor.Show(); diff --git a/src/fheroes2/dialog/dialog_selectitems.cpp b/src/fheroes2/dialog/dialog_selectitems.cpp index ed97f97..ff89300 100644 --- a/src/fheroes2/dialog/dialog_selectitems.cpp +++ b/src/fheroes2/dialog/dialog_selectitems.cpp @@ -207,7 +207,7 @@ class SelectEnumSecSkill : public SelectEnum void RedrawItem(const int& index, s32 dstx, s32 dsty, bool current) { - Skill::Secondary skill(1 + index / 3, 1 + index % 3); + Skill::Secondary skill(static_cast < Skill::SkillT>(1 + index / 3), 1 + index % 3); AGG::GetICN(ICN::MINISS, skill.GetIndexSprite2()).Blit(dstx + 5, dsty + 3); string str = skill.GetName(); Text text(str, (current ? Font::YELLOW_BIG : Font::BIG)); @@ -269,7 +269,7 @@ Skill::Secondary Dialog::SelectSecondarySkill() if (result == OK || listbox.ok) { - skill.SetSkill(1 + listbox.GetCurrent() / 3); + skill.SetSkill(static_cast(1 + listbox.GetCurrent() / 3)); skill.SetLevel(1 + listbox.GetCurrent() % 3); } diff --git a/src/fheroes2/game/game_static.cpp b/src/fheroes2/game/game_static.cpp index e07e408..793ca4a 100644 --- a/src/fheroes2/game/game_static.cpp +++ b/src/fheroes2/game/game_static.cpp @@ -460,37 +460,37 @@ const Skill::stats_t* GameStatic::GetSkillStats(int race) return nullptr; } -const Skill::values_t* GameStatic::GetSkillValues(int type) +const Skill::values_t* GameStatic::GetSkillValues(Skill::SkillT type) { switch (type) { - case Skill::Secondary::PATHFINDING: + case Skill::SkillT::PATHFINDING: return &Skill::_values[0]; - case Skill::Secondary::ARCHERY: + case Skill::SkillT::ARCHERY: return &Skill::_values[1]; - case Skill::Secondary::LOGISTICS: + case Skill::SkillT::LOGISTICS: return &Skill::_values[2]; - case Skill::Secondary::SCOUTING: + case Skill::SkillT::SCOUTING: return &Skill::_values[3]; - case Skill::Secondary::DIPLOMACY: + case Skill::SkillT::DIPLOMACY: return &Skill::_values[4]; - case Skill::Secondary::NAVIGATION: + case Skill::SkillT::NAVIGATION: return &Skill::_values[5]; - case Skill::Secondary::LEADERSHIP: + case Skill::SkillT::LEADERSHIP: return &Skill::_values[6]; - case Skill::Secondary::WISDOM: + case Skill::SkillT::WISDOM: return &Skill::_values[7]; - case Skill::Secondary::MYSTICISM: + case Skill::SkillT::MYSTICISM: return &Skill::_values[8]; - case Skill::Secondary::LUCK: + case Skill::SkillT::LUCK: return &Skill::_values[9]; - case Skill::Secondary::BALLISTICS: + case Skill::SkillT::BALLISTICS: return &Skill::_values[10]; - case Skill::Secondary::EAGLEEYE: + case Skill::SkillT::EAGLEEYE: return &Skill::_values[11]; - case Skill::Secondary::NECROMANCY: + case Skill::SkillT::NECROMANCY: return &Skill::_values[12]; - case Skill::Secondary::ESTATES: + case Skill::SkillT::ESTATES: return &Skill::_values[13]; default: break; diff --git a/src/fheroes2/game/game_static.h b/src/fheroes2/game/game_static.h index ec087f8..e4ec74a 100644 --- a/src/fheroes2/game/game_static.h +++ b/src/fheroes2/game/game_static.h @@ -75,7 +75,7 @@ namespace GameStatic const Skill::stats_t* GetSkillStats(int race); - const Skill::values_t* GetSkillValues(int skill); + const Skill::values_t* GetSkillValues(Skill::SkillT skill); const Skill::secondary_t* GetSkillForWitchsHut(); diff --git a/src/fheroes2/gui/interface_gamearea.cpp b/src/fheroes2/gui/interface_gamearea.cpp index 7c393a6..4c21569 100644 --- a/src/fheroes2/gui/interface_gamearea.cpp +++ b/src/fheroes2/gui/interface_gamearea.cpp @@ -174,8 +174,7 @@ void Interface::GameArea::DrawHeroRoute(Surface& dst, int flag, const Rect& rt) : Route::Path::GetIndexSprite((*it1).GetDirection(), (*it3).GetDirection(), Maps::Ground::GetPenalty(from, Direction::CENTER, hero->GetLevelSkill( - Skill::Secondary:: - PATHFINDING))); + Skill::SkillT::PATHFINDING))); Sprite sprite = AGG::GetICN(0 > green ? ICN::ROUTERED : ICN::ROUTE, index); sprite.SetAlphaMod(180); diff --git a/src/fheroes2/heroes/direction.h b/src/fheroes2/heroes/direction.h index b809afd..7f1fa5c 100644 --- a/src/fheroes2/heroes/direction.h +++ b/src/fheroes2/heroes/direction.h @@ -26,7 +26,8 @@ #include #include -#include "gamedefs.h" +#include "engine.h" + typedef std::vector Directions; diff --git a/src/fheroes2/heroes/heroes.cpp b/src/fheroes2/heroes/heroes.cpp index a856050..183695d 100644 --- a/src/fheroes2/heroes/heroes.cpp +++ b/src/fheroes2/heroes/heroes.cpp @@ -127,9 +127,9 @@ Heroes::Heroes(int heroid, int rc) : knowledge = 5; secondary_skills = Skill::SecSkills(); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::WISDOM, Skill::Level::ADVANCED)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::LEADERSHIP, Skill::Level::EXPERT)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::ARCHERY, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::WISDOM, Skill::Level::ADVANCED)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::LEADERSHIP, Skill::Level::EXPERT)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::ARCHERY, Skill::Level::BASIC)); break; case CORLAGON: @@ -139,11 +139,11 @@ Heroes::Heroes(int heroid, int rc) : knowledge = 1; secondary_skills = Skill::SecSkills(); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::NECROMANCY, Skill::Level::EXPERT)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::BALLISTICS, Skill::Level::BASIC)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::WISDOM, Skill::Level::BASIC)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::LEADERSHIP, Skill::Level::BASIC)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::PATHFINDING, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::NECROMANCY, Skill::Level::EXPERT)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::BALLISTICS, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::WISDOM, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::LEADERSHIP, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::PATHFINDING, Skill::Level::BASIC)); break; case ELIZA: @@ -153,10 +153,10 @@ Heroes::Heroes(int heroid, int rc) : knowledge = 6; secondary_skills = Skill::SecSkills(); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::NAVIGATION, Skill::Level::ADVANCED)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::WISDOM, Skill::Level::EXPERT)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::ARCHERY, Skill::Level::BASIC)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::LUCK, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::NAVIGATION, Skill::Level::ADVANCED)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::WISDOM, Skill::Level::EXPERT)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::ARCHERY, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::LUCK, Skill::Level::BASIC)); break; case ARCHIBALD: @@ -166,9 +166,9 @@ Heroes::Heroes(int heroid, int rc) : knowledge = 4; secondary_skills = Skill::SecSkills(); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::SCOUTING, Skill::Level::EXPERT)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::LEADERSHIP, Skill::Level::EXPERT)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::WISDOM, Skill::Level::ADVANCED)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::SCOUTING, Skill::Level::EXPERT)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::LEADERSHIP, Skill::Level::EXPERT)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::WISDOM, Skill::Level::ADVANCED)); break; case HALTON: @@ -178,9 +178,9 @@ Heroes::Heroes(int heroid, int rc) : knowledge = 2; secondary_skills = Skill::SecSkills(); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::BALLISTICS, Skill::Level::BASIC)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::LEADERSHIP, Skill::Level::ADVANCED)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::DIPLOMACY, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::BALLISTICS, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::LEADERSHIP, Skill::Level::ADVANCED)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::DIPLOMACY, Skill::Level::BASIC)); break; case BAX: @@ -190,42 +190,42 @@ Heroes::Heroes(int heroid, int rc) : knowledge = 3; secondary_skills = Skill::SecSkills(); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::WISDOM, Skill::Level::EXPERT)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::NECROMANCY, Skill::Level::BASIC)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::NAVIGATION, Skill::Level::BASIC)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::PATHFINDING, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::WISDOM, Skill::Level::EXPERT)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::NECROMANCY, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::NAVIGATION, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::PATHFINDING, Skill::Level::BASIC)); break; case SOLMYR: case DRAKONIA: secondary_skills = Skill::SecSkills(); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::WISDOM, Skill::Level::ADVANCED)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::LEADERSHIP, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::WISDOM, Skill::Level::ADVANCED)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::LEADERSHIP, Skill::Level::BASIC)); break; case DAINWIN: case ELDERIAN: secondary_skills = Skill::SecSkills(); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::WISDOM, Skill::Level::ADVANCED)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::SCOUTING, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::WISDOM, Skill::Level::ADVANCED)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::SCOUTING, Skill::Level::BASIC)); break; case MOG: secondary_skills = Skill::SecSkills(); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::WISDOM, Skill::Level::BASIC)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::NECROMANCY, Skill::Level::ADVANCED)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::WISDOM, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::NECROMANCY, Skill::Level::ADVANCED)); break; case UNCLEIVAN: secondary_skills = Skill::SecSkills(); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::PATHFINDING, Skill::Level::ADVANCED)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::LEADERSHIP, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::PATHFINDING, Skill::Level::ADVANCED)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::LEADERSHIP, Skill::Level::BASIC)); break; case JOSEPH: secondary_skills = Skill::SecSkills(); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::LEADERSHIP, Skill::Level::BASIC)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::SCOUTING, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::LEADERSHIP, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::SCOUTING, Skill::Level::BASIC)); break; case GALLAVANT: @@ -246,10 +246,10 @@ Heroes::Heroes(int heroid, int rc) : army.m_troops.JoinTroop(Monster::RED_DRAGON, 3); secondary_skills = Skill::SecSkills(); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::PATHFINDING, Skill::Level::ADVANCED)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::LOGISTICS, Skill::Level::ADVANCED)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::SCOUTING, Skill::Level::BASIC)); - secondary_skills.AddSkill(Skill::Secondary(Skill::Secondary::MYSTICISM, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::PATHFINDING, Skill::Level::ADVANCED)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::LOGISTICS, Skill::Level::ADVANCED)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::SCOUTING, Skill::Level::BASIC)); + secondary_skills.AddSkill(Skill::Secondary(Skill::SkillT::MYSTICISM, Skill::Level::BASIC)); PickupArtifact(Artifact::STEALTH_SHIELD); PickupArtifact(Artifact::DRAGON_SWORD); @@ -345,7 +345,7 @@ void Heroes::LoadFromMP2(s32 map_index, int cl, int rc, ByteVectorReader& st) vector secs(8); for (auto& sec : secs) - sec.SetSkill(st.get() + 1); + sec.SetSkill((Skill::SkillT)(st.get() + 1)); for (auto& sec : secs) sec.SetLevel(st.get()); @@ -571,7 +571,7 @@ uint32_t Heroes::GetMaxMovePoints() const point = 1500; // skill navigation - point += point * GetSecondaryValues(Skill::Secondary::NAVIGATION) / 100; + point += point * GetSecondaryValues(Skill::SkillT::NAVIGATION) / 100; // artifact bonus acount = HasArtifact(Artifact::SAILORS_ASTROLABE_MOBILITY); @@ -613,7 +613,7 @@ uint32_t Heroes::GetMaxMovePoints() const } // skill logistics - point += point * GetSecondaryValues(Skill::Secondary::LOGISTICS) / 100; + point += point * GetSecondaryValues(Skill::SkillT::LOGISTICS) / 100; // artifact bonus acount = HasArtifact(Artifact::NOMAD_BOOTS_MOBILITY); @@ -647,7 +647,7 @@ int Heroes::GetMoraleWithModificators(string* strs) const if (army.m_troops.AllTroopsIsRace(Race::NECR)) return Morale::NORMAL; // bonus leadership - result += Skill::GetLeadershipModifiers(GetLevelSkill(Skill::Secondary::LEADERSHIP), strs); + result += Skill::GetLeadershipModifiers(GetLevelSkill(Skill::SkillT::LEADERSHIP), strs); // object visited const u8 objs[] = { @@ -680,7 +680,7 @@ int Heroes::GetLuckWithModificators(string* strs) const result += GetLuckModificator(strs); // bonus luck - result += Skill::GetLuckModifiers(GetLevelSkill(Skill::Secondary::LUCK), strs); + result += Skill::GetLuckModifiers(GetLevelSkill(Skill::SkillT::LUCK), strs); // object visited const u8 objs[] = {MP2::OBJ_MERMAID, MP2::OBJ_FAERIERING, MP2::OBJ_FOUNTAIN, MP2::OBJ_IDOL, MP2::OBJ_PYRAMID}; @@ -782,7 +782,7 @@ void Heroes::ActionNewDay() curr += acount * Artifact(Artifact::POWER_RING).ExtraValue(); // secondary skill - curr += GetSecondaryValues(Skill::Secondary::MYSTICISM); + curr += GetSecondaryValues(Skill::SkillT::MYSTICISM); SetSpellPoints(curr > maxp ? maxp : curr); } @@ -1182,7 +1182,7 @@ bool Heroes::isEnableMove() const bool Heroes::CanMove() const { return move_point >= - Maps::Ground::GetPenalty(GetIndex(), Direction::CENTER, GetLevelSkill(Skill::Secondary::PATHFINDING)); + Maps::Ground::GetPenalty(GetIndex(), Direction::CENTER, GetLevelSkill(Skill::SkillT::PATHFINDING)); } /* set enable move */ @@ -1238,12 +1238,12 @@ Skill::SecSkills& Heroes::GetSecondarySkills() return secondary_skills; } -bool Heroes::HasSecondarySkill(int skill) const +bool Heroes::HasSecondarySkill(Skill::SkillT skill) const { return Skill::Level::NONE != secondary_skills.GetLevel(skill); } -uint32_t Heroes::GetSecondaryValues(int skill) const +uint32_t Heroes::GetSecondaryValues(Skill::SkillT skill) const { return secondary_skills.GetValues(skill); } @@ -1253,7 +1253,7 @@ bool Heroes::HasMaxSecondarySkill() const return HEROESMAXSKILL <= secondary_skills.Count(); } -int Heroes::GetLevelSkill(int skill) const +int Heroes::GetLevelSkill(Skill::SkillT skill) const { return secondary_skills.GetLevel(skill); } @@ -1274,7 +1274,7 @@ int Heroes::GetScoute() const int acount = HasArtifact(Artifact::TELESCOPE); return (acount ? acount * GetViewDistance(Game::VIEW_TELESCOPE) : 0) + - GetViewDistance(Game::VIEW_HEROES) + GetSecondaryValues(Skill::Secondary::SCOUTING); + GetViewDistance(Game::VIEW_HEROES) + GetSecondaryValues(Skill::SkillT::SCOUTING); } uint32_t Heroes::GetVisionsDistance() const @@ -1350,30 +1350,28 @@ void Heroes::LevelUpSecondarySkill(int primary, bool autoselect) if (autoselect) { - if (Skill::Secondary::UNKNOWN == sec1.Skill() || Skill::Secondary::UNKNOWN == sec2.Skill()) + if (Skill::SkillT::UNKNOWN == sec1.Skill() || Skill::SkillT::UNKNOWN == sec2.Skill()) { - if (Skill::Secondary::UNKNOWN != sec1.Skill()) + if (Skill::SkillT::UNKNOWN != sec1.Skill()) selected = &sec1; - else if (Skill::Secondary::UNKNOWN != sec2.Skill()) + else if (Skill::SkillT::UNKNOWN != sec2.Skill()) selected = &sec2; } - else if (Skill::Secondary::UNKNOWN != sec1.Skill() && Skill::Secondary::UNKNOWN != sec2.Skill()) + else if (Skill::SkillT::UNKNOWN != sec1.Skill() && Skill::SkillT::UNKNOWN != sec2.Skill()) selected = Rand::Get(0, 1) ? &sec1 : &sec2; } else { AGG::PlaySound(M82::NWHEROLV); - int result = Dialog::LevelUpSelectSkill(name, Primary::String(primary), sec1, sec2, *this); + Skill::SkillT result = Dialog::LevelUpSelectSkill(name, Primary::String(primary), sec1, sec2, *this); - if (Skill::Secondary::UNKNOWN != result) + if (Skill::SkillT::UNKNOWN != result) selected = result == sec2.Skill() ? &sec2 : &sec1; } // level up sec. skill if (selected) { - vector::iterator it; - Skill::Secondary* secs = secondary_skills.FindSkill(selected->Skill()); if (secs) @@ -1384,7 +1382,7 @@ void Heroes::LevelUpSecondarySkill(int primary, bool autoselect) // post action switch (selected->Skill()) { - case Skill::Secondary::SCOUTING: + case Skill::SkillT::SCOUTING: Scoute(); break; @@ -1400,7 +1398,7 @@ bool Heroes::ApplyPenaltyMovement() uint32_t penalty = path.isValid() ? path.GetFrontPenalty() : Maps::Ground::GetPenalty(GetIndex(), Direction::CENTER, - GetLevelSkill(Skill::Secondary::PATHFINDING)); + GetLevelSkill(Skill::SkillT::PATHFINDING)); if (move_point >= penalty) move_point -= penalty; else return false; @@ -1584,7 +1582,7 @@ int Heroes::GetSquarePatrol() const int Heroes::CanScouteTile(s32 dst) const { - int scouting = GetSecondaryValues(Skill::Secondary::SCOUTING); + int scouting = GetSecondaryValues(Skill::SkillT::SCOUTING); bool army_info = false; switch (world.GetTiles(dst).GetObject()) @@ -1618,7 +1616,7 @@ int Heroes::CanScouteTile(s32 dst) const { //const Maps::Tiles & tile = world.GetTiles(dst); - uint32_t dist = GetSecondaryValues(Skill::Secondary::SCOUTING) ? GetScoute() : 0; + uint32_t dist = GetSecondaryValues(Skill::SkillT::SCOUTING) ? GetScoute() : 0; if (Modes(VISIONS) && dist < GetVisionsDistance()) dist = GetVisionsDistance(); if (dist > Maps::GetApproximateDistance(GetIndex(), dst)) diff --git a/src/fheroes2/heroes/heroes.h b/src/fheroes2/heroes/heroes.h index 929c789..084ab10 100644 --- a/src/fheroes2/heroes/heroes.h +++ b/src/fheroes2/heroes/heroes.h @@ -251,13 +251,13 @@ class Heroes : public HeroBase, public ColorBase void RecalculateMovePoints(); - bool HasSecondarySkill(int) const; + bool HasSecondarySkill(Skill::SkillT) const; bool HasMaxSecondarySkill() const; - int GetLevelSkill(int) const; + int GetLevelSkill(Skill::SkillT) const; - uint32_t GetSecondaryValues(int) const; + uint32_t GetSecondaryValues(Skill::SkillT) const; void LearnSkill(const Skill::Secondary&); diff --git a/src/fheroes2/heroes/heroes_action.cpp b/src/fheroes2/heroes/heroes_action.cpp index febfe20..dfd0fda 100644 --- a/src/fheroes2/heroes/heroes_action.cpp +++ b/src/fheroes2/heroes/heroes_action.cpp @@ -1423,7 +1423,7 @@ void ActionToShrine(Heroes& hero, uint32_t obj, s32 dst_index) if (hero.HaveSpellBook()) { // check valid level spell and wisdom skill - if (3 == spell_level && Skill::Level::NONE == hero.GetLevelSkill(Skill::Secondary::WISDOM)) + if (3 == spell_level && Skill::Level::NONE == hero.GetLevelSkill(Skill::SkillT::WISDOM)) { PlaySoundFailure; body += _( @@ -1595,7 +1595,7 @@ void ActionToPoorLuckObject(Heroes& hero, uint32_t obj, s32 dst_index) msg = _("Unfortunately, you have no Magic Book to record the spell with."); else // check skill level for wisdom - if (Skill::Level::EXPERT > hero.GetLevelSkill(Skill::Secondary::WISDOM)) + if (Skill::Level::EXPERT > hero.GetLevelSkill(Skill::SkillT::WISDOM)) msg = _( "Unfortunately, you do not have the wisdom to understand the spell, and you are unable to learn it." ); @@ -2082,11 +2082,11 @@ void ActionToArtifact(Heroes& hero, uint32_t obj, s32 dst_index) { PlaySoundFailure; - if (skill.Skill() == Skill::Secondary::WISDOM) + if (skill.Skill() == Skill::SkillT::WISDOM) msg = _( "You've found the humble dwelling of a withered hermit. The hermit tells you that he is willing to give the %{art} to the first wise person he meets." ); - else if (skill.Skill() == Skill::Secondary::LEADERSHIP) + else if (skill.Skill() == Skill::SkillT::LEADERSHIP) msg = _( "You've come across the spartan quarters of a retired soldier. The soldier tells you that he is willing to pass on the %{art} to the first true leader he meets." ); @@ -2849,7 +2849,7 @@ void ActionToXanadu(Heroes& hero, uint32_t obj, s32 dst_index) else { bool access = false; - switch (hero.GetLevelSkill(Skill::Secondary::DIPLOMACY)) + switch (hero.GetLevelSkill(Skill::SkillT::DIPLOMACY)) { case Skill::Level::BASIC: if (7 < hero.GetLevel()) access = true; diff --git a/src/fheroes2/heroes/heroes_base.cpp b/src/fheroes2/heroes/heroes_base.cpp index 136d485..42ff141 100644 --- a/src/fheroes2/heroes/heroes_base.cpp +++ b/src/fheroes2/heroes/heroes_base.cpp @@ -473,7 +473,7 @@ bool HeroBase::CanTranscribeScroll(const Artifact& art) const if (spell.isValid() && CanCastSpell(spell)) { - int learning = GetLevelSkill(Skill::Secondary::LEARNING); + int learning = GetLevelSkill(Skill::SkillT::LEARNING); return 3 < spell.Level() && Skill::Level::EXPERT == learning || 3 == spell.Level() && Skill::Level::ADVANCED <= learning || @@ -485,7 +485,7 @@ bool HeroBase::CanTranscribeScroll(const Artifact& art) const bool HeroBase::CanTeachSpell(const Spell& spell) const { - int learning = GetLevelSkill(Skill::Secondary::LEARNING); + int learning = GetLevelSkill(Skill::SkillT::LEARNING); return 4 == spell.Level() && Skill::Level::EXPERT == learning || 3 == spell.Level() && Skill::Level::ADVANCED <= learning || @@ -494,7 +494,7 @@ bool HeroBase::CanTeachSpell(const Spell& spell) const bool HeroBase::CanLearnSpell(const Spell& spell) const { - int wisdom = GetLevelSkill(Skill::Secondary::WISDOM); + int wisdom = GetLevelSkill(Skill::SkillT::WISDOM); return 4 < spell.Level() && Skill::Level::EXPERT == wisdom || 4 == spell.Level() && Skill::Level::ADVANCED <= wisdom || diff --git a/src/fheroes2/heroes/heroes_base.h b/src/fheroes2/heroes/heroes_base.h index 494a9ec..ca08785 100644 --- a/src/fheroes2/heroes/heroes_base.h +++ b/src/fheroes2/heroes/heroes_base.h @@ -82,9 +82,9 @@ class HeroBase : public Skill::Primary, public MapPosition, public BitModes, pub virtual uint32_t GetMaxSpellPoints() const = 0; - virtual int GetLevelSkill(int skill) const = 0; + virtual int GetLevelSkill(Skill::SkillT skill) const = 0; - virtual uint32_t GetSecondaryValues(int skill) const = 0; + virtual uint32_t GetSecondaryValues(Skill::SkillT skill) const = 0; virtual void ActionAfterBattle() = 0; diff --git a/src/fheroes2/heroes/heroes_meeting.cpp b/src/fheroes2/heroes/heroes_meeting.cpp index 920db60..96aec1d 100644 --- a/src/fheroes2/heroes/heroes_meeting.cpp +++ b/src/fheroes2/heroes/heroes_meeting.cpp @@ -318,8 +318,8 @@ void Heroes::ScholarAction(Heroes& hero1, Heroes& hero2) return; } - const int scholar1 = hero1.GetLevelSkill(Skill::Secondary::EAGLEEYE); - const int scholar2 = hero2.GetLevelSkill(Skill::Secondary::EAGLEEYE); + const int scholar1 = hero1.GetLevelSkill(Skill::SkillT::EAGLEEYE); + const int scholar2 = hero2.GetLevelSkill(Skill::SkillT::EAGLEEYE); int scholar = 0; Heroes* teacher = nullptr; @@ -425,7 +425,7 @@ void Heroes::ScholarAction(Heroes& hero1, Heroes& hero2) StringReplace(message, "%{teacher}", teacher->GetName()); StringReplace(message, "%{learner}", learner->GetName()); StringReplace(message, "%{level}", Skill::Level::String(scholar)); - StringReplace(message, "%{scholar}", Skill::Secondary::String(Skill::Secondary::EAGLEEYE)); + StringReplace(message, "%{scholar}", Skill::Secondary::String(Skill::SkillT::EAGLEEYE)); StringReplace(message, "%{spells1}", spells1); StringReplace(message, "%{spells2}", spells2); diff --git a/src/fheroes2/heroes/heroes_spell.cpp b/src/fheroes2/heroes/heroes_spell.cpp index 23d4549..90d94ea 100644 --- a/src/fheroes2/heroes/heroes_spell.cpp +++ b/src/fheroes2/heroes/heroes_spell.cpp @@ -306,7 +306,7 @@ bool ActionSpellSummonBoat(Heroes& hero) { uint32_t chance = 0; - switch (hero.GetLevelSkill(Skill::Secondary::WISDOM)) + switch (hero.GetLevelSkill(Skill::SkillT::WISDOM)) { case Skill::Level::BASIC: chance = 50; diff --git a/src/fheroes2/heroes/route_pathfind.cpp b/src/fheroes2/heroes/route_pathfind.cpp index 82c22f9..cccc60e 100644 --- a/src/fheroes2/heroes/route_pathfind.cpp +++ b/src/fheroes2/heroes/route_pathfind.cpp @@ -315,7 +315,7 @@ namespace bool Route::Path::Find(s32 to, int limit) { - const int pathfinding = hero->GetLevelSkill(Skill::Secondary::PATHFINDING); + const int pathfinding = hero->GetLevelSkill(Skill::SkillT::PATHFINDING); const s32 from = hero->GetIndex(); s32 cur = from; diff --git a/src/fheroes2/heroes/skill.cpp b/src/fheroes2/heroes/skill.cpp index 515d60d..ec9aba6 100644 --- a/src/fheroes2/heroes/skill.cpp +++ b/src/fheroes2/heroes/skill.cpp @@ -41,16 +41,16 @@ namespace Skill { - int SecondaryGetWeightSkillFromRace(int race, int skill); + int SecondaryGetWeightSkillFromRace(int race, SkillT skill); - int SecondaryPriorityFromRace(int, const vector&); + SkillT SecondaryPriorityFromRace(int, const vector&); - const int secskills[] = { - Secondary::PATHFINDING, Secondary::ARCHERY, Secondary::LOGISTICS, Secondary::SCOUTING, - Secondary::DIPLOMACY, Secondary::NAVIGATION, Secondary::LEADERSHIP, Secondary::WISDOM, - Secondary::MYSTICISM, - Secondary::LUCK, Secondary::BALLISTICS, Secondary::EAGLEEYE, Secondary::NECROMANCY, - Secondary::ESTATES + const SkillT secskills[] = { + SkillT::PATHFINDING, SkillT::ARCHERY, SkillT::LOGISTICS, SkillT::SCOUTING, + SkillT::DIPLOMACY, SkillT::NAVIGATION, SkillT::LEADERSHIP, SkillT::WISDOM, + SkillT::MYSTICISM, + SkillT::LUCK, SkillT::BALLISTICS, SkillT::EAGLEEYE, SkillT::NECROMANCY, + SkillT::ESTATES }; } @@ -262,11 +262,11 @@ std::string Skill::Level::String(int level) return str_level[0]; } -Skill::Secondary::Secondary() : pair(UNKNOWN, Level::NONE) +Skill::Secondary::Secondary() : pair(SkillT::UNKNOWN, Level::NONE) { } -Skill::Secondary::Secondary(int skill, int level) : pair(UNKNOWN, Level::NONE) +Skill::Secondary::Secondary(SkillT skill, int level) : pair(SkillT::UNKNOWN, Level::NONE) { SetSkill(skill); SetLevel(level); @@ -274,7 +274,7 @@ Skill::Secondary::Secondary(int skill, int level) : pair(UNKNOWN, Leve void Skill::Secondary::Reset() { - first = UNKNOWN; + first = SkillT::UNKNOWN; second = Level::NONE; } @@ -284,9 +284,9 @@ void Skill::Secondary::Set(const Secondary& skill) second = skill.second; } -void Skill::Secondary::SetSkill(int skill) +void Skill::Secondary::SetSkill(SkillT skill) { - first = skill <= ESTATES ? skill : UNKNOWN; + first = skill <= SkillT::ESTATES ? skill : SkillT::UNKNOWN; } void Skill::Secondary::SetLevel(int level) @@ -312,7 +312,7 @@ void Skill::Secondary::NextLevel() } } -int Skill::Secondary::Skill() const +Skill::SkillT Skill::Secondary::Skill() const { return first; } @@ -327,57 +327,57 @@ bool Skill::Secondary::isLevel(int level) const return level == second; } -bool Skill::Secondary::isSkill(int skill) const +bool Skill::Secondary::isSkill(SkillT skill) const { return skill == first; } bool Skill::Secondary::isValid() const { - return Skill() != UNKNOWN && Level() != Level::NONE; + return Skill() != SkillT::UNKNOWN && Level() != Level::NONE; } -int Skill::Secondary::RandForWitchsHut() +Skill::SkillT Skill::Secondary::RandForWitchsHut() { const secondary_t* sec = GameStatic::GetSkillForWitchsHut(); - vector v; + vector v; if (sec) { v.reserve(14); - if (sec->archery) v.push_back(ARCHERY); - if (sec->ballistics) v.push_back(BALLISTICS); - if (sec->diplomacy) v.push_back(DIPLOMACY); - if (sec->eagleeye) v.push_back(EAGLEEYE); - if (sec->estates) v.push_back(ESTATES); - if (sec->leadership) v.push_back(LEADERSHIP); - if (sec->logistics) v.push_back(LOGISTICS); - if (sec->luck) v.push_back(LUCK); - if (sec->mysticism) v.push_back(MYSTICISM); - if (sec->navigation) v.push_back(NAVIGATION); - if (sec->necromancy) v.push_back(NECROMANCY); - if (sec->pathfinding) v.push_back(PATHFINDING); - if (sec->scouting) v.push_back(SCOUTING); - if (sec->wisdom) v.push_back(WISDOM); + if (sec->archery) v.push_back(SkillT::ARCHERY); + if (sec->ballistics) v.push_back(SkillT::BALLISTICS); + if (sec->diplomacy) v.push_back(SkillT::DIPLOMACY); + if (sec->eagleeye) v.push_back(SkillT::EAGLEEYE); + if (sec->estates) v.push_back(SkillT::ESTATES); + if (sec->leadership) v.push_back(SkillT::LEADERSHIP); + if (sec->logistics) v.push_back(SkillT::LOGISTICS); + if (sec->luck) v.push_back(SkillT::LUCK); + if (sec->mysticism) v.push_back(SkillT::MYSTICISM); + if (sec->navigation) v.push_back(SkillT::NAVIGATION); + if (sec->necromancy) v.push_back(SkillT::NECROMANCY); + if (sec->pathfinding) v.push_back(SkillT::PATHFINDING); + if (sec->scouting) v.push_back(SkillT::SCOUTING); + if (sec->wisdom) v.push_back(SkillT::WISDOM); } - return v.empty() ? UNKNOWN : *Rand::Get(v); + return v.empty() ? SkillT::UNKNOWN : *Rand::Get(v); } /* index sprite from SECSKILL */ int Skill::Secondary::GetIndexSprite1() const { - return Skill() <= ESTATES ? Skill() : 0; + return Skill() <= SkillT::ESTATES ? (int)Skill() : 0; } /* index sprite from MINISS */ int Skill::Secondary::GetIndexSprite2() const { - return Skill() <= ESTATES ? Skill() - 1 : 0xFF; + return Skill() <= SkillT::ESTATES ? (int)Skill() - 1 : 0xFF; } -std::string Skill::Secondary::String(int skill) +std::string Skill::Secondary::String(Skill::SkillT skill) { std::string str_skill[] = { _("Pathfinding"), _("Archery"), _("Logistics"), _("Scouting"), _("Diplomacy"), @@ -388,33 +388,33 @@ std::string Skill::Secondary::String(int skill) switch (skill) { - case PATHFINDING: + case SkillT::PATHFINDING: return str_skill[0]; - case ARCHERY: + case SkillT::ARCHERY: return str_skill[1]; - case LOGISTICS: + case SkillT::LOGISTICS: return str_skill[2]; - case SCOUTING: + case SkillT::SCOUTING: return str_skill[3]; - case DIPLOMACY: + case SkillT::DIPLOMACY: return str_skill[4]; - case NAVIGATION: + case SkillT::NAVIGATION: return str_skill[5]; - case LEADERSHIP: + case SkillT::LEADERSHIP: return str_skill[6]; - case WISDOM: + case SkillT::WISDOM: return str_skill[7]; - case MYSTICISM: + case SkillT::MYSTICISM: return str_skill[8]; - case LUCK: + case SkillT::LUCK: return str_skill[9]; - case BALLISTICS: + case SkillT::BALLISTICS: return str_skill[10]; - case EAGLEEYE: + case SkillT::EAGLEEYE: return str_skill[11]; - case NECROMANCY: + case SkillT::NECROMANCY: return str_skill[12]; - case ESTATES: + case SkillT::ESTATES: return str_skill[13]; default: @@ -444,7 +444,7 @@ std::string Skill::Secondary::GetName() const _("Basic Estates"), _("Advanced Estates"), _("Expert Estates") }; - return isValid() ? name_skill[Level() - 1 + (Skill() - 1) * 3] : "unknown"; + return isValid() ? name_skill[Level() - 1 + ((int)Skill() - 1) * 3] : "unknown"; } string Skill::Secondary::GetDescription() const @@ -454,37 +454,37 @@ string Skill::Secondary::GetDescription() const switch (Skill()) { - case PATHFINDING: + case SkillT::PATHFINDING: str = _n("Reduces the movement penalty for rough terrain by %{count} percent.", "Reduces the movement penalty for rough terrain by %{count} percent.", count); break; - case ARCHERY: + case SkillT::ARCHERY: str = _n("Increases the damage done by range attacking creatures by %{count} percent.", "Increases the damage done by range attacking creatures by %{count} percent.", count); break; - case LOGISTICS: + case SkillT::LOGISTICS: str = _n("Increases your hero's movement points by %{count} percent.", "Increases your hero's movement points by %{count} percent.", count); break; - case SCOUTING: + case SkillT::SCOUTING: str = _n("Increases your hero's viewable area by %{count} square.", "Increases your hero's viewable area by %{count} squares.", count); break; - case DIPLOMACY: + case SkillT::DIPLOMACY: str = _("Allows you to negotiate with monsters who are weaker than your group."); str.append(" "); str.append(_n("Approximately %{count} percent of the creatures may offer to join you.", "Approximately %{count} percent of the creatures may offer to join you.", count)); break; - case NAVIGATION: + case SkillT::NAVIGATION: str = _n("Increases your hero's movement points over water by %{count} percent.", "Increases your hero's movement points over water by %{count} percent.", count); break; - case LEADERSHIP: + case SkillT::LEADERSHIP: str = _n("Increases your hero's troops morale by %{count}.", "Increases your hero's troops morale by %{count}.", count); break; - case WISDOM: + case SkillT::WISDOM: { switch (Level()) { @@ -502,15 +502,15 @@ string Skill::Secondary::GetDescription() const } break; } - case MYSTICISM: + case SkillT::MYSTICISM: str = _n("Regenerates %{count} of your hero's spell point per day.", "Regenerates %{count} of your hero's spell points per day.", count); break; - case LUCK: + case SkillT::LUCK: str = _n("Increases your hero's luck by %{count}.", "Increases your hero's luck by %{count}.", count); break; - case BALLISTICS: + case SkillT::BALLISTICS: switch (Level()) { case Level::BASIC: @@ -530,7 +530,7 @@ string Skill::Secondary::GetDescription() const break; } break; - case EAGLEEYE: + case SkillT::EAGLEEYE: switch (Level()) { case Level::BASIC: @@ -561,13 +561,13 @@ string Skill::Secondary::GetDescription() const break; } break; - case NECROMANCY: + case SkillT::NECROMANCY: str = _n( "Allows %{count} percent of the creatures killed in combat to be brought back from the dead as Skeletons.", "Allows %{count} percent of the creatures killed in combat to be brought back from the dead as Skeletons.", count); break; - case ESTATES: + case SkillT::ESTATES: str = _n("Your hero produce %{count} gold pieces per turn as tax revenue from estates.", "Your hero produces %{count} gold pieces per turn as tax revenue from estates.", count); break; @@ -595,35 +595,35 @@ Skill::SecSkills::SecSkills(int race) if (ptr) { - if (ptr->initial_secondary.archery) AddSkill(Secondary(Secondary::ARCHERY, ptr->initial_secondary.archery)); + if (ptr->initial_secondary.archery) AddSkill(Secondary(SkillT::ARCHERY, ptr->initial_secondary.archery)); if (ptr->initial_secondary.ballistics) - AddSkill(Secondary(Secondary::BALLISTICS, ptr->initial_secondary.ballistics)); + AddSkill(Secondary(SkillT::BALLISTICS, ptr->initial_secondary.ballistics)); if (ptr->initial_secondary.diplomacy) - AddSkill(Secondary(Secondary::DIPLOMACY, ptr->initial_secondary.diplomacy)); + AddSkill(Secondary(SkillT::DIPLOMACY, ptr->initial_secondary.diplomacy)); if (ptr->initial_secondary.eagleeye) - AddSkill(Secondary(Secondary::EAGLEEYE, ptr->initial_secondary.eagleeye)); - if (ptr->initial_secondary.estates) AddSkill(Secondary(Secondary::ESTATES, ptr->initial_secondary.estates)); + AddSkill(Secondary(SkillT::EAGLEEYE, ptr->initial_secondary.eagleeye)); + if (ptr->initial_secondary.estates) AddSkill(Secondary(SkillT::ESTATES, ptr->initial_secondary.estates)); if (ptr->initial_secondary.leadership) - AddSkill(Secondary(Secondary::LEADERSHIP, ptr->initial_secondary.leadership)); + AddSkill(Secondary(SkillT::LEADERSHIP, ptr->initial_secondary.leadership)); if (ptr->initial_secondary.logistics) - AddSkill(Secondary(Secondary::LOGISTICS, ptr->initial_secondary.logistics)); - if (ptr->initial_secondary.luck) AddSkill(Secondary(Secondary::LUCK, ptr->initial_secondary.luck)); + AddSkill(Secondary(SkillT::LOGISTICS, ptr->initial_secondary.logistics)); + if (ptr->initial_secondary.luck) AddSkill(Secondary(SkillT::LUCK, ptr->initial_secondary.luck)); if (ptr->initial_secondary.mysticism) - AddSkill(Secondary(Secondary::MYSTICISM, ptr->initial_secondary.mysticism)); + AddSkill(Secondary(SkillT::MYSTICISM, ptr->initial_secondary.mysticism)); if (ptr->initial_secondary.navigation) - AddSkill(Secondary(Secondary::NAVIGATION, ptr->initial_secondary.navigation)); + AddSkill(Secondary(SkillT::NAVIGATION, ptr->initial_secondary.navigation)); if (ptr->initial_secondary.necromancy) - AddSkill(Secondary(Secondary::NECROMANCY, ptr->initial_secondary.necromancy)); + AddSkill(Secondary(SkillT::NECROMANCY, ptr->initial_secondary.necromancy)); if (ptr->initial_secondary.pathfinding) - AddSkill(Secondary(Secondary::PATHFINDING, ptr->initial_secondary.pathfinding)); + AddSkill(Secondary(SkillT::PATHFINDING, ptr->initial_secondary.pathfinding)); if (ptr->initial_secondary.scouting) - AddSkill(Secondary(Secondary::SCOUTING, ptr->initial_secondary.scouting)); - if (ptr->initial_secondary.wisdom) AddSkill(Secondary(Secondary::WISDOM, ptr->initial_secondary.wisdom)); + AddSkill(Secondary(SkillT::SCOUTING, ptr->initial_secondary.scouting)); + if (ptr->initial_secondary.wisdom) AddSkill(Secondary(SkillT::WISDOM, ptr->initial_secondary.wisdom)); } } } -int Skill::SecSkills::GetLevel(int skill) const +int Skill::SecSkills::GetLevel(SkillT skill) const { const auto it = find_if(_items.begin(), _items.end(), [&](const Secondary& it) { return it.isSkill(skill); }); @@ -631,7 +631,7 @@ int Skill::SecSkills::GetLevel(int skill) const return it == _items.end() ? Level::NONE : (*it).Level(); } -uint32_t Skill::SecSkills::GetValues(int skill) const +uint32_t Skill::SecSkills::GetValues(SkillT skill) const { const auto it = find_if(_items.begin(), _items.end(), [&](const Secondary& it) { return it.isSkill(skill); }); @@ -665,10 +665,15 @@ void Skill::SecSkills::AddSkill(const Secondary& skill) } } -Skill::Secondary* Skill::SecSkills::FindSkill(int skill) +Skill::Secondary* Skill::SecSkills::FindSkill(SkillT skill) { const auto it = find_if(_items.begin(), _items.end(), - [&](Secondary& it) { return it.isValid(); }); + [&](Secondary& it) + { + if (!it.isValid()) + return false; + return it.isSkill(skill); + }); return it != _items.end() ? &*it : nullptr; } @@ -694,26 +699,26 @@ void Skill::SecSkills::FillMax(const Secondary& skill) _items.resize(HEROESMAXSKILL, skill); } -int Skill::SecondaryGetWeightSkillFromRace(int race, int skill) +int Skill::SecondaryGetWeightSkillFromRace(int race, SkillT skill) { const stats_t* ptr = GameStatic::GetSkillStats(race); if (!ptr) return 0; - if (skill == Secondary::PATHFINDING) return ptr->mature_secondary.pathfinding; - if (skill == Secondary::ARCHERY) return ptr->mature_secondary.archery; - if (skill == Secondary::LOGISTICS) return ptr->mature_secondary.logistics; - if (skill == Secondary::SCOUTING) return ptr->mature_secondary.scouting; - if (skill == Secondary::DIPLOMACY) return ptr->mature_secondary.diplomacy; - if (skill == Secondary::NAVIGATION) return ptr->mature_secondary.navigation; - if (skill == Secondary::LEADERSHIP) return ptr->mature_secondary.leadership; - if (skill == Secondary::WISDOM) return ptr->mature_secondary.wisdom; - if (skill == Secondary::MYSTICISM) return ptr->mature_secondary.mysticism; - if (skill == Secondary::LUCK) return ptr->mature_secondary.luck; - if (skill == Secondary::BALLISTICS) return ptr->mature_secondary.ballistics; - if (skill == Secondary::EAGLEEYE) return ptr->mature_secondary.eagleeye; - if (skill == Secondary::NECROMANCY) return ptr->mature_secondary.necromancy; - if (skill == Secondary::ESTATES) return ptr->mature_secondary.estates; + if (skill == SkillT::PATHFINDING) return ptr->mature_secondary.pathfinding; + if (skill == SkillT::ARCHERY) return ptr->mature_secondary.archery; + if (skill == SkillT::LOGISTICS) return ptr->mature_secondary.logistics; + if (skill == SkillT::SCOUTING) return ptr->mature_secondary.scouting; + if (skill == SkillT::DIPLOMACY) return ptr->mature_secondary.diplomacy; + if (skill == SkillT::NAVIGATION) return ptr->mature_secondary.navigation; + if (skill == SkillT::LEADERSHIP) return ptr->mature_secondary.leadership; + if (skill == SkillT::WISDOM) return ptr->mature_secondary.wisdom; + if (skill == SkillT::MYSTICISM) return ptr->mature_secondary.mysticism; + if (skill == SkillT::LUCK) return ptr->mature_secondary.luck; + if (skill == SkillT::BALLISTICS) return ptr->mature_secondary.ballistics; + if (skill == SkillT::EAGLEEYE) return ptr->mature_secondary.eagleeye; + if (skill == SkillT::NECROMANCY) return ptr->mature_secondary.necromancy; + if (skill == SkillT::ESTATES) return ptr->mature_secondary.estates; return 0; } @@ -729,22 +734,22 @@ std::vector Skill::SecondarySkills() } */ -int Skill::SecondaryPriorityFromRace(int race, const std::vector& exclude) +Skill::SkillT Skill::SecondaryPriorityFromRace(int race, const std::vector& exclude) { Rand::Queue parts(MAXSECONDARYSKILL); - for (int secskill : secskills) + for (SkillT secskill : secskills) if (exclude.empty() || exclude.end() == find(exclude.begin(), exclude.end(), secskill)) - parts.Push(secskill, SecondaryGetWeightSkillFromRace(race, secskill)); + parts.Push((int)secskill, (uint32_t)SecondaryGetWeightSkillFromRace(race, secskill)); - return parts.Size() ? parts.Get() : Secondary::UNKNOWN; + return parts.Size() ? (SkillT) parts.Get() : SkillT::UNKNOWN; } /* select secondary skills for level up */ void Skill::SecSkills::FindSkillsForLevelUp(int race, Secondary& sec1, Secondary& sec2) const { - vector exclude_skills; + vector exclude_skills; exclude_skills.reserve(MAXSECONDARYSKILL + HEROESMAXSKILL); // exclude for expert @@ -754,13 +759,13 @@ void Skill::SecSkills::FindSkillsForLevelUp(int race, Secondary& sec1, Secondary // exclude is full, add other. if (HEROESMAXSKILL <= Count()) { - for (int secskill : secskills) + for (auto secskill : secskills) if (Level::NONE == GetLevel(secskill)) exclude_skills.push_back(secskill); } sec1.SetSkill(SecondaryPriorityFromRace(race, exclude_skills)); - if (Secondary::UNKNOWN != sec1.Skill()) + if (SkillT::UNKNOWN != sec1.Skill()) { exclude_skills.push_back(sec1.Skill()); sec2.SetSkill(SecondaryPriorityFromRace(race, exclude_skills)); @@ -797,7 +802,7 @@ void StringAppendModifiers(string& str, int value) int Skill::GetLeadershipModifiers(int level, string* strs = nullptr) { - Secondary skill(Secondary::LEADERSHIP, level); + Secondary skill(SkillT::LEADERSHIP, level); if (skill.GetValues() && strs) { @@ -811,7 +816,7 @@ int Skill::GetLeadershipModifiers(int level, string* strs = nullptr) int Skill::GetLuckModifiers(int level, string* strs = nullptr) { - Secondary skill(Secondary::LUCK, level); + Secondary skill(SkillT::LUCK, level); if (skill.GetValues() && strs) { @@ -1089,13 +1094,23 @@ bool SecondarySkillsBar::QueueEventProcessing(string* str) ByteVectorReader& Skill::operator>>(ByteVectorReader& sb, Secondary& st) { - return sb >> st.first >> st.second; + int skill; + sb >> (skill) >> st.second; + st.first = (SkillT)skill; + return sb; } + ByteVectorWriter& Skill::operator<<(ByteVectorWriter& sb, const SecSkills& ss) { const vector& v = ss._items; - return sb << v; + + sb.put32(static_cast(v.size())); + for(const Secondary& it:v) + { + sb << ((int)it.first) << it.second; + } + return sb; } ByteVectorReader& Skill::operator>>(ByteVectorReader& sb, SecSkills& ss) diff --git a/src/fheroes2/heroes/skill.h b/src/fheroes2/heroes/skill.h index 1a38fed..8565dd3 100644 --- a/src/fheroes2/heroes/skill.h +++ b/src/fheroes2/heroes/skill.h @@ -55,40 +55,40 @@ namespace Skill std::string String(int level); } + enum class SkillT + { + UNKNOWN = 0, + PATHFINDING = 1, + ARCHERY = 2, + LOGISTICS = 3, + SCOUTING = 4, + DIPLOMACY = 5, + NAVIGATION = 6, + LEADERSHIP = 7, + WISDOM = 8, + MYSTICISM = 9, + LUCK = 10, + BALLISTICS = 11, + EAGLEEYE = 12, + NECROMANCY = 13, + ESTATES = 14, + + LEARNING = EAGLEEYE + }; - class Secondary : public pair + class Secondary : public pair { public: - enum - { - UNKNOWN = 0, - PATHFINDING = 1, - ARCHERY = 2, - LOGISTICS = 3, - SCOUTING = 4, - DIPLOMACY = 5, - NAVIGATION = 6, - LEADERSHIP = 7, - WISDOM = 8, - MYSTICISM = 9, - LUCK = 10, - BALLISTICS = 11, - EAGLEEYE = 12, - NECROMANCY = 13, - ESTATES = 14, - - LEARNING = EAGLEEYE - }; - + Secondary(); - Secondary(int skill, int level); + Secondary(SkillT skill, int level); void Reset(); void Set(const Secondary&); - void SetSkill(int); + void SetSkill(SkillT); void SetLevel(int); @@ -96,11 +96,11 @@ namespace Skill int Level() const; - int Skill() const; + SkillT Skill() const; bool isLevel(int) const; - bool isSkill(int) const; + bool isSkill(SkillT) const; bool isValid() const; @@ -116,9 +116,9 @@ namespace Skill /* index sprite from MINISS */ int GetIndexSprite2() const; - static int RandForWitchsHut(); + static SkillT RandForWitchsHut(); - static std::string String(int); + static std::string String(SkillT); }; ByteVectorReader& operator>>(ByteVectorReader&, Secondary&); @@ -131,9 +131,9 @@ namespace Skill SecSkills(int race); - int GetLevel(int skill) const; + int GetLevel(SkillT skill) const; - uint32_t GetValues(int skill) const; + uint32_t GetValues(SkillT skill) const; void AddSkill(const Secondary&); @@ -141,7 +141,7 @@ namespace Skill void FillMax(const Secondary&); - Secondary* FindSkill(int); + Secondary* FindSkill(SkillT); string String() const; diff --git a/src/fheroes2/kingdom/kingdom.cpp b/src/fheroes2/kingdom/kingdom.cpp index c3ce873..13b749f 100644 --- a/src/fheroes2/kingdom/kingdom.cpp +++ b/src/fheroes2/kingdom/kingdom.cpp @@ -560,7 +560,7 @@ Funds Kingdom::GetIncome(int type /* INCOME_ALL */) const { // estates skill bonus for (auto heroe : heroes._items) - resource.gold += (*heroe).GetSecondaryValues(Skill::Secondary::ESTATES); + resource.gold += (*heroe).GetSecondaryValues(Skill::SkillT::ESTATES); } return resource; diff --git a/src/fheroes2/maps/ground.cpp b/src/fheroes2/maps/ground.cpp index c46a9f2..b0202ff 100644 --- a/src/fheroes2/maps/ground.cpp +++ b/src/fheroes2/maps/ground.cpp @@ -58,7 +58,7 @@ std::string Maps::Ground::String(int ground) return str_ground[8]; } -uint32_t Maps::Ground::GetPenalty(s32 index, int direct, uint32_t level) +uint32_t Maps::Ground::GetPenalty(int index, int direct, uint32_t level) { const Tiles& tile = world.GetTiles(index); diff --git a/src/fheroes2/maps/ground.h b/src/fheroes2/maps/ground.h index a076f68..293fed8 100644 --- a/src/fheroes2/maps/ground.h +++ b/src/fheroes2/maps/ground.h @@ -47,6 +47,6 @@ namespace Maps std::string String(int); - uint32_t GetPenalty(s32, int direction, uint32_t pathfinding); + uint32_t GetPenalty(int, int direction, uint32_t pathfinding); } } diff --git a/src/fheroes2/maps/maps_tiles.h b/src/fheroes2/maps/maps_tiles.h index 8399a51..19b4898 100644 --- a/src/fheroes2/maps/maps_tiles.h +++ b/src/fheroes2/maps/maps_tiles.h @@ -397,7 +397,7 @@ namespace Maps void QuantitySetExt(int); - void QuantitySetSkill(int); + void QuantitySetSkill(Skill::SkillT); void QuantitySetSpell(int); diff --git a/src/fheroes2/maps/maps_tiles_quantity.cpp b/src/fheroes2/maps/maps_tiles_quantity.cpp index 2508c16..e6f8200 100644 --- a/src/fheroes2/maps/maps_tiles_quantity.cpp +++ b/src/fheroes2/maps/maps_tiles_quantity.cpp @@ -102,16 +102,16 @@ Skill::Secondary Maps::Tiles::QuantitySkill() const switch (QuantityVariant()) { case 4: - return {Skill::Secondary::LEADERSHIP, Skill::Level::BASIC}; + return {Skill::SkillT::LEADERSHIP, Skill::Level::BASIC}; case 5: - return {Skill::Secondary::WISDOM, Skill::Level::BASIC}; + return {Skill::SkillT::WISDOM, Skill::Level::BASIC}; default: break; } break; case MP2::OBJ_WITCHSHUT: - return {quantity1, Skill::Level::BASIC}; + return {(Skill::SkillT)quantity1, Skill::Level::BASIC}; default: break; @@ -120,12 +120,12 @@ Skill::Secondary Maps::Tiles::QuantitySkill() const return Skill::Secondary(); } -void Maps::Tiles::QuantitySetSkill(int skill) +void Maps::Tiles::QuantitySetSkill(Skill::SkillT skill) { switch (GetObject(false)) { case MP2::OBJ_WITCHSHUT: - quantity1 = skill; + quantity1 = (u8)skill; break; default: diff --git a/src/fheroes2/system/gamedefs.h b/src/fheroes2/system/gamedefs.h index 8cdc080..4c7123f 100644 --- a/src/fheroes2/system/gamedefs.h +++ b/src/fheroes2/system/gamedefs.h @@ -21,11 +21,10 @@ ***************************************************************************/ #pragma once -#include "engine.h" #include -#define MAJOR_VERSION 0 -#define MINOR_VERSION 9 +#define MAJOR_VERSION 1 +#define MINOR_VERSION 0 #include "translations.h" #include