wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth src/mapgen.cpp src/mapgen_dialog.cpp sr...


From: David White
Subject: [Wesnoth-cvs-commits] wesnoth src/mapgen.cpp src/mapgen_dialog.cpp sr...
Date: Sat, 09 Oct 2004 15:56:28 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    04/10/09 19:49:20

Modified files:
        src            : mapgen.cpp mapgen_dialog.cpp mapgen_dialog.hpp 
        data/scenarios/multiplayer: Random_Scenario.cfg 

Log message:
        improved random map generation

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/mapgen.cpp.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/mapgen_dialog.cpp.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/mapgen_dialog.hpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/data/scenarios/multiplayer/Random_Scenario.cfg.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: wesnoth/data/scenarios/multiplayer/Random_Scenario.cfg
diff -u wesnoth/data/scenarios/multiplayer/Random_Scenario.cfg:1.3 
wesnoth/data/scenarios/multiplayer/Random_Scenario.cfg:1.4
--- wesnoth/data/scenarios/multiplayer/Random_Scenario.cfg:1.3  Sun Aug  8 
00:40:41 2004
+++ wesnoth/data/scenarios/multiplayer/Random_Scenario.cfg      Sat Oct  9 
19:49:20 2004
@@ -25,10 +25,10 @@
        {SECOND_WATCH}
        [/scenario]
 name=default
-map_width=60
-map_height=60
-iterations=1000
-hill_size=10
+map_width=40
+map_height=40
+iterations=2000
+hill_size=6
 max_lakes=40
 villages=25
 players=2
@@ -36,8 +36,8 @@
 lake_size=150
 river_frequency=20
 
-temperature_iterations=1000
-temperature_size=10
+temperature_iterations=2000
+temperature_size=4
 
 default_convert=g
 
@@ -47,15 +47,15 @@
        #list of common terrain types which come in at
        #different heights, from highest to lowest
        [height]
-       height=500
+       height=600
        terrain=m
        [/height]
        [height]
-       height=400
+       height=500
        terrain=h
        [/height]
        [height]
-       height=40
+       height=100
        terrain=g
        [/height]
        [height]
Index: wesnoth/src/mapgen.cpp
diff -u wesnoth/src/mapgen.cpp:1.44 wesnoth/src/mapgen.cpp:1.45
--- wesnoth/src/mapgen.cpp:1.44 Wed Aug 25 02:59:51 2004
+++ wesnoth/src/mapgen.cpp      Sat Oct  9 19:49:20 2004
@@ -802,13 +802,14 @@
        std::cerr << "done generating rivers...\n";
        std::cerr << (SDL_GetTicks() - ticks) << "\n"; ticks = SDL_GetTicks();
 
+       const size_t default_dimensions = 40*40*9;
 
        //convert grassland terrain to other types of flat terrain.
        //we generate a 'temperature map' which uses the height generation 
algorithm to
        //generate the temperature levels all over the map. Then we can use a 
combination
        //of height and terrain to divide terrain up into more interesting 
types than the default
        const height_map temperature_map = generate_height_map(width,height,
-                                                              
atoi(cfg["temperature_iterations"].c_str()),
+                                                              
(atoi(cfg["temperature_iterations"].c_str())*width*height)/default_dimensions,
                                                                                
                                   atoi(cfg["temperature_size"].c_str()),0,0);
 
        std::cerr << "generated temperature map...\n";
@@ -975,7 +976,7 @@
                                //convert to bridge means that we want to 
convert depending
                                //upon the direction the road is going.
                                //typically it will be in a format like,
-                               //convert_to_bridge=|,/,\
+                               //convert_to_bridge=|,/,\ 
                                // '|' will be used if the road is going 
north-south
                                // '/' will be used if the road is going south 
west-north east
                                // '\' will be used if the road is going south 
east-north west
Index: wesnoth/src/mapgen_dialog.cpp
diff -u wesnoth/src/mapgen_dialog.cpp:1.25 wesnoth/src/mapgen_dialog.cpp:1.26
--- wesnoth/src/mapgen_dialog.cpp:1.25  Sat Sep 25 19:46:33 2004
+++ wesnoth/src/mapgen_dialog.cpp       Sat Oct  9 19:49:20 2004
@@ -30,6 +30,9 @@
                if(height > 0)
                        height_ = height;
 
+               default_width_ = width_;
+               default_height_ = height_;
+
                const int iterations = ::atoi((*cfg)["iterations"].c_str());
                if(iterations > 0)
                        iterations_ = iterations;
@@ -125,8 +128,8 @@
        players_slider.set_value(nplayers_);
 
        const int min_width = 20;
-       const int max_width = 200;
-       const int max_height = 200;
+       const int max_width = 100;
+       const int max_height = 100;
        const int extra_size_per_player = 2;
        
        slider_rect.y = width_rect.y;
@@ -270,14 +273,15 @@
 
 std::string default_map_generator::generate_map(const 
std::vector<std::string>& args, std::map<gamemap::location,std::string>* labels)
 {
-       size_t iterations = iterations_;
+       const size_t hill_size = 
(hill_size_*width_*height_)/(default_width_*default_height_);
+       size_t iterations = 
(iterations_*width_*height_)/(default_width_*default_height_);
        size_t island_size = 0;
        size_t island_off_center = 0;
        size_t max_lakes = max_lakes_;
 
        if(island_size_ >= max_coastal) {
 
-               //islands look good with much fewer iterations than normal, and 
fewer lakes
+               //islands look good with much fewer iterations than normal, and 
fewer lake
                iterations /= 10;
                max_lakes /= 9;
 
Index: wesnoth/src/mapgen_dialog.hpp
diff -u wesnoth/src/mapgen_dialog.hpp:1.9 wesnoth/src/mapgen_dialog.hpp:1.10
--- wesnoth/src/mapgen_dialog.hpp:1.9   Tue Jul 20 11:56:58 2004
+++ wesnoth/src/mapgen_dialog.hpp       Sat Oct  9 19:49:20 2004
@@ -20,7 +20,7 @@
 
        std::string generate_map(const std::vector<std::string>& args, 
std::map<gamemap::location,std::string>* labels=NULL);
 
-       size_t width_, height_, island_size_, iterations_, hill_size_, 
max_lakes_, nvillages_, nplayers_;
+       size_t default_width_, default_height_, width_, height_, island_size_, 
iterations_, hill_size_, max_lakes_, nvillages_, nplayers_;
        bool link_castles_;
        config cfg_;
 };




reply via email to

[Prev in Thread] Current Thread [Next in Thread]