AI/Contexts: simplify range check
This commit is contained in:
parent
b5cb4b2bcc
commit
6dca50ac10
1 changed files with 2 additions and 11 deletions
|
@ -1387,17 +1387,8 @@ bool readonly_context_impl::is_active(const std::string& time_of_day, const std:
|
|||
}
|
||||
}
|
||||
|
||||
if(turns.empty() == false) {
|
||||
int turn = resources::tod_manager->turn();
|
||||
const std::vector<std::string>& turns_list = utils::split(turns);
|
||||
for(std::vector<std::string>::const_iterator j = turns_list.begin(); j != turns_list.end(); ++j) {
|
||||
const std::pair<int, int> range = utils::parse_range(*j);
|
||||
if(turn >= range.first && turn <= range.second) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
if(!turns.empty()) {
|
||||
return in_ranges(resources::tod_manager->turn(), utils::parse_ranges(turns));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue