Author: fendrin
Date: Wed Apr 13 06:11:12 2011
New Revision: 49188

URL: http://svn.gna.org/viewcvs/wesnoth?rev=49188&view=rev
Log:
[item] is now map specific.

Modified:
    branches/editor/src/display.cpp
    branches/editor/src/display.hpp
    branches/editor/src/editor/editor_display.hpp
    branches/editor/src/wml/item.cpp
    branches/editor/src/wml/item.hpp

Modified: branches/editor/src/display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/editor/src/display.cpp?rev=49188&r1=49187&r2=49188&view=diff
==============================================================================
--- branches/editor/src/display.cpp (original)
+++ branches/editor/src/display.cpp Wed Apr 13 06:11:12 2011
@@ -336,9 +336,8 @@
 const map_location display::hex_clicked_on(int xclick, int yclick) const
 {
        const SDL_Rect& rect = map_area();
-       if(point_in_rect(xclick,yclick,rect) == false) {
+       if(point_in_rect(xclick,yclick,rect) == false)
                return map_location();
-       }
 
        xclick -= rect.x;
        yclick -= rect.y;
@@ -353,9 +352,9 @@
        // adjust for the border
        x -= static_cast<int>(theme_.border().size * hex_width());
        y -= static_cast<int>(theme_.border().size * hex_size());
-       // The editor can modify the border and this will result in a negative y
-       // value. Instead of adding extra cases we just shift the hex. Since the
-       // editor doesn't use the direction this is no problem.
+       /* The editor can modify the border and this will result in a negative 
y value.
+        * Instead of adding extra cases we just shift the hex.
+        * Since the editor doesn't use the direction this is no problem. */
        const int offset = y < 0 ? 1 : 0;
        if(offset) {
                x += hex_width();
@@ -1435,9 +1434,7 @@
        const SDL_Rect& area = minimap_area();
        if(minimap_ == NULL || minimap_->w > area.w || minimap_->h > area.h) {
                minimap_ = image::getMinimap(area.w, area.h, get_map(), 
viewpoint_);
-               if(minimap_ == NULL) {
-                       return;
-               }
+               if(minimap_ == NULL) return;
        }
 
        const surface screen(screen_.getSurface());
@@ -1491,8 +1488,7 @@
        const int dy = orig_y - ypos_; // dy = -ymove
 
        // Only invalidate if we've actually moved
-       if(dx == 0 && dy == 0)
-               return false;
+       if(dx == 0 && dy == 0) return false;
 
        font::scroll_floating_labels(dx, dy);
 
@@ -1767,9 +1763,7 @@
                r.y += spacing;
                r.w -= 2*spacing;
                r.h -= 2*spacing;
-               if (!outside_area(r, minx,miny) && !outside_area(r, maxx,maxy)) 
{
-                       return;
-               }
+               if (!outside_area(r, minx,miny) && !outside_area(r, maxx,maxy)) 
return;
        }
 
        // let's do "normal" rectangle math from now on
@@ -1891,8 +1885,7 @@
 
 void display::redraw_everything()
 {
-       if(screen_.update_locked())
-               return;
+       if(screen_.update_locked()) return;
 
        invalidateGameStatus_ = true;
 
@@ -1966,9 +1959,7 @@
 void display::draw(bool update,bool force) {
        //TODO comment or remove
        //      log_scope("display::draw");
-       if (screen_.update_locked()) {
-               return;
-       }
+       if (screen_.update_locked()) return;
 
        local_tod_light_ = has_time_area() && 
preferences::get("local_tod_light", false);
 
@@ -2071,15 +2062,12 @@
 
                const bool on_map = get_map().on_board(loc);
                SDL_Rect hex_rect = create_rect(xpos, ypos, zoom_, zoom_);
-               if(!rects_overlap(hex_rect,clip_rect)) {
-                       continue;
-               }
+               if(!rects_overlap(hex_rect,clip_rect)) continue;
+
                draw_hex(loc);
                drawn_hexes_+=1;
                // If the tile is at the border, we start to blend it
-               if(!on_map) {
-                       draw_border(loc, xpos, ypos);
-               }
+               if(!on_map) draw_border(loc, xpos, ypos);
 
                unit_map::iterator u_it = get_units().find(loc);
                exclusive_unit_draw_requests_t::iterator request = 
exclusive_unit_draw_requests_.find(loc);
@@ -2139,9 +2127,8 @@
        }
 
        // Paint mouseover overlays
-       if(loc == mouseoverHex_ && (on_map || (in_editor() && 
get_map().on_board_with_border(loc))) && mouseover_hex_overlay_ != NULL) {
+       if(loc == mouseoverHex_ && (on_map || (in_editor() && 
get_map().on_board_with_border(loc))) && mouseover_hex_overlay_ != NULL)
                drawing_buffer_add(LAYER_MOUSEOVER_OVERLAY, loc, xpos, ypos, 
mouseover_hex_overlay_);
-       }
 
        // Paint arrows
        arrows_map_t::const_iterator arrows_in_hex = arrows_map_.find(loc);
@@ -2152,10 +2139,8 @@
        }
 
        // Apply shroud, fog and linger overlay
-
        if(shrouded(loc)) {
-               // We apply void also on off-map tiles
-               // to shroud the half-hexes too
+               // We apply void also on off-map tiles to shroud the half-hexes 
too
                const std::string& shroud_image = get_variant(shroud_images_, 
loc);
                drawing_buffer_add(LAYER_FOG_SHROUD, loc, xpos, ypos,
                                image::get_image(shroud_image, image_type));
@@ -2165,9 +2150,8 @@
                                image::get_image(fog_image, image_type));
        }
 
