46 void set_current_time(
int time);
47 void set_current_time(
int time,
int area_index);
48 void set_current_time(
int time,
const std::string& area_id);
49 void set_area_id(
int area_index,
const std::string&
id);
50 const std::string& get_area_id(
int area_index)
const;
57 return get_time_of_day_turn(times_, for_turn ? for_turn : turn_, currentTime_);
70 const time_of_day& get_area_time_of_day(
int area_i,
int for_turn = 0)
const;
72 int get_current_area_time(
int index)
const;
80 int for_turn = 0)
const;
82 const time_of_day& get_previous_time_of_day()
const;
84 static bool is_start_ToD(
const std::string&);
89 void replace_schedule(
const config& time_cfg);
90 void replace_schedule(
const std::vector<time_of_day>& schedule,
int initial_time=0);
91 void replace_local_schedule(
const std::vector<time_of_day>& schedule,
int area_index,
int initial_time=0);
93 void replace_area_locations(
int index,
const std::set<map_location>& locs);
98 std::vector<std::string> get_area_ids()
const;
103 const std::set<map_location>& get_area_by_index(
int index)
const;
109 const std::set<map_location>& get_area_by_id(
const std::string&
id)
const;
114 std::pair<int, std::string> get_area_on_hex(
const map_location& loc)
const;
135 void add_time_area(
const std::string&
id,
const std::set<map_location>& locs,
145 void remove_time_area(
const std::string&
id);
147 void remove_time_area(
int index);
154 const std::vector<time_of_day>&
times(
int index)
const {
155 assert(index < static_cast<int>(areas_.size()));
156 return areas_[
index].times;
160 int turn()
const {
return turn_; }
162 void modify_turns(
const std::string& mod);
163 void set_number_of_turns(
int num);
165 void update_server_information()
const;
166 void modify_turns_by_wml(
const std::string& mod);
167 void set_number_of_turns_by_wml(
int num);
170 void set_turn(
const int num,
game_data* vars =
nullptr,
const bool increase_limit_if_needed =
true);
172 void set_turn_by_wml(
const int num,
game_data* vars =
nullptr,
const bool increase_limit_if_needed =
true);
186 bool is_time_left()
const;
188 {
return has_turn_event_fired_; }
190 { has_turn_event_fired_ =
true; }
192 {
return has_tod_bonus_changed_; }
194 {
return liminal_bonus_; }
196 liminal_bonus_ = bonus;
197 has_cfg_liminal_bonus_ =
true;
200 liminal_bonus_ = std::max(25, calculate_best_liminal_bonus(times()));
201 has_cfg_liminal_bonus_ =
false;
210 const time_of_day& get_time_of_day_turn(
const std::vector<time_of_day>& times,
int nturn,
const int current_time)
const;
218 static int fix_time_index(
227 int calculate_time_index_at_turn(
230 int current_time)
const;
234 int calculate_best_liminal_bonus(
const std::vector<time_of_day>& schedule)
const;
240 void set_new_current_times(
const int new_current_turn_number);
::tod_manager * tod_manager
int get_max_liminal_bonus() const
bool has_turn_event_fired_
Variant for storing WML attributes.
bool has_tod_bonus_changed_
std::set< map_location > hexes
Definitions for the interface to Wesnoth Markup Language (WML).
Object which defines a time of day with associated bonuses, image, sounds etc.
std::vector< time_of_day > times
const time_of_day & get_time_of_day(int for_turn=0) const
Returns global time of day for the passed turn.
config::attribute_value random_tod_
std::vector< time_of_day > times_
Encapsulates the map of the game.
int number_of_turns() const
Encapsulates the map of the game.
bool has_tod_bonus_changed() const
const std::vector< time_of_day > & times(int index) const
bool has_turn_event_fired() const
bool has_time_area() const
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
bool has_cfg_liminal_bonus_
static const map_location & null_location()
Container associating units to locations.
std::vector< area_time_of_day > areas_
A config object defines a single node in a WML file, with access to child nodes.
void set_max_liminal_bonus(int bonus)
void reset_max_liminal_bonus()
this class does not give synced random results derived classes might do.