49 void set_area_id(
int area_index,
const std::string&
id);
50 const std::string&
get_area_id(
int area_index)
const;
80 int for_turn = 0)
const;
90 void replace_schedule(
const std::vector<time_of_day>& schedule,
int initial_time=0);
109 const std::set<map_location>&
get_area_by_id(
const std::string&
id)
const;
135 void add_time_area(
const std::string&
id,
const std::set<map_location>& locs,
170 void set_turn(
const int num,
game_data* vars =
nullptr,
const bool increase_limit_if_needed =
true);
230 int current_time)
const;
Variant for storing WML attributes.
A config object defines a single node in a WML file, with access to child nodes.
Encapsulates the map of the game.
this class does not give synced random results derived classes might do.
bool has_time_area() const
static bool is_start_ToD(const std::string &)
void update_server_information() const
int get_max_liminal_bonus() const
void replace_schedule(const config &time_cfg)
Replace the time of day schedule.
int number_of_turns() const
const time_of_day & get_time_of_day_turn(const std::vector< time_of_day > ×, int nturn, const int current_time) const
Returns time of day object in the turn "nturn".
const time_of_day get_illuminated_time_of_day(const unit_map &units, const gamemap &map, const map_location &loc, int for_turn=0) const
Returns time of day object for the passed turn at a location.
const std::vector< time_of_day > & times(const map_location &loc=map_location::null_location()) const
const std::string & get_area_id(int area_index) const
std::vector< std::string > get_area_ids() const
void modify_turns_by_wml(const std::string &mod)
const std::set< map_location > & get_area_by_index(int index) const
void remove_time_area(const std::string &id)
Removes a time area from config, making it follow the scenario's normal time-of-day sequence.
void set_current_time(int time)
void set_area_id(int area_index, const std::string &id)
void set_max_liminal_bonus(int bonus)
int get_current_time(const map_location &loc=map_location::null_location()) const
void set_turn_by_wml(const int num, game_data *vars=nullptr, const bool increase_limit_if_needed=true)
Dynamically change the current turn number.
void add_time_area(const gamemap &map, const config &cfg)
Adds a new local time area from config, making it follow its own time-of-day sequence.
int get_current_area_time(int index) const
const std::vector< time_of_day > & times(int index) const
bool has_tod_bonus_changed_
void replace_local_schedule(const std::vector< time_of_day > &schedule, int area_index, int initial_time=0)
void set_turn(const int num, game_data *vars=nullptr, const bool increase_limit_if_needed=true)
Dynamically change the current turn number.
bool has_turn_event_fired_
void set_number_of_turns(int num)
bool has_turn_event_fired() const
void set_number_of_turns_by_wml(int num)
const time_of_day & get_time_of_day(int for_turn=0) const
Returns global time of day for the passed turn.
static int fix_time_index(int number_of_times, int time)
Computes for the main time or a time area the index of its times where we're currently at.
bool next_turn(game_data *vars)
Function to move to the next turn.
std::vector< area_time_of_day > areas_
void replace_area_locations(int index, const std::set< map_location > &locs)
bool is_time_left() const
Function to check the end of turns.
void reset_max_liminal_bonus()
config to_config(std::string textdomain="") const
const time_of_day & get_area_time_of_day(int area_i, int for_turn=0) const
Returns time of day for the passed turn in the specified tod area.
const std::set< map_location > & get_area_by_id(const std::string &id) const
bool has_cfg_liminal_bonus_
std::vector< time_of_day > times_
tod_manager & operator=(const tod_manager &manager)=default
config::attribute_value random_tod_
int calculate_best_liminal_bonus(const std::vector< time_of_day > &schedule) const
Computes the maximum absolute value of lawful_bonus in the schedule.
tod_manager(const config &scenario_cfg=config())
std::pair< int, std::string > get_area_on_hex(const map_location &loc) const
const time_of_day & get_previous_time_of_day() const
void resolve_random(randomness::rng &r)
handles random_start_time, should be called before the game starts.
void modify_turns(const std::string &mod)
void set_new_current_times(const int new_current_turn_number)
For a change of the current turn number, sets the current times of the main time and all time areas.
int calculate_time_index_at_turn(int number_of_times, int for_turn_number, int current_time) const
Computes for the main time or a time area the index of its times where we're currently at.
bool has_tod_bonus_changed() const
Container associating units to locations.
Definitions for the interface to Wesnoth Markup Language (WML).
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.
Encapsulates the map of the game.
static const map_location & null_location()
Object which defines a time of day with associated bonuses, image, sounds etc.
std::set< map_location > hexes
std::vector< time_of_day > times