Author: mordante
Date: Tue Feb 26 19:40:56 2008
New Revision: 24088

URL: http://svn.gna.org/viewcvs/wesnoth?rev=24088&view=rev
Log:
Fix a bug where the random map generator could place a keep on the border
(bug #11150).

Modified:
    trunk/changelog
    trunk/src/cavegen.hpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=24088&r1=24087&r2=24088&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Tue Feb 26 19:40:56 2008
@@ -18,6 +18,8 @@
    * cleanups and a compiler fix based on patch #911
    * the detection of the savegame version was done after parsing the savegame
      this could lead to crashes when loading 1.2 savegames (debian bug 467088)
+   * fix a bug where the random map generator could place a keep on the border
+     (bug #11150)
 
 Version 1.3.19:
  * map editor:

Modified: trunk/src/cavegen.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/cavegen.hpp?rev=24088&r1=24087&r2=24088&view=diff
==============================================================================
--- trunk/src/cavegen.hpp (original)
+++ trunk/src/cavegen.hpp Tue Feb 26 19:40:56 2008
@@ -61,10 +61,13 @@
 
        void place_passage(const passage& p);
 
-       bool on_board(const gamemap::location& loc) const
-               { return loc.x >= 0 && loc.y >= 0 &&
-            loc.x < static_cast<long>(width_) &&
-            loc.y < static_cast<long>(height_); }
+       // Note we assume a border size of 1.
+       bool on_board(const gamemap::location& loc) const 
+       {
+               return loc.x > 0 && loc.y > 0 &&
+                       loc.x < static_cast<long>(width_ - 1) &&
+                       loc.y < static_cast<long>(height_ - 1); 
+       }
 
        void set_terrain(gamemap::location loc, t_translation::t_terrain t);
        void place_castle(const std::string& side, gamemap::location loc);


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

Reply via email to