Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37594134
en ru br
ALT Linux repos
S:1.0.8-alt1

Group :: Games/Strategy
RPM: fheroes2

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: fheroes2-0.9.12-random-skills.patch
Download


diff --git a/src/fheroes2/dialog/dialog_settings.cpp b/src/fheroes2/dialog/dialog_settings.cpp
index 9d238bb2..16b5a41c 100644
--- a/src/fheroes2/dialog/dialog_settings.cpp
+++ b/src/fheroes2/dialog/dialog_settings.cpp
@@ -171,6 +171,7 @@ void Dialog::ExtSettings( bool readonly )
     states.push_back( Settings::HEROES_REMEMBER_POINTS_RETREAT );
     states.push_back( Settings::HEROES_TRANSCRIBING_SCROLLS );
     states.push_back( Settings::HEROES_ARENA_ANY_SKILLS );
+    states.push_back( Settings::HEROES_RANDOM_LEVEL_UP );
 
     states.push_back( Settings::CASTLE_ALLOW_GUARDIANS );
     states.push_back( Settings::CASTLE_MAGEGUILD_POINTS_TURN );
diff --git a/src/fheroes2/heroes/heroes.cpp b/src/fheroes2/heroes/heroes.cpp
index 48b10484..67a38131 100644
--- a/src/fheroes2/heroes/heroes.cpp
+++ b/src/fheroes2/heroes/heroes.cpp
@@ -1975,6 +1975,8 @@ HeroSeedsForLevelUp Heroes::GetSeedsForLevelUp() const
      * */
 
     uint32_t hash = world.GetMapSeed();
+    if ( Settings::Get().ExtHeroRandomLevelUp() )
+	fheroes2::hashCombine( hash, Rand::Get( std::numeric_limits<uint32_t>::max() ) );
     fheroes2::hashCombine( hash, hid );
     fheroes2::hashCombine( hash, _race );
     fheroes2::hashCombine( hash, attack );
diff --git a/src/fheroes2/system/settings.cpp b/src/fheroes2/system/settings.cpp
index 3835eee7..61ea17bf 100644
--- a/src/fheroes2/system/settings.cpp
+++ b/src/fheroes2/system/settings.cpp
@@ -1003,6 +1003,8 @@ std::string Settings::ExtName( const uint32_t settingId )
         return _( "heroes: allow transcribing scrolls (needs: Eye Eagle skill)" );
     case Settings::HEROES_ARENA_ANY_SKILLS:
         return _( "heroes: allow to choose any primary skill in Arena" );
+    case Settings::HEROES_RANDOM_LEVEL_UP:
+        return _( "heroes: random skills on level up" );
     case Settings::BATTLE_SOFT_WAITING:
         return _( "battle: allow soft wait for troops" );
     case Settings::BATTLE_REVERSE_WAIT_ORDER:
@@ -1125,6 +1129,11 @@ bool Settings::ExtHeroRememberPointsForRetreating() const
     return ExtModes( HEROES_REMEMBER_POINTS_RETREAT );
 }
 
+bool Settings::ExtHeroRandomLevelUp() const
+{
+    return ExtModes( HEROES_RANDOM_LEVEL_UP );
+}
+
 bool Settings::ExtBattleShowDamage() const
 {
     return ExtModes( GAME_BATTLE_SHOW_DAMAGE );
diff --git a/src/fheroes2/system/settings.h b/src/fheroes2/system/settings.h
index 636818de..c9f7bbd2 100644
--- a/src/fheroes2/system/settings.h
+++ b/src/fheroes2/system/settings.h
@@ -99,7 +99,8 @@ public:
         // UNUSED = 0x40004000,
         BATTLE_DETERMINISTIC_RESULT = 0x40008000,
         BATTLE_SOFT_WAITING = 0x40010000,
-        BATTLE_REVERSE_WAIT_ORDER = 0x40020000
+        BATTLE_REVERSE_WAIT_ORDER = 0x40020000,
+        HEROES_RANDOM_LEVEL_UP = 0x40040000,
     };
 
     Settings( const Settings & ) = delete;
@@ -174,6 +175,7 @@ public:
     bool ExtHeroRememberPointsForRetreating() const;
     bool ExtHeroAllowTranscribingScroll() const;
     bool ExtHeroArenaCanChoiseAnySkills() const;
+    bool ExtHeroRandomLevelUp() const;
     bool ExtWorldShowTerrainPenalty() const;
     bool ExtWorldScouteExtended() const;
     bool ExtWorldAllowSetGuardian() const;
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin