mail[Wesnoth-commits] r14024 - in /branches/mordante_terrain: ./ data/terrain-graphics/ src/


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

Header


Content

Posted by koraq on October 19, 2006 - 22:44:
Author: mordante
Date: Thu Oct 19 22:44:08 2006
New Revision: 14024

URL: http://svn.gna.org/viewcvs/wesnoth?rev=14024&view=rev
Log:
Did some changes to the terrain system but still broken, some transitions 
fail and villages and forrest are not drawn.
The new terrain_graphics map parser doesn't like blank trailing lines so 
removed them from the terrain cfg files.
Commit r13938 and r14023 will give conflicts here so did the change here 
again.

Modified:
    branches/mordante_terrain/TODO
    branches/mordante_terrain/data/terrain-graphics/adjacent.cfg
    branches/mordante_terrain/data/terrain-graphics/castle-transitions.cfg
    branches/mordante_terrain/data/terrain-graphics/forests.cfg
    branches/mordante_terrain/data/terrain-graphics/util.cfg
    branches/mordante_terrain/src/builder.cpp
    branches/mordante_terrain/src/unit.cpp
    branches/mordante_terrain/src/unit_types.cpp

Modified: branches/mordante_terrain/TODO
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/mordante_terrain/TODO?rev=14024&r1=14023&r2=14024&view=diff
==============================================================================
--- branches/mordante_terrain/TODO (original)
+++ branches/mordante_terrain/TODO Thu Oct 19 22:44:08 2006
@@ -1,9 +1,11 @@
+src/builder.cpp:251:                           s = s.substr(0, 
s.find_first_of(",:")); // FIXME MdW DEBUG here
 src/builder.cpp:598://FIXME MdW this is a total rewrite not sure whether is 
really works
-src/builder.cpp:1095:                                  //FIXME MdW the 
previous code set the value to an empty
+src/builder.cpp:853:                   // FIXME MdW should be set_list
+src/builder.cpp:1139:                                  //FIXME MdW the 
previous code set the value to an empty
 src/game_events.cpp:1136:                      if(terrain_type.size() > 0) { 
//FIXME MdW we need a proper way to set and invalid terrain
 src/game_events.cpp:1138:                              //FIXME MdW cleanup
 src/game_events.cpp:1160:              //FIXME MdW cleanup
-src/game_events.cpp:1753:                              const 
terrain_translation::TERRAIN_NUMBER c = game_map->get_terrain(*j); //FIXME 
MdW test should work
+src/game_events.cpp:1759:                              const 
terrain_translation::TERRAIN_NUMBER c = game_map->get_terrain(*j); //FIXME 
MdW test should work
 src/help.cpp:1280:                     //FIXME MdW cleanup
 src/help.cpp:1295://FIXME MdW enable 
 src/help.cpp:1397://FIXME MdW enable
@@ -15,13 +17,13 @@
 src/help.cpp:1483:                                                           
            (char)terrain_translation::FOGGED), 
show_info_about.end());//FIXME MdW typecast
 src/help.cpp:1488://FIXME MdW make it work again               
 src/map.cpp:82://FIXME MdW rename the ones below to the name of the ones 
