Author: anonymissimus
Date: Thu Oct 27 16:16:17 2011
New Revision: 51682

URL: http://svn.gna.org/viewcvs/wesnoth?rev=51682&view=rev
Log:
save and reload [color_adjust] values (fix for bug #18676)

Modified:
    trunk/src/display.cpp
    trunk/src/display.hpp
    trunk/src/play_controller.cpp

Modified: trunk/src/display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.cpp?rev=51682&r1=51681&r2=51682&view=diff
==============================================================================
--- trunk/src/display.cpp (original)
+++ trunk/src/display.cpp Thu Oct 27 16:16:17 2011
@@ -94,9 +94,6 @@
        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 @@
        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 @@
                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);
+}

Modified: trunk/src/display.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.hpp?rev=51682&r1=51681&r2=51682&view=diff
==============================================================================
--- trunk/src/display.hpp (original)
+++ trunk/src/display.hpp Thu Oct 27 16:16:17 2011
@@ -471,6 +471,10 @@
        virtual const time_of_day& get_time_of_day(const map_location& loc = 
map_location::null_location) const;
 
        virtual bool has_time_area() const {return false;};
+
+       void write(config& cfg) const;
+private:
+       void read(const config& cfg);
 
 protected:
        /** Clear the screen contents */

Modified: trunk/src/play_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/play_controller.cpp?rev=51682&r1=51681&r2=51682&view=diff
==============================================================================
--- trunk/src/play_controller.cpp (original)
+++ trunk/src/play_controller.cpp Thu Oct 27 16:16:17 2011
@@ -704,6 +704,10 @@
        cfg["map_data"] = map_.write();
        cfg.merge_with(pathfind_manager_->to_config());
 
+       config display;
+       gui_->write(display);
+       cfg.add_child("display", display);
+
        return cfg;
 }
 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to