made it so that scroll speeds won't be set to insane values

This commit is contained in:
Dave White 2004-02-27 15:29:56 +00:00
parent 465f92065c
commit 33d71e6ee4
2 changed files with 12 additions and 8 deletions

View file

@ -64,7 +64,7 @@
name=Heir to the Throne
first_scenario=The_Elves_Besieged
difficulties=EASY,NORMAL,HARD
difficulty_descriptions=&elvish-fighter.png,Fighter;*&elvish-hero.png,Hero;&elvish-champion.png,Champion
difficulty_descriptions=&elvish-fighter.png,Fighter,(easiest);*&elvish-hero.png,Hero;&elvish-champion.png,Champion,(hardest)
[/campaign]
[campaign]

View file

@ -278,15 +278,19 @@ namespace {
int scroll_speed()
{
static const int default_value = 100;
int value = 0;
string_map::const_iterator i = prefs.values.find("scroll");
if(i != prefs.values.end() && i->second.empty() == false)
{
scroll = atoi(i->second.c_str()) / 100.0;
return atoi(i->second.c_str());
} else {
scroll = default_value / 100.0;
return default_value;
if(i != prefs.values.end() && i->second.empty() == false) {
value = atoi(i->second.c_str());
}
if(value < 1 || value > 100) {
value = default_value;
}
scroll = value/100.0;
return value;
}
void set_scroll_speed(int new_speed)