00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "global.hpp"
00019
00020 #include "settings.hpp"
00021
00022 #include "serialization/string_utils.hpp"
00023 #include "util.hpp"
00024
00025 namespace settings {
00026
00027 int get_turns(const std::string& value)
00028 {
00029
00030 int val = lexical_cast_default<int>(value);
00031
00032 if(val == -1) {
00033 return turns_max;
00034 }
00035
00036 return lexical_cast_in_range<int>
00037 (value, turns_default, turns_min, turns_max);
00038 }
00039
00040 int get_village_gold(const std::string& value)
00041 {
00042 return lexical_cast_in_range<int>(value, 2, 1, 5);
00043 }
00044
00045 int get_xp_modifier(const std::string& value)
00046 {
00047 return lexical_cast_in_range<int>(value, 70, 30, 200);
00048 }
00049
00050 bool use_fog(const std::string& value)
00051 {
00052 return utils::string_bool(value, false);
00053 }
00054
00055 bool use_random_start_time(const std::string& value)
00056 {
00057 return utils::string_bool(value, false);
00058 }
00059
00060 bool use_shroud(const std::string& value)
00061 {
00062 return utils::string_bool(value, false);
00063 }
00064
00065 }
00066