12 #include "../stdafx.h"
13 #include "../settings_type.h"
14 #include "../core/random_func.hpp"
16 #include "../textfile_gui.h"
17 #include "../string_func.h"
19 #include "../safeguards.h"
24 this->name = (name == NULL) ? NULL :
stredup(name);
25 this->
info = (name == NULL) ? NULL : this->
FindInfo(this->name, version, force_exact_match);
34 if (_game_mode == GM_NORMAL && this->
info != NULL) {
39 this->
SetSetting((*it).name, InteractiveRandomRange((*it).max_value - (*it).min_value) + (*it).min_value);
54 for (SettingValueList::const_iterator it = config->
settings.begin(); it != config->
settings.end(); it++) {
84 for (SettingValueList::iterator it = this->
settings.begin(); it != this->
settings.end(); it++) {
94 this->
SetSetting((*it).name, this->GetSetting((*it).name));
101 SettingValueList::const_iterator it = this->
settings.find(name);
109 if (this->
info == NULL)
return;
112 if (config_item == NULL)
return;
116 SettingValueList::iterator it = this->
settings.find(name);
118 (*it).second = value;
126 for (SettingValueList::iterator it = this->
settings.begin(); it != this->
settings.end(); it++) {
135 if ((*it).random_deviation != 0) {
136 this->
SetSetting((*it).name, InteractiveRandomRange((*it).random_deviation * 2) - (*it).random_deviation + this->GetSetting((*it).name));
143 return this->
info != NULL;
163 char *value_copy =
stredup(value);
164 char *s = value_copy;
170 if (s == NULL)
break;
171 if (*s ==
'\0')
break;
175 char *item_value = s;
182 this->
SetSetting(item_name, atoi(item_value));
191 for (SettingValueList::const_iterator it = this->
settings.begin(); it != this->
settings.end(); it++) {
196 size_t needed_size = strlen((*it).first) + 1 + strlen(no);
198 if (
string + needed_size > last)
break;
200 s =
strecat(s, (*it).first, last);
207 if (s !=
string) s[-1] =
'\0';