-       if(!shrouded(loc)) {
+       if(!shrouded(loc))
                drawing_buffer_add(LAYER_FOG_SHROUD, loc, xpos, ypos, 
get_fog_shroud_images(loc, image_type));
-       }
 
        if(on_map && loc == mouseoverHex_) {
                drawing_buffer_add(LAYER_MOUSEOVER_TOP,
@@ -2175,7 +2159,6 @@
                drawing_buffer_add(LAYER_MOUSEOVER_BOTTOM,
                                loc, xpos, ypos, 
image::get_image("misc/hover-hex-bottom.png", image::SCALED_TO_HEX));
        }
-
 
        if (on_map) {
                if (draw_coordinates_) {
@@ -2214,8 +2197,6 @@
                drawing_buffer_add(LAYER_UNIT_DEFAULT, loc, xpos, ypos,
                                image::get_image("terrain/foreground.png", 
image_type));
        }
-
-
 }
 
 image::TYPE display::get_image_type(const map_location& /*loc*/) {
@@ -2223,9 +2204,8 @@
 }
 
 void display::draw_sidebar() {
-
-}
-
+//TODO better make pure virtual?
+}
 
 void display::draw_image_for_report(surface& img, SDL_Rect& rect)
 {
@@ -2468,8 +2448,7 @@
 
 bool display::invalidate(const map_location& loc)
 {
-       if(invalidateAll_)
-               return false;
+       if(invalidateAll_) return false;
 
        bool tmp;
 #ifdef _OPENMP
@@ -2481,8 +2460,7 @@
 
 bool display::invalidate(const std::set<map_location>& locs)
 {
-       if(invalidateAll_)
-               return false;
+       if(invalidateAll_) return false;
        bool ret = false;
        foreach (const map_location& loc, locs) {
 #ifdef _OPENMP
@@ -2495,11 +2473,9 @@
 
 bool display::propagate_invalidation(const std::set<map_location>& locs)
 {
-       if(invalidateAll_)
-               return false;
-
-       if(locs.size()<=1)
-               return false; // propagation never needed
+       if(invalidateAll_) return false;
+
+       if(locs.size()<=1) return false; // propagation never needed
 
        bool result = false;
 #ifdef _OPENMP
@@ -2511,7 +2487,6 @@
                for(; i != locs.end() && invalidated_.count(*i) == 0 ; ++i) {}
 
                if (i != locs.end()) {
-
                        // propagate invalidation
                        // 'i' is already in, but I suspect that splitting the 
range is bad
                        // especially because locs are often adjacents
@@ -2530,8 +2505,7 @@
 
 bool display::invalidate_locations_in_rect(const SDL_Rect& rect)
 {
-       if(invalidateAll_)
-               return false;
+       if(invalidateAll_) return false;
 
        bool result = false;
        foreach (const map_location &loc, hexes_under_rect(rect)) {
@@ -2674,9 +2648,7 @@
        // is bad for calculate_energy_bar.
        // But we will do a geometric scaling later.
        surface bar_surf(image::get_image(image));
-       if(surf == NULL || bar_surf == NULL) {
-               return;
-       }
+       if(surf == NULL || bar_surf == NULL) return;
 
        // calculate_energy_bar returns incorrect results if the surface colors
        // have changed (for example, due to bilinear interpolation)
@@ -2696,9 +2668,7 @@
          bar_loc = scaled_bar_loc;
        }
 
-       if(height > bar_loc.h) {
-               height = bar_loc.h;
-       }
+       if(height > bar_loc.h) height = bar_loc.h;
 
        /* TODO old stuff from before the editor branch: comment or remove
        if(alpha != ftofxp(1.0)) {
@@ -2739,9 +2709,7 @@
 const SDL_Rect& display::calculate_energy_bar(surface surf)
 {
        const std::map<surface,SDL_Rect>::const_iterator i = 
energy_bar_rects_.find(surf);
-       if(i != energy_bar_rects_.end()) {
-               return i->second;
-       }
+       if(i != energy_bar_rects_.end()) return i->second;
 
        int first_row = -1, last_row = -1, first_col = -1, last_col = -1;
 
@@ -2757,9 +2725,7 @@
                const int count = std::count_if(itor,i2,is_energy_color());
 
                if(itor != i2) {
-                       if(first_row == -1) {
-                               first_row = y;
-                       }
+                       if(first_row == -1) first_row = y;
 
                        first_col = itor - i1;
                        last_col = first_col + count;

Modified: branches/editor/src/display.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/editor/src/display.hpp?rev=49188&r1=49187&r2=49188&view=diff
==============================================================================
--- branches/editor/src/display.hpp (original)
+++ branches/editor/src/display.hpp Wed Apr 13 06:11:12 2011
@@ -488,7 +488,7 @@
         * If update is true, will also copy the display to the frame buffer.
         * If force is true, will not skip frames, even if running behind.
         * Not virtual, since it gathers common actions.
-        * Calls various protected virtuals (further below) to allow 
specialized behaviour in derived classes.
+        * Calls various protected virtuals (further below) to allow 
specialized behavior in derived classes.
         */
        void draw(bool update=true, bool force=false);
 
@@ -689,7 +689,7 @@
                                            * Unit bars and overlays are drawn 
on this
                                            * layer (for testing here).
                                            */
-               LAYER_MOVE_INFO,           /**< Movement info (defense%, 
ect...). */
+               LAYER_MOVE_INFO,           /**< Movement info (defense%, 
etc...). */
                LAYER_LINGER_OVERLAY,      /**< The overlay used for the linger 
mode. */
                LAYER_BORDER,              /**< The border of the map. */
 

Modified: branches/editor/src/editor/editor_display.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/editor/src/editor/editor_display.hpp?rev=49188&r1=49187&r2=49188&view=diff
==============================================================================
--- branches/editor/src/editor/editor_display.hpp (original)
+++ branches/editor/src/editor/editor_display.hpp Wed Apr 13 06:11:12 2011
@@ -29,8 +29,6 @@
 
        editor_display(CVideo& video, const editor_map& map, const config& 
theme_cfg,
                        const config& level);
-
-       //editor_display(CVideo& video, const config& theme_cfg);
 
        bool in_editor() const { return true; }
 

Modified: branches/editor/src/wml/item.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/editor/src/wml/item.cpp?rev=49188&r1=49187&r2=49188&view=diff
==============================================================================
--- branches/editor/src/wml/item.cpp (original)
+++ branches/editor/src/wml/item.cpp Wed Apr 13 06:11:12 2011
@@ -13,18 +13,11 @@
 */
 
 #include "item.hpp"
+
 #include "foreach.hpp"
 #include "display.hpp"
 
 item_overlay_map::~item_overlay_map() {
-
-//     item_map::iterator iter = items_.begin();
-//     while (iter != items_.end())
-//     {
-//             halo::remove(itors.first->second.get_halo_handle());
-//     }
-
-//TODO implement
        items_.clear();
 }
 
@@ -45,7 +38,6 @@
                        loc_y + hex_size / 2, halo, loc);
 
        item_overlay item = item_overlay(img, halo, halo_handle, team_name, 
visible_under_fog);
-
        items_.insert(item_map::value_type(loc, item));
 }
 

Modified: branches/editor/src/wml/item.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/editor/src/wml/item.hpp?rev=49188&r1=49187&r2=49188&view=diff
==============================================================================
--- branches/editor/src/wml/item.hpp (original)
+++ branches/editor/src/wml/item.hpp Wed Apr 13 06:11:12 2011
@@ -27,8 +27,6 @@
 public:
 
        item_overlay_map() : items_() {}
-       //TODO implement or remove
-       item_overlay_map(const item_overlay_map& /*other*/) : items_() { }
        item_overlay_map(config cfg);
        ~item_overlay_map();
        item_overlay_map& operator= (const item_overlay_map& other);
@@ -53,8 +51,6 @@
 {
 public:
 
-       //TODO implement
-       item_overlay(const item_overlay& /*other*/) {}
        item_overlay(const std::string& img, const std::string& halo_img,
                        int handle, const std::string& overlay_team_name, const 
bool fogged)
                : image_(img), halo_(halo_img), team_name_(overlay_team_name),
@@ -62,8 +58,6 @@
 
        item_overlay(config& cfg);
        ~item_overlay();
-       //TODO implement
-       item_overlay& operator= (const item_overlay& /*other*/) { return 
*this;};
 
        std::string get_image() const { return image_; }
        std::string get_halo() const { return halo_; }


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

Reply via email to