mail[Wesnoth-commits] r36982 - in /trunk/src: game_events.cpp map_label.cpp map_label.hpp playsingle_controller.cpp replay.cpp


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

Header


Content

Posted by guillaume . melquiond on July 18, 2009 - 14:06:
Author: silene
Date: Sat Jul 18 14:06:40 2009
New Revision: 36982

URL: http://svn.gna.org/viewcvs/wesnoth?rev=36982&view=rev
Log:
Removed constant parameter from labels.

Modified:
    trunk/src/game_events.cpp
    trunk/src/map_label.cpp
    trunk/src/map_label.hpp
    trunk/src/playsingle_controller.cpp
    trunk/src/replay.cpp

Modified: trunk/src/game_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=36982&r1=36981&r2=36982&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Sat Jul 18 14:06:40 2009
@@ -2792,8 +2792,7 @@
        }
        game_display &screen = *resources::screen;
 
-       terrain_label label(screen.labels(),
-               cfg.get_config(), resources::state_of_game);
+       terrain_label label(screen.labels(), cfg.get_config());
 
        screen.labels().set_label(label.location(), label.text(),
                label.team_name(), label.colour(), label.visible_in_fog());

Modified: trunk/src/map_label.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/map_label.cpp?rev=36982&r1=36981&r2=36982&view=diff
==============================================================================
--- trunk/src/map_label.cpp (original)
+++ trunk/src/map_label.cpp Sat Jul 18 14:06:40 2009
@@ -16,7 +16,9 @@
 
 #include "display.hpp"
 #include "foreach.hpp"
+#include "gamestatus.hpp"
 #include "map_label.hpp"
+#include "resources.hpp"
 #include "formula_string_utils.hpp"
 
 
@@ -44,14 +46,13 @@
 
 map_labels::map_labels(const display& disp,
                       const config& cfg,
-                      const team* team,
-                      const variable_set *variables) :
+                      const team* team) :
                disp_(disp),
                team_(team),
                labels_(),
                label_cache_()
 {
-       read(cfg, variables);
+       read(cfg);
 }
 
 map_labels::~map_labels()
@@ -73,14 +74,14 @@
        }
 }
 
-void map_labels::read(const config& cfg, const variable_set *variables)
+void map_labels::read(const config &cfg)
 {
        clear_all();
 
        foreach (const config &i, cfg.child_range("label"))
        {
-               const map_location loc(i, variables);
-               terrain_label* label = new terrain_label(*this, i, variables);
+               const map_location loc(i, resources::state_of_game);
+               terrain_label *label = new terrain_label(*this, i);
                add_label(loc, label);
        }
        recalculate_labels();
@@ -331,9 +332,7 @@
 
 
 /// Load label from config
-terrain_label::terrain_label(const map_labels& parent,
-                            const config& cfg,
-                            const variable_set *variables) :
+terrain_label::terrain_label(const map_labels &parent, const config &cfg) :
                handle_(0),
                text_(),
                team_name_(),
@@ -342,7 +341,7 @@
                parent_(&parent),
                loc_()
 {
-       read(cfg, variables);
+       read(cfg);
        check_text_length();
 }
 
@@ -352,9 +351,10 @@
        clear();
 }
 
-void terrain_label::read(const config& cfg, const variable_set *variables)
-{
-       loc_ = map_location(cfg, variables);
+void terrain_label::read(const config &cfg)
+{
+       const variable_set &vs = *resources::state_of_game;
+       loc_ = map_location(cfg, &vs);
        SDL_Color colour = font::LABEL_COLOUR;
        std::string tmp_colour = cfg["colour"];
 
@@ -362,15 +362,9 @@
        team_name_ = cfg["team_name"];
        visible_in_fog_ = utils::string_bool(cfg["visible_in_fog"],true);
 
-       if (variables)
-       {
-               text_ = utils::interpolate_variables_into_string(
-                               text_, *variables);
-               team_name_ = utils::interpolate_variables_into_string(
-                                       team_name_, *variables);
-               tmp_colour = utils::interpolate_variables_into_string(
-                                 tmp_colour, *variables);
-       }
+       text_ = utils::interpolate_variables_into_string(text_, vs);
+       team_name_ = utils::interpolate_variables_into_string(team_name_, vs);
+       tmp_colour = utils::interpolate_variables_into_string(tmp_colour, vs);
 
        if(!tmp_colour.empty()) {
                std::vector<Uint32> temp_rgb;

Modified: trunk/src/map_label.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/map_label.hpp?rev=36982&r1=36981&r2=36982&view=diff
==============================================================================
--- trunk/src/map_label.hpp (original)
+++ trunk/src/map_label.hpp Sat Jul 18 14:06:40 2009
@@ -35,11 +35,11 @@
        typedef std::map<std::string,label_map> team_label_map;
 
        map_labels(const display& disp, const team*);
-       map_labels(const display& disp, const config& cfg, const team*, const 
variable_set *variables);
+       map_labels(const display &disp, const config &cfg, const team *);
        ~map_labels();
 
        void write(config& res) const;
-       void read(const config& cfg, const variable_set *variables);
+       void read(const config &cfg);
 
        static size_t get_max_chars();
 
@@ -95,16 +95,14 @@
                                  const SDL_Color colour = 
font::NORMAL_COLOUR,
                                  const bool visible_in_fog = true);
 
-       terrain_label(const map_labels&,
-                     const config&,
-                     const variable_set *variables);
+       terrain_label(const map_labels &, const config &);
 
        terrain_label(const map_labels&);
 
        ~terrain_label();
 
        void write(config& res) const;
-       void read(const config& cfg, const variable_set *variables);
+       void read(const config &cfg);
 
        const std::string& text() const;
        const std::string& team_name() const;

Modified: trunk/src/playsingle_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playsingle_controller.cpp?rev=36982&r1=36981&r2=36982&view=diff
==============================================================================
--- trunk/src/playsingle_controller.cpp (original)
+++ trunk/src/playsingle_controller.cpp Sat Jul 18 14:06:40 2009
@@ -261,7 +261,7 @@
                        show_storyscreen(*gui_, vconfig(s, true), 
level_["name"]);
                }
        }
-       gui_->labels().read(level_, game_events::get_state_of_game());
+       gui_->labels().read(level_);
 
        // Find a list of 'items' (i.e. overlays) on the level, and add them
        foreach (const config &overlay, level_.child_range("item"))

Modified: trunk/src/replay.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/replay.cpp?rev=36982&r1=36981&r2=36982&view=diff
==============================================================================
--- trunk/src/replay.cpp (original)
+++ trunk/src/replay.cpp Sat Jul 18 14:06:40 2009
@@ -854,7 +854,7 @@
                }
                else if (const config &child = cfg->child("label"))
                {
-                       terrain_label label(disp.labels(), child, 
game_events::get_state_of_game());
+                       terrain_label label(disp.labels(), child);
 
                        disp.labels().set_label(label.location(),
                                                label.text(),




Related Messages


Powered by MHonArc, Updated Sat Jul 18 14:40:57 2009