Author: ilor
Date: Tue Jul 15 16:01:15 2008
New Revision: 28041

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28041&view=rev
Log:
Add brush locations support in display

Modified:
    trunk/src/editor2/editor_display.cpp
    trunk/src/editor2/editor_display.hpp

Modified: trunk/src/editor2/editor_display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_display.cpp?rev=28041&r1=28040&r2=28041&view=diff
==============================================================================
--- trunk/src/editor2/editor_display.cpp (original)
+++ trunk/src/editor2/editor_display.cpp Tue Jul 15 16:01:15 2008
@@ -13,6 +13,9 @@
 
 #include "editor_display.hpp"
 #include "editor_common.hpp"
+
+#include "../foreach.hpp"
+
 #include <cassert>
 
 namespace editor2 {
@@ -25,6 +28,32 @@
     clear_screen();
 }
 
+void editor_display::add_brush_loc(const gamemap::location& hex)
+{
+       brush_locations_.insert(hex);
+       invalidate(hex);
+}
+
+void editor_display::set_brush_locs(const std::set<gamemap::location>& hexes)
+{
+       invalidate(brush_locations_);
+       brush_locations_ = hexes;
+       invalidate(brush_locations_);
+}
+
+void editor_display::clear_brush_locs()
+{
+       invalidate(brush_locations_);
+       brush_locations_.clear();
+}
+
+void editor_display::remove_brush_loc(const gamemap::location& hex)
+{
+       brush_locations_.erase(hex);
+       invalidate(hex);
+}
+
+
 void editor_display::pre_draw()
 {
 }
@@ -32,6 +61,8 @@
 image::TYPE editor_display::get_image_type(const gamemap::location& loc)
 {
     if(loc == mouseoverHex_ && map_.on_board_with_border(mouseoverHex_)) {
+        return image::BRIGHTENED;
+       } else if (brush_locations_.find(loc) != brush_locations_.end()) {
         return image::BRIGHTENED;
     } else if (highlighted_locations_.find(loc) != 
highlighted_locations_.end()) {
         return image::SEMI_BRIGHTENED;

Modified: trunk/src/editor2/editor_display.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_display.hpp?rev=28041&r1=28040&r2=28041&view=diff
==============================================================================
--- trunk/src/editor2/editor_display.hpp (original)
+++ trunk/src/editor2/editor_display.hpp Tue Jul 15 16:01:15 2008
@@ -27,6 +27,11 @@
 
        bool in_editor() const { return true; }
 
+       void add_brush_loc(const gamemap::location& hex);
+       void set_brush_locs(const std::set<gamemap::location>& hexes); 
+       void clear_brush_locs();
+       void remove_brush_loc(const gamemap::location& hex);
+
 protected:
        const editor_map& map() { return static_cast<const editor_map&>(map_); }
        void pre_draw();
@@ -36,6 +41,8 @@
        image::TYPE get_image_type(const gamemap::location& loc);
        const SDL_Rect& get_clip_rect();
        void draw_sidebar();
+       
+       std::set<gamemap::location> brush_locations_;
 };
 
 } //end namespace editor2


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

Reply via email to