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

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

[Wesnoth-cvs-commits] wesnoth src/builder.cpp src/display.cpp src/hel...


From: Philippe Plantier
Subject: [Wesnoth-cvs-commits] wesnoth src/builder.cpp src/display.cpp src/hel...
Date: Tue, 19 Oct 2004 17:04:29 -0400

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

Modified files:
        src            : builder.cpp display.cpp help.cpp image.cpp 
                         map.cpp map.hpp reports.cpp terrain.cpp 
                         terrain.hpp unit_types.cpp 
        src/editor     : editor_palettes.cpp 
        data           : terrain.cfg 

Log message:
        Cleaned the terrain.cfg, removing obsolete entries
        Added the translated terrain name in terrain.cfg
        Changed "image" elements in [terrain] tags into "symbol_image"
        Removed dead code

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/builder.cpp.diff?tr1=1.36&tr2=1.37&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.268&tr2=1.269&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.37&tr2=1.38&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/image.cpp.diff?tr1=1.63&tr2=1.64&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/map.cpp.diff?tr1=1.40&tr2=1.41&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/map.hpp.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/reports.cpp.diff?tr1=1.47&tr2=1.48&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/terrain.cpp.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/terrain.hpp.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit_types.cpp.diff?tr1=1.69&tr2=1.70&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_palettes.cpp.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/data/terrain.cfg.diff?tr1=1.46&tr2=1.47&r1=text&r2=text

Patches:
Index: wesnoth/data/terrain.cfg
diff -u wesnoth/data/terrain.cfg:1.46 wesnoth/data/terrain.cfg:1.47
--- wesnoth/data/terrain.cfg:1.46       Fri Oct 15 18:41:47 2004
+++ wesnoth/data/terrain.cfg    Tue Oct 19 20:49:09 2004
@@ -1,66 +1,73 @@
+# Terrain configuration file. Defines how the terrain _work_ in the game. How
+# the terrains _look_ is defined in terrain_graphics.cfg .
+
 [terrain]
-image=void
-name=shroud
+symbol_image=void
+id=shroud
+name= _ "Shroud"
 char=" "
 [/terrain]
+
 [terrain]
-image=fog
-name=fog
+symbol_image=fog
+id=fog
+name= _ "Fog"
 char="~"
 [/terrain]
+
 [terrain]
-image=ocean
-name=deep water
+symbol_image=ocean
+id=deep water
+name= _ "Deep Water"
 char=s
 submerge=0.5
 unit_height_adjust=-3
 [/terrain]
 
 [terrain]
-image=coast
-name=shallow water
-adjacent_image=coast
+symbol_image=coast
+id=shallow water
+name= _ "Shallow Water"
 char=c
 submerge=0.4
 unit_height_adjust=-4
 [/terrain]
 
 [terrain]
-image=village-coast
-adjacent_image=coast
-name=mermen village
+symbol_image=village-coast
+id=mermen village
+name= _ "Village"
 char=Z
 aliasof=c
-no_overlay=true
 submerge=0.4
 unit_height_adjust=-4
 heals=true
 gives_income=true
-no_overlay=true
 [/terrain]
 
 [terrain]
-image=swampwater,swampwater2,swampwater3
-name=swamp water
+symbol_image=swampwater
+id=swamp water
+name= _ "Swamp Water"
 char=w
 submerge=0.4
 unit_height_adjust=-3
 [/terrain]
 
 [terrain]
-image=village-swampwater
-adjacent_image=swampwater
-name=swamp village
+symbol_image=village-swampwater
+id=swamp village
+name= _ "Village"
 char=Y
 aliasof=tw
-no_overlay=true
 heals=true
 gives_income=true
 [/terrain]
 
 [terrain]
-image=ice
-name=ice
+symbol_image=ice
+id=ice
+name= _ "Ice"
 char=i
 unit_height_adjust=-2
 aliasof=S
@@ -69,44 +76,50 @@
 
 
 [terrain]
-image=bridge-n-s
-name=bridge
+symbol_image=bridge-n-s
+id=bridge
+name= _ "Bridge"
 char=|
 aliasof=gc
 [/terrain]
 
 [terrain]
