mail[Wesnoth-commits] r28395 - /trunk/src/editor2/editor_map.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by kailoran on August 08, 2008 - 22:35:
Author: ilor
Date: Fri Aug  8 22:35:23 2008
New Revision: 28395

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28395&view=rev
Log:
editor2: more sanity checks and fix two fencepost errors making resize work 
all of the time

Modified:
    trunk/src/editor2/editor_map.cpp

Modified: trunk/src/editor2/editor_map.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/editor_map.cpp?rev=28395&r1=28394&r2=28395&view=diff
==============================================================================
--- trunk/src/editor2/editor_map.cpp (original)
+++ trunk/src/editor2/editor_map.cpp Fri Aug  8 22:35:23 2008
@@ -62,6 +62,12 @@
        if (h() + 2 * border_size() != total_height()) {
                ERR_ED << "w is " << w_ << " and border_size is " << 
border_size() << " but total_height is " << total_height() << "\n";
                ++errors;
+       }
+       for (size_t i = 1; i < tiles_.size(); ++i) {
+               if (tiles_[i].size() != tiles_[0].size()) {
+                       ERR_ED << "tiles_[ " << i << "] has size() " << 
tiles_[i].size() << " but tiles[0] has size() " << tiles_[0].size() << "\n";
+                       ++errors;
+               }
        }
        if (errors) {
                throw editor_map_integrity_error();
@@ -195,6 +201,7 @@
                        }
                }
        }
+       sanity_check();
 }
 
 void editor_map::flip_x()
@@ -223,6 +230,7 @@
                        }
                }
        }
+       sanity_check();
 }
 
 void editor_map::flip_y()
@@ -270,7 +278,7 @@
 {
        int w = tiles_.size();
        for (int x = 0; x < count; ++x) {
-               tiles_.push_back(clone_column(w, filler));
+               tiles_.push_back(clone_column(w - 1     , filler));
        }
        w_ += count;
        total_width_ += count;
@@ -311,7 +319,7 @@
                        t_translation::t_terrain terrain =
                                filler != t_translation::NONE_TERRAIN ?
                                filler :
-                               tiles_[x][h];
+                               tiles_[x][h - 1];
                        assert(terrain != t_translation::NONE_TERRAIN);
                        tiles_[x].push_back(terrain);
                }




Related Messages


Powered by MHonArc, Updated Fri Aug 08 23:01:45 2008