mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-06 16:33:29 +00:00
Eliminate a string variable...
...by assigning directly to a config::attibute_value.
This commit is contained in:
parent
5a591dafcd
commit
72b7c9d94a
@ -1456,7 +1456,8 @@ WML_HANDLER_FUNCTION(set_variable, /*event_info*/, cfg)
|
||||
if(rand.empty() == false) {
|
||||
assert(gameinfo);
|
||||
|
||||
std::string random_value;
|
||||
// A default value in case something goes really wrong.
|
||||
var = "";
|
||||
|
||||
std::string word;
|
||||
std::vector<std::string> words;
|
||||
@ -1535,18 +1536,14 @@ WML_HANDLER_FUNCTION(set_variable, /*event_info*/, cfg)
|
||||
tmp += (ranges[i].second - ranges[i].first) + 1;
|
||||
if (tmp > choice) {
|
||||
if (ranges[i].first == 0 && ranges[i].second == 0) {
|
||||
random_value = words[i];
|
||||
var = words[i];
|
||||
}
|
||||
else {
|
||||
tmp = (ranges[i].second - (tmp - choice)) + 1;
|
||||
ss << tmp;
|
||||
ss >> random_value;
|
||||
var = (ranges[i].second - (tmp - choice)) + 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var = random_value;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user