Author: ilor
Date: Fri Apr  4 19:31:07 2008
New Revision: 25544

URL: http://svn.gna.org/viewcvs/wesnoth?rev=25544&view=rev
Log:
Applied patch #1027 fixing possible label issues with repeated calls to the 
random map generator

Modified:
    trunk/src/mapgen_dialog.cpp

Modified: trunk/src/mapgen_dialog.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mapgen_dialog.cpp?rev=25544&r1=25543&r2=25544&view=diff
==============================================================================
--- trunk/src/mapgen_dialog.cpp (original)
+++ trunk/src/mapgen_dialog.cpp Fri Apr  4 19:31:07 2008
@@ -357,14 +357,21 @@
 
        // A map generator can fail so try a few times to get a map before 
aborting.
        std::string map;
+       // Keep a copy of labels as it can be written to by the map generator 
func
+       std::map<gamemap::location,std::string> labels_copy;
        int tries = 10;
        do {
+               if (labels) {
+                               labels_copy = *labels;
+               }
                map = default_generate_map(width_, height_, island_size, 
island_off_center,
                        iterations, hill_size_, max_lakes, (nvillages_ * width_ 
* height_) / 1000,
                        castle_size_, nplayers_, link_castles_, labels, cfg_);
                --tries; 
        } while (tries && map.empty());
-
+       if (labels) {
+               labels->swap(labels_copy);
+       }
        return map;
 }
 


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

Reply via email to