above and kill the ones above
-src/map.cpp:96:                //FIXME MdW debug hack use the one below once 
the error is found
-src/map.cpp:181:       if(str == "n") { //FIXME MdW case??
-src/map.cpp:410://FIXME MdW the entire routine should be cleaned up
-src/map.cpp:502:#if 0   //FIXME MdW remove enable
-src/map.cpp:556:                               //FIXME MdW cleanup
-src/map.cpp:684:#if 1 //FIXME MdW remove the if
-src/map.cpp:696://FIXME MdW enable                             
+src/map.cpp:168:       std::string loc_terrain; //FIXME MdW tag
+src/map.cpp:175:       if(str == "n") { //FIXME MdW case??
+src/map.cpp:404://FIXME MdW the entire routine should be cleaned up
+src/map.cpp:496:#if 0   //FIXME MdW remove enable
+src/map.cpp:550:                               //FIXME MdW cleanup
+src/map.cpp:678:#if 1 //FIXME MdW remove the if
+src/map.cpp:690://FIXME MdW enable                             
 src/map_create.cpp:54://       return 
generator.get()->create_map(parameters); FIXME MdW enable
 src/mapgen.cpp:342:    mutable std::map<char,double> cache_; //FIXME MdW are 
we allowed to be char
 src/mapgen.cpp:362:    const char c = map_[loc.x][loc.y]; //FIXME MdW are we 
allowed to be char
@@ -40,20 +42,17 @@
 src/multiplayer_create.cpp:364:                                //FIXME MdW 
we do a double conversion, might be nice to have a direct way
 src/terrain.cpp:42:    //FIXME MdW remove obsolete part
 src/terrain.cpp:52:    //FIXME MdW what do the next 4 lines do?? guess 
nothing, since seems to be overwritten
-src/terrain.cpp:126:   //FIXME MdW test the union
-src/terrain.cpp:164://FIXME MdW obsolete
-src/terrain.cpp:182://FIXME MdW obsolete
-src/terrain.cpp:254:   //FIXME MdW is an empty letter allowed???
+src/terrain.cpp:128:   //FIXME MdW test the union
+src/terrain.cpp:166://FIXME MdW obsolete
+src/terrain.cpp:184://FIXME MdW obsolete
+src/terrain.cpp:256:   //FIXME MdW is an empty letter allowed???
 src/terrain.hpp:49:    //FIXME MdW rename the ones below to the name of the 
ones above and kill the ones above
 src/terrain.hpp:87:    //FIXME MdW rename these as soon as the originals are 
killed
 src/terrain.hpp:100:   //FIXME MdW remove
-src/terrain_translation.cpp:67:        //FIXME MdW is an empty letter 
allowed???
-src/terrain_translation.cpp:106://FIXME MdW make a generic function which 
gets a string, since only the vconfig is different
-src/terrain_translation.cpp:220:       //FIXME MdW remove assigment, only 
used as debug aid
+src/terrain_translation.cpp:139:       //FIXME MdW remove assigment, only 
used as debug aid
 src/terrain_translation.hpp:15://FIXME MdW is Makefile.am good modified
 src/unit_animation.cpp:101://FIXME MdW not sure what the terrain string is 
but guess 
 src/unit_animation.cpp:148:            //FIXME MdW enable change to 
underlying_union_terrain2 doesn't work
-src/unit.cpp:2147:     //FIXME MdW cleanup
-src/unit.cpp:2150:     if(underlying.size() == 0) { //FIXME MdW debug hack
-src/unit.cpp:2234:     //FIXME MdW cleanup
+src/unit.cpp:2149:     //FIXME MdW cleanup
+src/unit.cpp:2152:     if(underlying.size() == 0) { //FIXME MdW debug hack
 src/unit_types.cpp:408:        //FIXME MdW cleanup

Modified: branches/mordante_terrain/data/terrain-graphics/adjacent.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/mordante_terrain/data/terrain-graphics/adjacent.cfg?rev=14024&r1=14023&r2=14024&view=diff
==============================================================================
--- branches/mordante_terrain/data/terrain-graphics/adjacent.cfg (original)
+++ branches/mordante_terrain/data/terrain-graphics/adjacent.cfg Thu Oct 19 
22:44:08 2006
@@ -12,8 +12,7 @@
 .   3
   1
 .   4
-  5
-"
+  5"
        [tile]
                pos=1
                type={ADJACENT}
@@ -64,8 +63,7 @@
 .   3
   1
 .   4
-  .
-"
+  ."
        [tile]
                pos=1
                type={ADJACENT}
@@ -110,8 +108,7 @@
 .   3
   1
 .   .
-  .
-"
+  ."
        [tile]
                pos=1
                type={ADJACENT}
@@ -151,8 +148,7 @@
 .   .
   1
 .   .
-  .
-"
+  ."
        [tile]
                pos=1
                type={ADJACENT}

Modified: 
branches/mordante_terrain/data/terrain-graphics/castle-transitions.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/mordante_terrain/data/terrain-graphics/castle-transitions.cfg?rev=14024&r1=14023&r2=14024&view=diff
==============================================================================
--- branches/mordante_terrain/data/terrain-graphics/castle-transitions.cfg 
(original)
+++ branches/mordante_terrain/data/terrain-graphics/castle-transitions.cfg 
Thu Oct 19 22:44:08 2006
@@ -20,8 +20,7 @@
        map="
   2
 2   2
-  1
-"
+  1"
        [tile]
                pos=2
                type={CASTLE}
@@ -43,8 +42,7 @@
        map="
   .
 2   2
-  1
-"
+  1"
        [tile]
                pos=2
                type={CASTLE}
@@ -66,8 +64,7 @@
        map="
   2
 2   .
-  1
-"
+  1"
        [tile]
                pos=2
                type={CASTLE}
@@ -89,8 +86,7 @@
        map="
   2
 .   2
-  1
-"
+  1"
        [tile]
                pos=2
                type={CASTLE}
@@ -112,8 +108,7 @@
        map="
   2
 .   .
-  1
-"
+  1"
        [tile]
                pos=2
                type={CASTLE}
@@ -135,8 +130,7 @@
        map="
   2
 .   1
-  .
-"
+  ."
        [tile]
                pos=2
                type={CASTLE}
@@ -158,8 +152,7 @@
        map="
   2
 1   .
-  .
-"
+  ."
        [tile]
                pos=2
                type={CASTLE}

Modified: branches/mordante_terrain/data/terrain-graphics/forests.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/mordante_terrain/data/terrain-graphics/forests.cfg?rev=14024&r1=14023&r2=14024&view=diff
==============================================================================
--- branches/mordante_terrain/data/terrain-graphics/forests.cfg (original)
+++ branches/mordante_terrain/data/terrain-graphics/forests.cfg Thu Oct 19 
22:44:08 2006
@@ -7,8 +7,7 @@
 2   4
   1
 .   .
-  .
-"
+  ."
        [tile]
                pos=1
                type={ADJACENT}
@@ -47,8 +46,7 @@
 2   .
   1
 .   .
-  .
-"
+  ."
        [tile]
                pos=1
                type={ADJACENT}
@@ -81,8 +79,7 @@
 .   4
   1
 .   .
-  .
-"
+  ."
        [tile]
                pos=1
                type={ADJACENT}
@@ -115,8 +112,7 @@
 2   .
   1
 .   .
-  .
-"
+  ."
        [tile]
                pos=1
                type={ADJACENT}
@@ -144,8 +140,7 @@
 .   .
   1
 .   .
-  .
-"
+  ."
        [tile]
                pos=1
                type={ADJACENT}
@@ -172,8 +167,7 @@
 .   2
   1
 .   .
-  .
-"
+  ."
        [tile]
                pos=1
                type={ADJACENT}
@@ -200,8 +194,7 @@
 .   .
   1
 2   4
-  3
-"
+  3"
        [tile]
                pos=1
                type={ADJACENT}
@@ -240,8 +233,7 @@
 .   .
   1
 2   .
-  3
-"
+  3"
        [tile]
                pos=1
                type={ADJACENT}
@@ -274,8 +266,7 @@
 .   .
   1
 .   4
-  3
-"
+  3"
        [tile]
                pos=1
                type={ADJACENT}
@@ -308,8 +299,7 @@
 .   .
   1
 2   .
-  .
-"
+  ."
        [tile]
                pos=1
                type={ADJACENT}
@@ -337,8 +327,7 @@
 .   .
   1
 .   .
-  2
-"
+  2"
        [tile]
                pos=1
                type={ADJACENT}
@@ -365,8 +354,7 @@
 .   .
   1
 .   2
-  .
-"
+  ."
        [tile]
                pos=1
                type={ADJACENT}

Modified: branches/mordante_terrain/data/terrain-graphics/util.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/mordante_terrain/data/terrain-graphics/util.cfg?rev=14024&r1=14023&r2=14024&view=diff
==============================================================================
--- branches/mordante_terrain/data/terrain-graphics/util.cfg (original)
+++ branches/mordante_terrain/data/terrain-graphics/util.cfg Thu Oct 19 
22:44:08 2006
@@ -80,8 +80,7 @@
 6   2
   7
 5   3
-  4
-"
+  4"
        [tile]
                pos=1
                set_flag=overlay-s,transition-s

Modified: branches/mordante_terrain/src/builder.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/mordante_terrain/src/builder.cpp?rev=14024&r1=14023&r2=14024&view=diff
==============================================================================
--- branches/mordante_terrain/src/builder.cpp (original)
+++ branches/mordante_terrain/src/builder.cpp Thu Oct 19 22:44:08 2006
@@ -248,7 +248,7 @@
 
                        for(variant = image->variants.begin(); variant != 
image->variants.end(); ++variant) {
                                std::string s = variant->second.image_string;
-                               s = s.substr(0, s.find_first_of(",:"));
+                               s = s.substr(0, s.find_first_of(",:")); // 
FIXME MdW DEBUG here
 
                                if(!image::exists("terrain/" + s + ".png"))
                                        return false;
@@ -596,6 +596,8 @@
       + The column-number is increased by one.
 */
 //FIXME MdW this is a total rewrite not sure whether is really works
+//has a lot of debug code which should be removed
+//
        int x = 0;
        int y = 0;
        int lineno = 0;
@@ -609,6 +611,9 @@
        std::vector<terrain_translation::TERRAIN_NUMBER> rule;
 
        // eat leading blank lines
+#if 0   
+       std::cerr << "loading map: '" << 
terrain_translation().set_map(mapstring) << "'\n";
+#endif 
        while(*map == terrain_translation::VOID_TERRAIN || *map == 
terrain_translation::EOL){
                // start keep trac of the last beginning of the line
                if(*map == terrain_translation::EOL){
@@ -623,15 +628,19 @@
        map = start;
        lineno = (*map == terrain_translation::VOID_TERRAIN)?1:0;
        x = lineno; //odd lines set the odd X (true???)
+
+       // we're at the start of a line, if odd skip the first 2 items
+       // but make sure we didn't get some half backed data
+       if(lineno == 1) {
+               ++map;
+               wassert(map != mapstring.end());
+               ++map;
+       } else {
+               int debug_dummy = 4;
+       }
+
        // parse the map
        for(;map != mapstring.end();){
-               // we're at the start of a line, if odd skip the first 2 items
-               // but make sure we didn't get some half backed data
-               if(lineno % 2 == 1) {//map += 2;
-                       ++map;
-                       wassert(map != mapstring.end());
-                       ++map;
-               }
 
                // we should try to get a maximum of 4 items but are not 
allowed
                // to get either an EOL or go beyond the vector
@@ -650,6 +659,10 @@
                                ++map;
                        }
                }
+#if 0          
+               std::cerr << "got rule: '" << 
terrain_translation().set_map(rule) << "' at " 
+                       << x << "," << y << "\n";
+#endif                 
                // we the rule evaluate
                // first try to get the rule as a number, do the comparsion 
later
                int anchor = terrain_translation().list_to_int(rule);
@@ -659,6 +672,20 @@
                } else if(anchor != -1) {
                        anchors.insert(std::pair<int, 
gamemap::location>(anchor, gamemap::location(x, y)));
                } else {
+#if 0                  
+                       if(rule.back() == 
(terrain_translation::VOID_TERRAIN)) {
+#endif                         
+                       while(rule.back() == 
(terrain_translation::VOID_TERRAIN)) {
+                               rule.erase(rule.end() - 1);
+                       }
+#if 0
+                               std::cerr << "stripped trailing spaces, new 
rule :'" << terrain_translation().set_map(rule) << "'\n";
+                       }
+#endif                         
+                       // a rule with only spaces is invalid and results in 
an empty rule
+                       wassert(!rule.empty());
+
+                       // add the rule
                        const gamemap::location loc(x, y);
                        add_constraints(br.constraints, loc, rule, 
global_images);
                }
@@ -675,7 +702,15 @@
                                x = 0;
                                // go to the next position in the map
                                ++map;
+//                             wassert(map != mapstring.end());
+//                             ++map;
                        } else {
+                               // eat EOL and 2 leading spaces
+                               ++map;
+                               wassert(map != mapstring.end());
+                               ++map;
+                               wassert(map != mapstring.end());
+                               ++map;
                                x = 1;
                        }
 
@@ -805,7 +840,8 @@
 
        }
 
-#if 0
+// debug output for the terrain rules  
+#if 1
        std::cerr << "Built terrain rules: \n";
 
        building_ruleset::const_iterator rule;
@@ -814,8 +850,9 @@
                for(constraint_set::const_iterator constraint = 
rule->second.constraints.begin();
                    constraint != rule->second.constraints.end(); 
++constraint) {
 
+                       // FIXME MdW should be set_list
                        std::cerr << ">>>> New constraint: location = (" << 
constraint->second.loc
-                                 << "), terrain types = " << 
constraint->second.terrain_types << "\n";
+                                 << "), terrain types = '" << 
terrain_translation().set_map(constraint->second.terrain_types) << "'\n";
 
                        std::vector<std::string>::const_iterator flag;
 
@@ -843,7 +880,7 @@
        for(itor = terrains.begin(); itor != terrains.end(); ++itor) {
                if(*itor == terrain_translation::STAR)
                        return true;
-               if(*itor == terrain_translation::NOT){
+               if(*itor == terrain_translation::NOT) {
                        negative = true;
                        continue;
                }
@@ -1019,6 +1056,7 @@
 
 void terrain_builder::build_terrains()
 {
+
        log_scope("terrain_builder::build_terrains");
 
        //builds the terrain_by_type_ cache
@@ -1103,6 +1141,7 @@
                                        //so assert for now
 //                                     wassert(false);
                                        adjacent_types[i] = 
std::vector<terrain_translation::TERRAIN_NUMBER>();
+                                       adjacent_types[i].push_back(0); // 
required?
                                }
                        }
 
@@ -1158,4 +1197,30 @@
 
                rule_index++;
        }
-}
+#if 0
+
+       std::cerr << "Tile map: \n";
+       
+//     const terrain_builder::tilemap::const_iterator itor = 
tile_map_.begin()
+//     for(; itor != tile_map_.end(); ++itor) {
+//
+//
+//     }
+               
+       for(int x = -1; x <= map_.x(); ++x) {
+               for(int y = -1; y <= map_.y(); ++y) {
+                       std::cerr << ">> Location " << x << "," << y << "\n";
+
+                       const gamemap::location loc(x,y);
+                       const tile t = tile_map_[loc];
+
+                       std::cerr << ">> Foreground images \n";
+                       
+
+
+
+               }
+       }
+
+#endif
+}

Modified: branches/mordante_terrain/src/unit.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/mordante_terrain/src/unit.cpp?rev=14024&r1=14023&r2=14024&view=diff
==============================================================================
--- branches/mordante_terrain/src/unit.cpp (original)
+++ branches/mordante_terrain/src/unit.cpp Thu Oct 19 22:44:08 2006
@@ -2233,7 +2233,7 @@
 
        wassert(map_ != NULL);
        //if this is an alias, then select the best of all underlying terrains
-       const std::vector<terrain_translation::TERRAIN_NUMBER>& underlying = 
map_->underlying_mvt_terrain2(terrain);
+       const std::vector<terrain_translation::TERRAIN_NUMBER>& underlying = 
map_->underlying_def_terrain2(terrain);
        wassert(underlying.size() > 0);
        if(underlying.size() != 1 || underlying.front() != terrain) {
                bool revert = (underlying.front() == 
terrain_translation::MINUS ?true:false);
@@ -2255,9 +2255,6 @@
                        if(value < ret_value && !revert) {
                                ret_value = value;
                        } else if(value > ret_value && revert) {
-                               ret_value = value;
-                       }
-                       if(value < ret_value) {
                                ret_value = value;
                        }
                }

Modified: branches/mordante_terrain/src/unit_types.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/mordante_terrain/src/unit_types.cpp?rev=14024&r1=14023&r2=14024&view=diff
==============================================================================
--- branches/mordante_terrain/src/unit_types.cpp (original)
+++ branches/mordante_terrain/src/unit_types.cpp Thu Oct 19 22:44:08 2006
@@ -482,7 +482,7 @@
        }
 
        //if this is an alias, then select the best of all underlying terrains
-       const std::vector<terrain_translation::TERRAIN_NUMBER>& underlying = 
map.underlying_mvt_terrain2(terrain);
+       const std::vector<terrain_translation::TERRAIN_NUMBER>& underlying = 
map.underlying_def_terrain2(terrain);
        if(underlying.size() != 1 || underlying.front() != terrain) {
                bool revert = (underlying.front() == 
terrain_translation::MINUS?true:false);
                if(recurse_count >= 100) {
@@ -504,9 +504,6 @@
                        } else if(value > ret_value && revert) {
                                ret_value = value;
                        }
-                       if(value < ret_value) {
-                               ret_value = value;
-                       }
                }
 
                
defenseMods_.insert(std::pair<terrain_translation::TERRAIN_NUMBER,int>(terrain,ret_value));




Related Messages


Powered by MHonArc, Updated Fri Oct 20 00:20:27 2006