Author: esr
Date: Sun Jun 24 12:27:04 2007
New Revision: 18433

URL: http://svn.gna.org/viewcvs/wesnoth?rev=18433&view=rev
Log:
Pull image type computation ourt of drawe_tile(), as a step towards lifting 
it into the map_display class. 

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

Modified: trunk/src/display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.cpp?rev=18433&r1=18432&r2=18433&view=diff
==============================================================================
--- trunk/src/display.cpp (original)
+++ trunk/src/display.cpp Sun Jun 24 12:27:04 2007
@@ -1281,7 +1281,21 @@
                        }
                        const time_of_day& tod = status_.get_time_of_day();
                        const time_of_day& tod_at = 
timeofday_at(status_,units_,*it,map_);
-                       draw_tile(*it, tod, tod_at, clip_rect);
+                       image::TYPE image_type = image::SCALED_TO_HEX;
+
+
+                       unit_map::iterator un = find_visible_unit(units_, *it, 
map_, 
+                                                       
teams_,teams_[currentTeam_]);
+
+                       if(*it == mouseoverHex_ && map_.on_board(mouseoverHex_) 
||
+                          *it == selectedHex_ && (un != units_.end())) {
+                               image_type = image::BRIGHTENED;
+                       }
+                       else if (highlighted_locations_.find(*it) != 
highlighted_locations_.end()) {
+                               image_type = image::SEMI_BRIGHTENED;
+                       }
+
+                       draw_tile(*it, tod, tod_at, image_type, clip_rect);
                        simulate_delay += 1;
                }
 
@@ -1733,7 +1747,7 @@
        }
 }
 
-void display::draw_tile(const gamemap::location &loc, const time_of_day& tod, 
const time_of_day & tod_at, const SDL_Rect &clip_rect)
+void display::draw_tile(const gamemap::location &loc, const time_of_day& tod, 
const time_of_day & tod_at, image::TYPE image_type, const SDL_Rect &clip_rect)
 {
        if(screen_.update_locked()) {
                return;
@@ -1764,20 +1778,7 @@
                terrain = map_.get_terrain(loc);
        }
 
-       image::TYPE image_type = image::SCALED_TO_HEX;
-
        std::string mask = tod_at.image_mask;
-
-       unit_map::iterator un = find_visible_unit(units_, loc, map_, 
-                                       teams_,teams_[currentTeam_]);
-
-       if(loc == mouseoverHex_ && map_.on_board(mouseoverHex_) ||
-          loc == selectedHex_ && (un != units_.end())) {
-               image_type = image::BRIGHTENED;
-       }
-       else if (highlighted_locations_.find(loc) != 
highlighted_locations_.end()) {
-               image_type = image::SEMI_BRIGHTENED;
-       }
 
        if(!is_shrouded /*|| !on_map*/) {
          draw_terrain_on_tile(loc, tod, image_type, ADJACENT_BACKGROUND);

Modified: trunk/src/display.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.hpp?rev=18433&r1=18432&r2=18433&view=diff
==============================================================================
--- trunk/src/display.hpp (original)
+++ trunk/src/display.hpp Sun Jun 24 12:27:04 2007
@@ -487,7 +487,7 @@
        display(const display&);
        void operator=(const display&);
 
-       void draw_tile(const gamemap::location &loc, const time_of_day& tod, 
const time_of_day& tod_at, const SDL_Rect &clip_rect);
+       void draw_tile(const gamemap::location &loc, const time_of_day& tod, 
const time_of_day& tod_at, image::TYPE image_type, const SDL_Rect &clip_rect);
        void draw_sidebar();
        void draw_minimap(int x, int y, int w, int h);
        void draw_game_status();


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

Reply via email to