save and reload [color_adjust] values (fix for bug #18676)

This commit is contained in:
Anonymissimus 2011-10-27 14:16:17 +00:00
parent 56ffd2f2cd
commit d6ac51d4fb
3 changed files with 28 additions and 4 deletions

View file

@ -94,9 +94,6 @@ display::display(CVideo& video, const gamemap* map, const config& theme_cfg, con
turbo_(false),
invalidateGameStatus_(true),
map_labels_(new map_labels(*this, 0)),
color_adjust_red_(0),
color_adjust_green_(0),
color_adjust_blue_(0),
scroll_event_("scrolled"),
complete_redraw_event_("completely_redrawn"),
nextDraw_(0),
@ -127,11 +124,16 @@ display::display(CVideo& video, const gamemap* map, const config& theme_cfg, con
redraw_observers_(),
draw_coordinates_(false),
draw_terrain_codes_(false),
arrows_map_()
arrows_map_(),
color_adjust_red_(0),
color_adjust_green_(0),
color_adjust_blue_(0)
#if defined(__GLIBC__)
, do_reverse_memcpy_workaround_(false)
#endif
{
read(level.child_or_empty("display"));
if(non_interactive()
&& (get_video_surface() != NULL
&& video.faked())) {
@ -2530,3 +2532,17 @@ void display::update_arrow(arrow & arrow)
arrows_map_[loc].push_back(&arrow);
}
}
void display::write(config& cfg) const
{
cfg["color_adjust_red"] = color_adjust_red_;
cfg["color_adjust_green"] = color_adjust_green_;
cfg["color_adjust_blue_"] = color_adjust_blue_;
}
void display::read(const config& cfg)
{
color_adjust_red_ = cfg["color_adjust_red"].to_int(0);
color_adjust_green_ = cfg["color_adjust_green"].to_int(0);
color_adjust_blue_ = cfg["color_adjust_blue_"].to_int(0);
}

View file

@ -472,6 +472,10 @@ public:
virtual bool has_time_area() const {return false;};
void write(config& cfg) const;
private:
void read(const config& cfg);
protected:
/** Clear the screen contents */
void clear_screen();

View file

@ -704,6 +704,10 @@ config play_controller::to_config() const
cfg["map_data"] = map_.write();
cfg.merge_with(pathfind_manager_->to_config());
config display;
gui_->write(display);
cfg.add_child("display", display);
return cfg;
}