Allow manual override of ToD color used in display::update_tod

This commit is contained in:
Charles Dang 2017-04-24 17:25:22 +11:00
parent 9e812f9122
commit 4c0422d491
2 changed files with 16 additions and 7 deletions

View file

@ -417,18 +417,23 @@ const tod_manager & display::get_tod_man() const
return *resources::tod_manager;
}
void display::update_tod() {
const time_of_day& tod = get_time_of_day();
tod_color col = color_adjust_ + tod.color;
void display::update_tod(const time_of_day* tod_override)
{
const time_of_day* tod = tod_override;
if(tod == nullptr) {
tod = &get_time_of_day();
}
const tod_color col = color_adjust_ + tod->color;
image::set_color_adjustment(col.r, col.g, col.b);
}
void display::adjust_color_overlay(int r, int g, int b) {
void display::adjust_color_overlay(int r, int g, int b)
{
color_adjust_ = tod_color(r, g, b);
update_tod();
}
void display::fill_images_list(const std::string& prefix, std::vector<std::string>& images)
{
// search prefix.png, prefix1.png, prefix2.png ...

View file

@ -171,10 +171,14 @@ public:
halo::manager & get_halo_manager() { return *halo_man_; }
/**
* Add r,g,b from tod_manager to the map
* Applies r,g,b coloring to the map.
*
* The color is usually taken from @ref get_time_of_day unless @a tod_override is given, in which
* case that color is used.
*
* @param tod_override The ToD to apply to the map instead of that of the current ToD's.
*/
void update_tod();
void update_tod(const time_of_day* tod_override = nullptr);
/**
* Add r,g,b to the colors for all images displayed on the map.