-image=bridge-ne-sw
-name=bridgediag1
+symbol_image=bridge-ne-sw
+id=bridgediag1
+name= _ "Bridge"
 char=/
 aliasof=gc
 [/terrain]
 
 [terrain]
-image=bridge-se-nw
-name=bridgediag2
+symbol_image=bridge-se-nw
+id=bridgediag2
+name= _ "Bridge"
 char=\
 aliasof=gc
 [/terrain]
 
 [terrain]
-image=desert,desert,desert,desert,desert,desert,desert-plant
-name=sand
+symbol_image=desert
+id=sand
+name= _ "Sand"
 char=d
 light=true
 [/terrain]
 
 
 [terrain]
-image=road
-name=road
+symbol_image=road
+id=road
+name= _ "Road"
 char=R
 aliasof=g
 [/terrain]
 
 [terrain]
-image=dirt
-name=dirt
+symbol_image=dirt
+id=dirt
+name= _ "Dirt"
 char=r
 aliasof=g
 [/terrain]
@@ -114,119 +127,125 @@
 #grassland should contain mostly plain grassland, but occasionally
 #a few rocks
 [terrain]
-image=grassland-r1
-name=grassland
+symbol_image=grassland-r1
+id=grassland
+name= _ "Grassland"
 char=g
 [/terrain]
 
 [terrain]
-image=village
-name=village
+symbol_image=village
+id=village
+name= _ "Village"
 char=t
-
-#make this not overlay nearby grassland (but will overlay other lower terrain)
-no_overlay=true
 heals=true
 gives_income=true
 [/terrain]
 
 [terrain]
-image=village-human
-name=human village
+symbol_image=village-human
+id=human village
+name= _ "Village"
 char=v
 aliasof=t
-no_overlay=true
-adjacent_image=grassland
 heals=true
 gives_income=true
 [/terrain]
 
 [terrain]
-image=snow,snow,snow2
-name=tundra
+symbol_image=snow
+id=tundra
+name= _ "Snow"
 char=S
 light=true
 [/terrain]
 
 [terrain]
-image=village-snow
-adjacent_image=snow
-name=snow village
+symbol_image=village-snow
+id=snow village
+name= _ "Village"
 char=V
 aliasof=tS
-no_overlay=true
 light=true
 heals=true
 gives_income=true
 [/terrain]
 
 [terrain]
-image=hills,hills,hills-variation1,hills-variation2,hills-variation3,hills-variation3
-name=hills
+symbol_image=hills
+id=hills
+name= _ "Hills"
 char=h
 [/terrain]
 
 [terrain]
-image=snow-hills
-name=hills
+symbol_image=snow-hills
+id=hills
+name= _ "Snow hills"
 char=H
 aliasof=h
 [/terrain]
 
 [terrain]
-image=mountains
-name=mountains
+symbol_image=mountains
+id=mountains
+name= _ "Mountains"
 char=m
 [/terrain]
 
 [terrain]
-image=forest
-name=forest
+symbol_image=forest
+id=forest
+name= _ "Forest"
 char=f
 [/terrain]
 
 [terrain]
-image=snow-forest
-name=forest
+symbol_image=snow-forest
+id=forest
+name= _ "Snow forest"
 aliasof=f
 char=F
 [/terrain]
 
 [terrain]
-image=cavewall
-name=cavewall
+symbol_image=cavewall
+id=cavewall
+name= _ "Cave wall"
 char=W
 light=true
 [/terrain]
 
 [terrain]
-image=cave-floor1
-name=cave
+symbol_image=cave-floor1
+id=cave
+name= _ "Cave"
 char=u
 [/terrain]
 
 [terrain]
-image=village-cave
-name=underground village
+symbol_image=village-cave
+id=underground village
+name= _ "Village"
 char=D
 aliasof=tu
-no_overlay=true
-adjacent_image=cave
 heals=true
 gives_income=true
 [/terrain]
 
 [terrain]
-image=castle
-name=castle
+symbol_image=castle
+id=castle
+name= _ "Castle"
 char=C
 unit_height_adjust=3
 recruit_onto=true
 [/terrain]
 
 [terrain]
-image=dirt
-name=encampment
+symbol_image=dirt
+id=encampment
+name= _ "Encampment"
 char=n
 aliasof=C
 unit_height_adjust=3
