Group :: Jogos/Estratégia
RPM: fheroes2
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
Patch: fheroes2-1.0.1-random-skills.patch
Download
Download
diff --git a/src/fheroes2/heroes/heroes.cpp b/src/fheroes2/heroes/heroes.cpp
index 2bf2c18d..3b95031b 100644
--- a/src/fheroes2/heroes/heroes.cpp
+++ b/src/fheroes2/heroes/heroes.cpp
@@ -1887,6 +1887,8 @@ HeroSeedsForLevelUp Heroes::GetSeedsForLevelUp() const
* */
uint32_t hash = world.GetMapSeed();
+ if ( Settings::Get().isHeroRandomLevelUpEnabled() )
+ 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 671df372..06bd2d02 100644
--- a/src/fheroes2/system/settings.cpp
+++ b/src/fheroes2/system/settings.cpp
@@ -79,7 +79,8 @@ namespace
GLOBAL_BATTLE_AUTO_RESOLVE = 0x04000000,
GLOBAL_BATTLE_AUTO_SPELLCAST = 0x08000000,
GLOBAL_AUTO_SAVE_AT_BEGINNING_OF_TURN = 0x10000000,
- GLOBAL_SCREEN_SCALING_TYPE_NEAREST = 0x20000000
+ GLOBAL_SCREEN_SCALING_TYPE_NEAREST = 0x20000000,
+ GLOBAL_HERO_RANDOM_LEVEL_UP = 0x40000000
};
}
@@ -225,6 +226,10 @@ bool Settings::Read( const std::string & filePath )
setBattleShowArmyOrder( config.StrParams( "battle army order" ) == "on" );
}
+ if ( config.Exists( "hero random level up" ) ) {
+ setHeroRandomLevelUp( config.StrParams( "hero random level up" ) == "on" );
+ }
+
if ( config.Exists( "use evil interface" ) ) {
setEvilInterface( config.StrParams( "use evil interface" ) == "on" );
}
@@ -440,6 +445,9 @@ std::string Settings::String() const
os << std::endl << "# show army order during battle: on/off" << std::endl;
os << "battle army order = " << ( _optGlobal.Modes( GLOBAL_BATTLE_SHOW_ARMY_ORDER ) ? "on" : "off" ) << std::endl;
+ os << std::endl << "# hero random level up (experimental): on/off" << std::endl;
+ os << "hero random level up = " << ( _optGlobal.Modes( GLOBAL_HERO_RANDOM_LEVEL_UP ) ? "on" : "off" ) << std::endl;
+
os << std::endl << "# use evil interface style: on/off" << std::endl;
os << "use evil interface = " << ( _optGlobal.Modes( GLOBAL_EVIL_INTERFACE ) ? "on" : "off" ) << std::endl;
@@ -778,6 +786,16 @@ void Settings::setBattleDamageInfo( const bool enable )
}
}
+void Settings::setHeroRandomLevelUp( const bool enable )
+{
+ if ( enable ) {
+ _optGlobal.SetModes( GLOBAL_HERO_RANDOM_LEVEL_UP );
+ }
+ else {
+ _optGlobal.ResetModes( GLOBAL_HERO_RANDOM_LEVEL_UP );
+ }
+}
+
void Settings::setHideInterface( const bool enable )
{
if ( enable ) {
@@ -850,6 +868,11 @@ bool Settings::isBattleShowDamageInfoEnabled() const
return _optGlobal.Modes( GLOBAL_BATTLE_SHOW_DAMAGE );
}
+bool Settings::isHeroRandomLevelUpEnabled() const
+{
+ return _optGlobal.Modes( GLOBAL_HERO_RANDOM_LEVEL_UP );
+}
+
bool Settings::isHideInterfaceEnabled() const
{
return _optGlobal.Modes( GLOBAL_HIDE_INTERFACE );
diff --git a/src/fheroes2/system/settings.h b/src/fheroes2/system/settings.h
index c1aa6330..6f72556f 100644
--- a/src/fheroes2/system/settings.h
+++ b/src/fheroes2/system/settings.h
@@ -177,6 +177,7 @@ public:
bool isSystemInfoEnabled() const;
bool isAutoSaveAtBeginningOfTurnEnabled() const;
bool isBattleShowDamageInfoEnabled() const;
+ bool isHeroRandomLevelUpEnabled() const;
bool isHideInterfaceEnabled() const;
bool isEvilInterfaceEnabled() const;
@@ -244,6 +245,7 @@ public:
void setSystemInfo( const bool enable );
void setAutoSaveAtBeginningOfTurn( const bool enable );
void setBattleDamageInfo( const bool enable );
+ void setHeroRandomLevelUp( const bool enable );
void setHideInterface( const bool enable );
void setEvilInterface( const bool enable );
void setScreenScalingTypeNearest( const bool enable );