game_controller.hpp

Go to the documentation of this file.
00001 /* $Id: game_controller.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2003 - 2012 by David White <dave@whitevine.net>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY.
00012 
00013    See the COPYING file for more details.
00014 */
00015 #ifndef GAME_CONTROLLER_H_INCLUDED
00016 #define GAME_CONTROLLER_H_INCLUDED
00017 
00018 #include "game_controller_abstract.hpp"
00019 
00020 #include "commandline_options.hpp"
00021 #include "config_cache.hpp"
00022 #include "filesystem.hpp"
00023 #include "gamestatus.hpp"
00024 #include "game_config.hpp"
00025 #include "game_display.hpp"
00026 #include "game_preferences.hpp"
00027 #include "hotkeys.hpp"
00028 #include "sound.hpp"
00029 #include "thread.hpp"
00030 
00031 struct jump_to_campaign_info
00032 {
00033 public:
00034     jump_to_campaign_info(bool jump,int difficulty, std::string campaign_id,std::string scenario_id)
00035         : jump_(jump)
00036         , difficulty_(difficulty)
00037         , campaign_id_(campaign_id)
00038         , scenario_id_(scenario_id)
00039     {
00040     }
00041     bool jump_;
00042     int difficulty_;
00043     std::string campaign_id_,scenario_id_;
00044 };
00045 
00046 class game_controller : public game_controller_abstract
00047 {
00048 public:
00049     game_controller(const commandline_options& cmdline_opts, const char* appname);
00050     ~game_controller();
00051 
00052     bool init_config() { return init_config(false); }
00053     bool play_test();
00054     bool play_multiplayer_mode();
00055     bool play_screenshot_mode();
00056 
00057     void reload_changed_game_config();
00058 
00059     bool is_loading() const;
00060     void clear_loaded_game() { game::load_game_exception::game.clear(); }
00061     bool load_game();
00062     void set_tutorial();
00063 
00064     std::string jump_to_campaign_id() const;
00065     bool new_campaign();
00066     bool goto_campaign();
00067     bool goto_multiplayer();
00068     bool goto_editor();
00069 
00070     bool play_multiplayer();
00071     bool change_language();
00072 
00073     void show_preferences();
00074 
00075     void launch_game(RELOAD_GAME_DATA reload=RELOAD_DATA);
00076     void play_replay();
00077 
00078     editor::EXIT_STATUS start_editor() { return start_editor(""); }
00079 
00080     void start_wesnothd();
00081     const config& game_config() const { return game_config_; }
00082 
00083 private:
00084     game_controller(const game_controller&);
00085     void operator=(const game_controller&);
00086 
00087     bool init_config(const bool force);
00088     void load_game_cfg(const bool force=false);
00089     void set_unit_data();
00090 
00091     void mark_completed_campaigns(std::vector<config>& campaigns);
00092 
00093     editor::EXIT_STATUS start_editor(const std::string& filename);
00094 
00095     //this should get destroyed *after* the video, since we want
00096     //to clean up threads after the display disappears.
00097     const threading::manager thread_manager;
00098 
00099     const font::manager font_manager_;
00100     const preferences::manager prefs_manager_;
00101     const image::manager image_manager_;
00102     const events::event_context main_event_context_;
00103     const hotkey::manager hotkey_manager_;
00104     sound::music_thinker music_thinker_;
00105     resize_monitor resize_monitor_;
00106     binary_paths_manager paths_manager_;
00107 
00108     std::string test_scenario_;
00109 
00110     std::string screenshot_map_, screenshot_filename_;
00111 
00112     config game_config_;
00113     preproc_map old_defines_map_;
00114 
00115     /// Stateful class taking over scenario-switching capabilities from the current game_controller and playsingle_controller. Currently only available when --new-syntax command line option is enabled.
00116     game_state state_;
00117 
00118     std::string multiplayer_server_;
00119     bool jump_to_multiplayer_;
00120     jump_to_campaign_info jump_to_campaign_;
00121 
00122     bool jump_to_editor_;
00123 
00124     game_config::config_cache& cache_;
00125 };
00126 
00127 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:02:52 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs