Author: euschn
Date: Thu Jun  4 11:11:10 2009
New Revision: 36053

URL: http://svn.gna.org/viewcvs/wesnoth?rev=36053&view=rev
Log:
savegame reorganization: added class game_classification

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=36053&r1=36052&r2=36053&view=diff
==============================================================================
--- trunk/src/gamestatus.cpp (original)
+++ trunk/src/gamestatus.cpp Thu Jun  4 11:11:10 2009
@@ -47,6 +47,47 @@
 static void write_player(const player_info& player, config& cfg);
 
 #endif /* _WIN32 */
+
+game_classification::game_classification():
+       label(),
+       parent(),
+       version(),
+       campaign_type(),
+       campaign_define(),
+       campaign_xtra_defines(),
+       campaign(),
+       history(),
+       abbrev(),
+       scenario(),
+       next_scenario(),
+       completion(),
+       end_text(),
+       end_text_duration(),
+       difficulty("NORMAL")
+       {}
+
+config game_classification::to_config()
+{
+       config cfg;
+
+       cfg["label"] = label;
+       cfg["parent"] = parent;
+       cfg["version"] = game_config::version;
+       cfg["campaign_type"] = campaign_type;
+       cfg["campaign_define"] = campaign_define;
+       cfg["campaign_extra_defines"] = utils::join(campaign_xtra_defines);
+       cfg["campaign"] = campaign;
+       cfg["history"] = history;
+       cfg["abbrev"] = abbrev;
+       cfg["scenario"] = scenario;
+       cfg["next_scenario"] = next_scenario;
+       cfg["completion"] = completion;
+       cfg["end_text"] = end_text;
+       cfg["end_text_duration"] = str_cast<unsigned int>(end_text_duration);
+       cfg["difficulty"] = difficulty;
+
+       return cfg;
+}
 
 player_info::player_info() :
        name(),

Modified: trunk/src/gamestatus.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gamestatus.hpp?rev=36053&r1=36052&r2=36053&view=diff
==============================================================================
--- trunk/src/gamestatus.hpp (original)
+++ trunk/src/gamestatus.hpp Thu Jun  4 11:11:10 2009
@@ -21,6 +21,7 @@
 #include "team.hpp"
 #include "time_of_day.hpp"
 #include "variable.hpp"
+#include "savegame_config.hpp"
 
 #include <time.h>
 #include <string>
@@ -30,6 +31,32 @@
 class gamestatus; //needed to declare get_player_info (until game_state and 
gamestatus get merged)
 
 class scoped_wml_variable;
+
+//meta information of the game
+class game_classification : public savegame_config
+{
+public:
+       game_classification();
+
+       config to_config(); //dummy
+
+       std::string label;                               /**< Name of the game 
(e.g. name of save file). */
+       std::string parent;                              /**< Parent of the 
game (for save-threading purposes). */
+       std::string version;                             /**< Version game was 
created with. */
+       std::string campaign_type;                       /**< Type of the game 
- campaign, multiplayer etc. */
+       std::string campaign_define;                     /**< If there is a 
define the campaign uses to customize data */
+       std::vector<std::string> campaign_xtra_defines;  /**< more 
customization of data */
+
+       std::string campaign;                            /**< the campaign 
being played */
+       std::string history;                             /**< ancestral IDs */
+       std::string abbrev;                              /**< the campaign 
abbreviation */
+       std::string scenario;                            /**< the scenario 
being played */
+       std::string next_scenario;                       /**< the scenario 
coming next (for campaigns) */
+       std::string completion;                          /**< running. victory, 
or defeat */
+       std::string end_text;                            /**< end-of-campaign 
text */
+       unsigned int end_text_duration;                  /**< for how long the 
end-of-campaign text is shown */
+       std::string difficulty; /**< The difficulty level the game is being 
played on. */
+};
 
 struct wml_menu_item
 {


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

Reply via email to