reintroduced usage of time_cfg[current_time] in replace_schedule functions #5757 (#6495)

This commit is contained in:
Amir Hassan 2022-02-13 19:51:41 +01:00 committed by GitHub
parent 9197811d23
commit 6b41eae4e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -290,17 +290,17 @@ void tod_manager::replace_schedule(const config& time_cfg)
{
std::vector<time_of_day> new_scedule;
time_of_day::parse_times(time_cfg, new_scedule);
replace_schedule(new_scedule);
replace_schedule(new_scedule, time_cfg["current_time"].to_int(0));
}
void tod_manager::replace_schedule(const std::vector<time_of_day>& schedule)
void tod_manager::replace_schedule(const std::vector<time_of_day>& schedule, int initial_time)
{
if(times_.empty() || schedule.empty() || times_[currentTime_].lawful_bonus != schedule.front().lawful_bonus) {
has_tod_bonus_changed_ = true;
}
times_ = schedule;
currentTime_ = 0;
currentTime_ = initial_time;
}
void tod_manager::replace_area_locations(int area_index, const std::set<map_location>& locs)
@ -310,7 +310,7 @@ void tod_manager::replace_area_locations(int area_index, const std::set<map_loca
has_tod_bonus_changed_ = true;
}
void tod_manager::replace_local_schedule(const std::vector<time_of_day>& schedule, int area_index)
void tod_manager::replace_local_schedule(const std::vector<time_of_day>& schedule, int area_index, int initial_time)
{
assert(area_index < static_cast<int>(areas_.size()));
area_time_of_day& area = areas_[area_index];
@ -325,7 +325,7 @@ void tod_manager::replace_local_schedule(const std::vector<time_of_day>& schedul
}
area.times = schedule;
area.currentTime = 0;
area.currentTime = initial_time;
}
void tod_manager::set_area_id(int area_index, const std::string& id)

View file

@ -87,8 +87,8 @@ class tod_manager
* Replace the time of day schedule
*/
void replace_schedule(const config& time_cfg);
void replace_schedule(const std::vector<time_of_day>& schedule);
void replace_local_schedule(const std::vector<time_of_day>& schedule, int area_index);
void replace_schedule(const std::vector<time_of_day>& schedule, int initial_time=0);
void replace_local_schedule(const std::vector<time_of_day>& schedule, int area_index, int initial_time=0);
void replace_area_locations(int index, const std::set<map_location>& locs);