@@ -234,8 +253,9 @@
 [/terrain]
 
 [terrain]
-image=cave-floor1
-name=dwarven castle
+symbol_image=cave-floor1
+id=dwarven castle
+name= _ "Dwarven castle"
 char=o
 aliasof=C
 unit_height_adjust=0
@@ -243,8 +263,9 @@
 [/terrain]
 
 [terrain]
-image=keep
-name=keep
+symbol_image=keep
+id=keep
+name= _ "Keep"
 char=K
 unit_height_adjust=8
 aliasof=C
@@ -256,14 +277,15 @@
 #this is commented-out until someone actually makes it work
 #[terrain]
 #char=O
-#name=orccastle
+#id=orccastle
 #aliasof=C
-#image=orccastle
+#symbol_image=orccastle
 #[/terrain]
 
 [terrain]
-image=canyon-n-s
-name=canyon
+symbol_image=canyon-n-s
+id=canyon
+name= _ "Canyon"
 char=X
 [/terrain]
 
@@ -272,8 +294,9 @@
 
 #ifdef CAMPAIGN_EASTERN_INVASION
 [terrain]
-image=castle
-name=castle
+symbol_image=castle
+id=castle
+name= _ "Castle"
 char=y
 aliasof=W
 [/terrain]
Index: wesnoth/src/builder.cpp
diff -u wesnoth/src/builder.cpp:1.36 wesnoth/src/builder.cpp:1.37
--- wesnoth/src/builder.cpp:1.36        Tue Oct  5 21:28:12 2004
+++ wesnoth/src/builder.cpp     Tue Oct 19 20:49:09 2004
@@ -1,4 +1,4 @@
-/* $Id: builder.cpp,v 1.36 2004/10/05 21:28:12 silene Exp $ */
+/* $Id: builder.cpp,v 1.37 2004/10/19 20:49:09 gruikya Exp $ */
 /*
    Copyright (C) 2004 by Philippe Plantier <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -207,7 +207,7 @@
                btile.images_foreground.clear();
                btile.images_background.clear();
                const std::string filename =
-                       
map_.get_terrain_info(map_.get_terrain(loc)).default_image();
+                       
map_.get_terrain_info(map_.get_terrain(loc)).symbol_image();
                animated<image::locator> img_loc("terrain/" + filename + 
".png");
                img_loc.start_animation(0, 
animated<image::locator>::INFINITE_CYCLES);
                btile.images_background.push_back(img_loc);
Index: wesnoth/src/display.cpp
diff -u wesnoth/src/display.cpp:1.268 wesnoth/src/display.cpp:1.269
--- wesnoth/src/display.cpp:1.268       Thu Oct  7 18:55:33 2004
+++ wesnoth/src/display.cpp     Tue Oct 19 20:49:09 2004
@@ -1,4 +1,4 @@
-/* $Id: display.cpp,v 1.268 2004/10/07 18:55:33 silene Exp $ */
+/* $Id: display.cpp,v 1.269 2004/10/19 20:49:09 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1059,23 +1059,6 @@
        update_rect(minimap_location);
 }
 
-gamemap::TERRAIN display::get_terrain_on(int palx, int paly, int x, int y)
-{
-       const int height = 37;
-       if(y < paly || x < palx)
-               return 0;
-
-       const std::vector<gamemap::TERRAIN>& 
terrains=map_.get_terrain_precedence();
-       if(static_cast<size_t>(y) > paly+terrains.size()*height)
-               return 0;
-
-       const size_t index = (y - paly)/height;
-       if(index >= terrains.size())
-               return 0;
-
-       return terrains[index];
-}
-
 void display::draw_halo_on_tile(int x, int y)
 {
        const gamemap::location loc(x,y);
@@ -1664,7 +1647,7 @@
                                //      stream << "void";
                                //else
                                //      stream << "fog";
-                               stream << "terrain/" << 
map_.get_terrain_info(*terrain).default_image();
+                               stream << "terrain/" << 
map_.get_terrain_info(*terrain).symbol_image();
 
                                for(int n = 0; *terrain == tiles[i] && n != 6; 
i = (i+1)%6, ++n) {
                                        stream << get_direction(i);
Index: wesnoth/src/editor/editor_palettes.cpp
diff -u wesnoth/src/editor/editor_palettes.cpp:1.17 
wesnoth/src/editor/editor_palettes.cpp:1.18
--- wesnoth/src/editor/editor_palettes.cpp:1.17 Sun Oct  3 13:33:46 2004
+++ wesnoth/src/editor/editor_palettes.cpp      Tue Oct 19 20:49:09 2004
@@ -36,7 +36,7 @@
        : gui::widget(gui), size_specs_(sizes), gui_(gui), tstart_(0), 
map_(map),
          top_button_(gui, "", gui::button::TYPE_PRESS, "uparrow-button"),
          bot_button_(gui, "", gui::button::TYPE_PRESS, "downarrow-button") {
-       terrains_ = map_.get_terrain_precedence();
+       terrains_ = map_.get_terrain_list();
        terrains_.erase(std::remove_if(terrains_.begin(), terrains_.end(), 
is_invalid_terrain),
                                        terrains_.end());
        if(terrains_.empty()) {
@@ -150,16 +150,16 @@
 
 std::string terrain_palette::get_terrain_string(const gamemap::TERRAIN t) {
        std::stringstream str;
-       const std::string& name = map_.terrain_name(t);
-       const std::vector<std::string>& underlying_names =
-               map_.underlying_terrain_name(t);
+       const std::string& name = map_.get_terrain_info(t).prout();
+       const std::string& underlying = map_.underlying_terrain(t);
        str << translate_string(name);
-       if(underlying_names.size() != 1 || underlying_names.front() != name) {
+       if(underlying.size() != 1 || underlying[0] != t) {
                str << " (";
-               for(std::vector<std::string>::const_iterator i = 
underlying_names.begin();
-                       i != underlying_names.end(); ++i) {
-                       str << translate_string(*i);
-                       if(i+1 != underlying_names.end()) {
+               for(std::string::const_iterator i = underlying.begin();
+                       i != underlying.end(); ++i) {
+
+                       str << map_.get_terrain_info(*i).prout();
+                       if(i+1 != underlying.end()) {
                                str << ",";
                        }
                }
@@ -254,7 +254,7 @@
        for(unsigned int counter = starting; counter < ending; counter++){
                const gamemap::TERRAIN terrain = terrains_[counter];
                const std::string filename = "terrain/" +
-                       map_.get_terrain_info(terrain).default_image() + ".png";
+                       map_.get_terrain_info(terrain).symbol_image() + ".png";
                surface image(image::get_image(filename, image::UNSCALED));
                if(image == NULL) {
                        std::cerr << "image for terrain " << counter << ": '" 
<< filename << "' not found\n";
Index: wesnoth/src/help.cpp
diff -u wesnoth/src/help.cpp:1.37 wesnoth/src/help.cpp:1.38
--- wesnoth/src/help.cpp:1.37   Tue Oct 19 20:29:36 2004
+++ wesnoth/src/help.cpp        Tue Oct 19 20:49:09 2004
@@ -50,7 +50,7 @@
        config dummy_cfg;
        std::vector<std::string> empty_string_vector;
        const int max_section_level = 15;
-  const int menu_font_size = font::SIZE_NORMAL;
+       const int menu_font_size = font::SIZE_NORMAL;
        const int title_size = font::SIZE_LARGE;
        const int title2_size = font::SIZE_15;
        const int box_width = 2;
@@ -771,7 +771,8 @@
                                        const terrain_type& info = 
map->get_terrain_info(terrain);
                                        if (!info.is_alias()) {
                                                
std::vector<std::pair<std::string, unsigned> > row;
-                                               const std::string &name = 
string_table[info.name()];
+                                               //const std::string &name = 
string_table[info.name()];
+                                               const std::string& name = 
info.name();
                                                const int moves = 
movement_type.movement_cost(*map,terrain);
                                                std::stringstream str;
                                                str << "<ref>text='" << 
escape(name) << "' dst='"
@@ -821,7 +822,7 @@
        std::vector<topic> res;
        std::vector<gamemap::TERRAIN> show_info_about;
        if (game_config::debug) {
-               show_info_about = map->get_terrain_precedence();
+               show_info_about = map->get_terrain_list();
        }
        else {
                for (std::set<std::string>::const_iterator terrain_it =
@@ -840,16 +841,17 @@
        for (std::vector<gamemap::TERRAIN>::const_iterator terrain_it = 
show_info_about.begin();
                 terrain_it != show_info_about.end(); terrain_it++) {
                const terrain_type& info = map->get_terrain_info(*terrain_it);
-               const std::string &name = string_table[info.name()];
+               //const std::string &name = string_table[info.name()];
+               const std::string &name = info.name();
                std::stringstream ss;
-               ss << "<img>src='terrain/" << info.default_image() << 
".png'</img>\n\n";
+               ss << "<img>src='terrain/" << info.symbol_image() << 
".png'</img>\n\n";
                if (info.is_alias()) {
                        const std::string aliased_terrains = info.type();
                        std::stringstream alias_ss;
                        for (std::string::const_iterator it = 
aliased_terrains.begin();
                                 it != aliased_terrains.end(); it++) {
                                const gamemap::TERRAIN t = *it;
-                               const std::string &alias_name = 
string_table[map->get_terrain_info(t).name()];
+                               const std::string &alias_name = 
map->get_terrain_info(t).name();
                                alias_ss << "<ref>text='" << escape(alias_name) 
<< "' dst='"
                                                 << 
escape(std::string("terrain_") + t) << "'</ref>";
                                if (it + 2 == aliased_terrains.end()) {
Index: wesnoth/src/image.cpp
diff -u wesnoth/src/image.cpp:1.63 wesnoth/src/image.cpp:1.64
--- wesnoth/src/image.cpp:1.63  Wed Aug 25 02:59:51 2004
+++ wesnoth/src/image.cpp       Tue Oct 19 20:49:09 2004
@@ -662,7 +662,7 @@
                                cache_map::iterator i = cache.find(terrain);
 
                                if(i == cache.end()) {
-                                       surface tile(get_image("terrain/" + 
map.get_terrain_info(terrain).default_image() + ".png",image::UNSCALED));
+                                       surface tile(get_image("terrain/" + 
map.get_terrain_info(terrain).symbol_image() + ".png",image::UNSCALED));
 
                                        if(tile == NULL) {
                                                std::cerr << "Could not get 
image for terrrain '"
Index: wesnoth/src/map.cpp
diff -u wesnoth/src/map.cpp:1.40 wesnoth/src/map.cpp:1.41
--- wesnoth/src/map.cpp:1.40    Thu Aug  5 21:53:31 2004
+++ wesnoth/src/map.cpp Tue Oct 19 20:49:09 2004
@@ -1,4 +1,4 @@
-/* $Id: map.cpp,v 1.40 2004/08/05 21:53:31 gruikya Exp $ */
+/* $Id: map.cpp,v 1.41 2004/10/19 20:49:09 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -24,38 +24,6 @@
 
 gamemap::location gamemap::location::null_location;
 
-const std::string& gamemap::terrain_name(gamemap::TERRAIN terrain) const
-{
-       static const std::string default_val;
-       const std::map<TERRAIN,terrain_type>::const_iterator i =
-                                             letterToTerrain_.find(terrain);
-       if(i == letterToTerrain_.end())
-               return default_val;
-       else
-               return i->second.name();
-}
-
-std::vector<std::string> gamemap::underlying_terrain_name(gamemap::TERRAIN 
terrain) const
-{
-       const std::map<TERRAIN,terrain_type>::const_iterator i =
-                                              letterToTerrain_.find(terrain);
-       if(i == letterToTerrain_.end()) {
-               return std::vector<std::string>();
-       } else {
-               if(i->second.is_alias()) {
-                       std::vector<std::string> res;
-
-                       const std::string& type = i->second.type();
-                       for(std::string::const_iterator j = type.begin(); j != 
type.end(); ++j) {
-                               res.push_back(terrain_name(*j));
-                       }
-                       return res;
-               } else {
-                       return std::vector<std::string>(1,i->second.name());
-               }
-       }
-}
-
 const std::string& gamemap::underlying_terrain(TERRAIN terrain) const
 {
        const std::map<TERRAIN,terrain_type>::const_iterator i = 
letterToTerrain_.find(terrain);
@@ -193,7 +161,7 @@
 {
        std::cerr << "loading map: '" << data << "'\n";
        const config::child_list& terrains = cfg.get_children("terrain");
-       
create_terrain_maps(terrains,terrainPrecedence_,letterToTerrain_,terrain_);
+       create_terrain_maps(terrains,terrainList_,letterToTerrain_,terrain_);
 
        read(data);
 }
@@ -376,14 +344,9 @@
        return get_terrain_info(get_terrain(loc));
 }
 
-const std::vector<gamemap::TERRAIN>& gamemap::get_terrain_precedence() const
-{
-       return terrainPrecedence_;
-}
-
-bool gamemap::is_built(const location &loc) const
+const std::vector<gamemap::TERRAIN>& gamemap::get_terrain_list() const
 {
-       return is_castle(loc);
+       return terrainList_;
 }
 
 void gamemap::set_terrain(const gamemap::location& loc, gamemap::TERRAIN ter)
Index: wesnoth/src/map.hpp
diff -u wesnoth/src/map.hpp:1.27 wesnoth/src/map.hpp:1.28
--- wesnoth/src/map.hpp:1.27    Sat Aug  7 17:21:58 2004
+++ wesnoth/src/map.hpp Tue Oct 19 20:49:09 2004
@@ -1,4 +1,4 @@
-/* $Id: map.hpp,v 1.27 2004/08/07 17:21:58 Sirp Exp $ */
+/* $Id: map.hpp,v 1.28 2004/10/19 20:49:09 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -39,8 +39,6 @@
        //is the name of the terrain for game-logic purposes. I.e. if the 
terrain
        //is simply an alias, the underlying terrain name is the name of the
        //terrain that it's aliased to
-       const std::string& terrain_name(TERRAIN terrain) const;
-       std::vector<std::string> underlying_terrain_name(TERRAIN terrain) const;
        const std::string& underlying_terrain(TERRAIN terrain) const;
 
        //exception thrown if the map file is not in the correct format.
@@ -146,11 +144,8 @@
        //shortcut to get_terrain_info(get_terrain(loc))
        const terrain_type& get_terrain_info(const location &loc) const;
        
-       //gets the list of which terrain types should display on top of
-       //other terrain types. Has no effect on gameplay, only display.
-       const std::vector<TERRAIN>& get_terrain_precedence() const;
-
-       bool is_built(const location& loc) const;
+       //gets the list of terrains
+       const std::vector<TERRAIN>& get_terrain_list() const;
 
        //clobbers over the terrain at location 'loc', with the given terrain
        void set_terrain(const location& loc, TERRAIN ter);
@@ -165,7 +160,7 @@
 private:
        int num_starting_positions() const;
 
-       std::vector<TERRAIN> terrainPrecedence_;
+       std::vector<TERRAIN> terrainList_;
        std::map<TERRAIN,terrain_type> letterToTerrain_;
        std::map<std::string,terrain_type> terrain_;
 
Index: wesnoth/src/reports.cpp
diff -u wesnoth/src/reports.cpp:1.47 wesnoth/src/reports.cpp:1.48
--- wesnoth/src/reports.cpp:1.47        Fri Oct  8 23:03:04 2004
+++ wesnoth/src/reports.cpp     Tue Oct 19 20:49:09 2004
@@ -301,8 +301,7 @@
                        break;
 
                const gamemap::TERRAIN terrain = map.get_terrain(mouseover);
-               const std::string& name = 
string_table[map.terrain_name(terrain)];
-               const std::vector<std::string>& underlying_names = 
map.underlying_terrain_name(terrain);
+               const std::string& underlying = map.underlying_terrain(terrain);
 
                if(map.is_village(mouseover)) {
                        const int owner = village_owner(mouseover,teams)+1;
@@ -317,16 +316,16 @@
                        }
 
                        str << " ";
-               }else{
-                       str << name;
+               } else {
+                       str << map.get_terrain_info(terrain).name();
                }
 
-               if(underlying_names.size() != 1 || 
string_table[underlying_names.front()] != name) {
+               if(underlying.size() != 1 || underlying[0] != terrain) {
                        str << " (";
                        
-                       for(std::vector<std::string>::const_iterator i = 
underlying_names.begin(); i != underlying_names.end(); ++i) {
-                               str << string_table[*i];
-                               if(i+1 != underlying_names.end()) {
+                       for(std::string::const_iterator i = underlying.begin(); 
i != underlying.end(); ++i) {
+                               str << map.get_terrain_info(*i).name();
+                               if(i+1 != underlying.end()) {
                                        str << ",";
                                }
                        }
Index: wesnoth/src/terrain.cpp
diff -u wesnoth/src/terrain.cpp:1.21 wesnoth/src/terrain.cpp:1.22
--- wesnoth/src/terrain.cpp:1.21        Mon Jun  7 19:18:27 2004
+++ wesnoth/src/terrain.cpp     Tue Oct 19 20:49:09 2004
@@ -1,4 +1,4 @@
-/* $Id: terrain.cpp,v 1.21 2004/06/07 19:18:27 gruikya Exp $ */
+/* $Id: terrain.cpp,v 1.22 2004/10/19 20:49:09 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -17,19 +17,17 @@
 #include <cstdlib>
 #include <iostream>
 
-terrain_type::terrain_type() : images_(1,"void"), letter_(' '), type_(" "),
-                               height_adjust_(0), submerge_(0.0), 
equal_precedence_(false),
-                                                          heals_(false), 
village_(false), castle_(false), keep_(false)
+terrain_type::terrain_type() : symbol_image_("void"), letter_(' '), type_(" "),
+                               height_adjust_(0), submerge_(0.0), 
+                               heals_(false), village_(false), castle_(false), 
keep_(false)
 {}
 
 terrain_type::terrain_type(const config& cfg)
 {
-       images_ = config::split(cfg["image"]);
-       adjacent_image_ = cfg["adjacent_image"];
-       if(adjacent_image_ == "" && images_.empty() == false)
-               adjacent_image_ = images_.front();
+       symbol_image_ = cfg["symbol_image"];
 
        name_ = cfg["name"];
+       id_ = cfg["id"];
        const std::string& letter = cfg["char"];
        
        if(letter == "") {
@@ -51,7 +49,6 @@
        height_adjust_ = atoi(cfg["unit_height_adjust"].c_str());
        submerge_ = atof(cfg["submerge"].c_str());
 
-       equal_precedence_ = cfg["no_overlay"] == "true";
        is_light_ = cfg["light"] == "true";
 
        heals_ = cfg["heals"] == "true";
@@ -59,24 +56,10 @@
        castle_ = cfg["recruit_onto"] == "true";
        keep_ = cfg["recruit_from"] == "true";
 }
-#if 0
-const std::string& terrain_type::image(int x, int y) const
-{
-       assert(!images_.empty());
-       //return images_[(((x<<8)^3413402)+y^34984 + x*y)%images_.size()];
-       return default_image();
-}
-#endif
-const std::string& terrain_type::default_image() const
-{
-       //static const std::string ret = "void";
-       assert(!images_.empty());
-       return images_.front();
-}
 
-const std::string& terrain_type::adjacent_image() const
+const std::string& terrain_type::symbol_image() const
 {
-       return adjacent_image_;
+       return symbol_image_;
 }
 
 const std::string& terrain_type::name() const
@@ -84,6 +67,11 @@
        return name_;
 }
 
+const std::string& terrain_type::id() const
+{
+       return id_;
+}
+
 char terrain_type::letter() const
 {
        return letter_;
@@ -119,11 +107,6 @@
        return submerge_;
 }
 
-bool terrain_type::equal_precedence() const
-{
-       return equal_precedence_;
-}
-
 bool terrain_type::gives_healing() const
 {
        return heals_;
@@ -145,17 +128,17 @@
 }
 
 void create_terrain_maps(const std::vector<config*>& cfgs,
-                         std::vector<char>& terrain_precedence,
+                         std::vector<char>& terrain_list,
                          std::map<char,terrain_type>& letter_to_terrain,
                          std::map<std::string,terrain_type>& str_to_terrain)
 {
        for(std::vector<config*>::const_iterator i = cfgs.begin();
            i != cfgs.end(); ++i) {
                terrain_type terrain(**i);
-               terrain_precedence.push_back(terrain.letter());
+               terrain_list.push_back(terrain.letter());
                letter_to_terrain.insert(std::pair<char,terrain_type>(
                                              terrain.letter(),terrain));
                str_to_terrain.insert(std::pair<std::string,terrain_type>(
-                                             terrain.name(),terrain));
+                                             terrain.id(),terrain));
        }
 }
Index: wesnoth/src/terrain.hpp
diff -u wesnoth/src/terrain.hpp:1.19 wesnoth/src/terrain.hpp:1.20
--- wesnoth/src/terrain.hpp:1.19        Mon Jun  7 19:18:27 2004
+++ wesnoth/src/terrain.hpp     Tue Oct 19 20:49:09 2004
@@ -1,4 +1,4 @@
-/* $Id: terrain.hpp,v 1.19 2004/06/07 19:18:27 gruikya Exp $ */
+/* $Id: terrain.hpp,v 1.20 2004/10/19 20:49:09 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -24,10 +24,9 @@
        terrain_type();
        terrain_type(const config& cfg);
 
-       //const std::string& image(int x, int y) const;
-       const std::string& default_image() const;
-       const std::string& adjacent_image() const;
+       const std::string& symbol_image() const;
        const std::string& name() const;
+       const std::string& id() const;
 
        //the character representing this terrain
        char letter() const;
@@ -43,18 +42,14 @@
        int unit_height_adjust() const;
        double unit_submerge() const;
 
-       //whether the terrain's overlay precedence is equal (rather than higher
-       //than) the preceeding terrain
-       bool equal_precedence() const;
-
        bool gives_healing() const;
        bool is_village() const;
        bool is_castle() const;
        bool is_keep() const;
 
 private:
-       std::vector<std::string> images_;
-       std::string adjacent_image_;
+       std::string symbol_image_;
+       std::string id_;
        std::string name_;
 
        //the 'letter' is the letter that represents this
@@ -69,7 +64,6 @@
 
        double submerge_;
 
-       bool equal_precedence_;
        bool is_light_;
 
        bool heals_, village_, castle_, keep_;
Index: wesnoth/src/unit_types.cpp
diff -u wesnoth/src/unit_types.cpp:1.69 wesnoth/src/unit_types.cpp:1.70
--- wesnoth/src/unit_types.cpp:1.69     Fri Oct 15 08:39:33 2004
+++ wesnoth/src/unit_types.cpp  Tue Oct 19 20:49:09 2004
@@ -1,4 +1,4 @@
-/* $Id: unit_types.cpp,v 1.69 2004/10/15 08:39:33 cedricd Exp $ */
+/* $Id: unit_types.cpp,v 1.70 2004/10/19 20:49:09 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -369,15 +369,14 @@
        int res = -1;
 
        if(movement_costs != NULL) {
-               const std::vector<std::string> names = 
map.underlying_terrain_name(terrain);
-               if(names.size() != 1) {
-                       lg::err(lg::config) << "terrain '" << terrain << "' has 
" << names.size() << " underlying names - 0 expected\n";
+               if(underlying.size() != 1) {
+                       lg::err(lg::config) << "terrain '" << terrain << "' has 
" << underlying.size() << " underlying names - 0 expected\n";
                        return impassable;
                }
 
-               const std::string& name = names.front();
+               const std::string& id = 
map.get_terrain_info(underlying[0]).id();
 
-               const std::string& val = (*movement_costs)[name];
+               const std::string& val = (*movement_costs)[id];
 
                if(val != "") {
                        res = atoi(val.c_str());
@@ -429,14 +428,13 @@
        const config* const defense = cfg_.child("defense");
 
        if(defense != NULL) {
-               const std::vector<std::string> names = 
map.underlying_terrain_name(terrain);
-               if(names.size() != 1) {
-                       lg::err(lg::config) << "terrain '" << terrain << "' has 
" << names.size() << " underlying names - 0 expected\n";
+               if(underlying.size() != 1) {
+                       lg::err(lg::config) << "terrain '" << terrain << "' has 
" << underlying.size() << " underlying names - 0 expected\n";
                        return 100;
                }
 
-               const std::string& name = names.front();
-               const std::string& val = (*defense)[name];
+               const std::string& id = 
map.get_terrain_info(underlying[0]).id();
+               const std::string& val = (*defense)[id];
 
                if(val != "") {
                        res = atoi(val.c_str());




reply via email to

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