mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-25 19:12:57 +00:00
fixed incorrect assertion statement
This commit is contained in:
parent
d0018fdec7
commit
a18b053c48
@ -332,16 +332,28 @@ private:
|
||||
class filter_function : public function_expression {
|
||||
public:
|
||||
explicit filter_function(const args_list& args)
|
||||
: function_expression("filter", args, 2, 2)
|
||||
: function_expression("filter", args, 2, 3)
|
||||
{}
|
||||
private:
|
||||
variant execute(const formula_callable& variables) const {
|
||||
std::vector<variant> vars;
|
||||
const variant items = args()[0]->evaluate(variables);
|
||||
for(int n = 0; n != items.num_elements(); ++n) {
|
||||
const variant val = args()[1]->evaluate(formula_callable_with_backup(*items[n].as_callable(), variables));
|
||||
if(val.as_bool()) {
|
||||
vars.push_back(items[n]);
|
||||
if(args().size() == 2) {
|
||||
for(int n = 0; n != items.num_elements(); ++n) {
|
||||
const variant val = args()[1]->evaluate(formula_callable_with_backup(*items[n].as_callable(), variables));
|
||||
if(val.as_bool()) {
|
||||
vars.push_back(items[n]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
map_formula_callable self_callable;
|
||||
const std::string self = args()[1]->evaluate(variables).as_string();
|
||||
for(int n = 0; n != items.num_elements(); ++n) {
|
||||
self_callable.add(self, items[n]);
|
||||
const variant val = args()[2]->evaluate(formula_callable_with_backup(self_callable, formula_callable_with_backup(*items[n].as_callable(), variables)));
|
||||
if(val.as_bool()) {
|
||||
vars.push_back(items[n]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -449,7 +449,7 @@ void game::send_change_controller(const size_t side_num,
|
||||
// Update the level so observers who join get the new name.
|
||||
const simple_wml::node::child_list& side_list = level_.root().children("side");
|
||||
const int index = side_num - 1;
|
||||
assert(side_num < side_list.size());
|
||||
assert(index < side_list.size());
|
||||
side_list[index]->set_attr_dup("current_player", newplayer->second.name().c_str());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user