Author: euschn
Date: Thu Jun  4 12:43:19 2009
New Revision: 36054

URL: http://svn.gna.org/viewcvs/wesnoth?rev=36054&view=rev
Log:
added a game_classification member to game_state

Modified:
    trunk/src/gamestatus.cpp
    trunk/src/gamestatus.hpp

Modified: trunk/src/gamestatus.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gamestatus.cpp?rev=36054&r1=36053&r2=36054&view=diff
==============================================================================
--- trunk/src/gamestatus.cpp (original)
+++ trunk/src/gamestatus.cpp Thu Jun  4 12:43:19 2009
@@ -64,6 +64,24 @@
        end_text(),
        end_text_duration(),
        difficulty("NORMAL")
+       {}
+
+game_classification::game_classification(const config& cfg):
+       label(cfg["label"]),
+       parent(cfg["parent"]),
+       version(cfg["version"]),
+       campaign_type(cfg["campaign_type"]),
+       campaign_define(cfg["campaign_define"]),
+       campaign_xtra_defines(utils::split(cfg["campaign_extra_defines"])),
+       campaign(cfg["campaign"]),
+       history(cfg["history"]),
+       abbrev(cfg["abbrev"]),
+       scenario(cfg["scenario"]),
+       next_scenario(cfg["next_scenario"]),
+       completion(cfg["completion"]),
+       end_text(cfg["end_text"]),
+       end_text_duration(lexical_cast_default<unsigned 
int>(cfg["end_text_duration"])),
+       difficulty(cfg["difficulty"])
        {}
 
 config game_classification::to_config()
@@ -433,7 +451,8 @@
                rng_(),
                variables(),
                temporaries(),
-               generator_setter(&recorder)
+               generator_setter(&recorder),
+               classification_()
                {}
 
 static void write_player(const player_info& player, config& cfg)
@@ -511,7 +530,8 @@
                rng_(cfg),
                variables(),
                temporaries(),
-               generator_setter(&recorder)
+               generator_setter(&recorder),
+               classification_(cfg)
 {
        
n_unit::id_manager::instance().set_save_id(lexical_cast_default<size_t>(cfg["next_underlying_unit_id"],0));
        log_scope("read_game");
@@ -548,10 +568,12 @@
 
        if(difficulty.empty()) {
                difficulty = "NORMAL";
+               classification_.difficulty = "NORMAL";
        }
 
        if(campaign_type.empty()) {
                campaign_type = "scenario";
+               classification_.campaign_type = "scenario";
        }
 
        if (const config &vars = cfg.child("variables")) {
@@ -831,7 +853,8 @@
        rng_(),
        variables(),
        temporaries(),
-       generator_setter(&recorder)
+       generator_setter(&recorder),
+       classification_()
 {
        *this = state;
 }
@@ -858,6 +881,7 @@
        rng_ = state.rng_;
        players = state.players;
        scoped_variables = state.scoped_variables;
+       classification_ = state.classification_;
 
        clear_wmi(wml_menu_items);
        std::map<std::string, wml_menu_item*>::const_iterator itor;

Modified: trunk/src/gamestatus.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gamestatus.hpp?rev=36054&r1=36053&r2=36054&view=diff
==============================================================================
--- trunk/src/gamestatus.hpp (original)
+++ trunk/src/gamestatus.hpp Thu Jun  4 12:43:19 2009
@@ -37,6 +37,7 @@
 {
 public:
        game_classification();
+       game_classification(const config& cfg);
 
        config to_config(); //dummy
 
@@ -163,6 +164,8 @@
 
        void get_player_info(const config& cfg, std::string save_id, 
std::vector<team>& teams, const config& level, gamemap& map, unit_map& units, 
gamestatus& game_status, bool snapshot);
 
+       game_classification classification() {return classification_;}
+
        std::string difficulty; /**< The difficulty level the game is being 
played on. */
 
        /**
@@ -196,6 +199,7 @@
        mutable config temporaries; // lengths of arrays, etc.
        const rand_rng::set_random_generator generator_setter; /**< Make sure 
that rng is initialized first */
        friend struct variable_info;
+       game_classification classification_;
 };
 
 /**


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

Reply via email to