Author: zaroth
Date: Sun May 29 12:17:43 2011
New Revision: 49699

URL: http://svn.gna.org/viewcvs/wesnoth?rev=49699&view=rev
Log:
added game_controller_new, which takes over game_controller
responsibilities in case of --new-syntax

Added:
    trunk/src/game_controller_abstract.cpp
      - copied, changed from r49698, trunk/src/game_controller_new.hpp
Modified:
    trunk/src/CMakeLists.txt
    trunk/src/SConscript
    trunk/src/game.cpp
    trunk/src/game_controller.cpp
    trunk/src/game_controller.hpp
    trunk/src/game_controller_abstract.hpp
    trunk/src/game_controller_new.cpp
    trunk/src/game_controller_new.hpp

Modified: trunk/src/CMakeLists.txt
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/CMakeLists.txt?rev=49699&r1=49698&r2=49699&view=diff
==============================================================================
--- trunk/src/CMakeLists.txt (original)
+++ trunk/src/CMakeLists.txt Sun May 29 12:17:43 2011
@@ -359,6 +359,7 @@
        formula_string_utils.cpp
        formula_tokenizer.cpp
        game_controller.cpp
+       game_controller_abstract.cpp
        game_controller_new.cpp
        game_display.cpp
        game_errors.cpp

Modified: trunk/src/SConscript
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/SConscript?rev=49699&r1=49698&r2=49699&view=diff
==============================================================================
--- trunk/src/SConscript (original)
+++ trunk/src/SConscript Sun May 29 12:17:43 2011
@@ -221,6 +221,7 @@
     formula_string_utils.cpp
     formula_tokenizer.cpp
     game_controller.cpp
+    game_controller_abstract.cpp
     game_controller_new.cpp
     game_display.cpp
     game_errors.cpp

Modified: trunk/src/game.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game.cpp?rev=49699&r1=49698&r2=49699&view=diff
==============================================================================
--- trunk/src/game.cpp (original)
+++ trunk/src/game.cpp Sun May 29 12:17:43 2011
@@ -318,6 +318,8 @@
                        std::cout << "Battle for Wesnoth" << " " << 
game_config::version
                                  << "\n";
                        return 0;
+               } else if (val == "--new-syntax") {
+                       game_config::new_syntax = true;
                } else if (val == "--config-path") {
                        std::cout << get_user_data_dir() << '\n';
                        return 0;
@@ -620,8 +622,11 @@
        //ensure recorder has an actually random seed instead of what it got 
during
        //static initialization (before any srand() call)
        recorder.set_seed(rand());
-
-       boost::shared_ptr<game_controller_abstract> game = 
boost::shared_ptr<game_controller_abstract>(new game_controller(argc,argv));
+       boost::shared_ptr<game_controller_abstract> game;
+       if (game_config::new_syntax)
+               game = boost::shared_ptr<game_controller_abstract>(new 
game_controller_new());
+       else
+               game = boost::shared_ptr<game_controller_abstract>(new 
game_controller(argc,argv));
        const int start_ticks = SDL_GetTicks();
 
        init_locale();

Modified: trunk/src/game_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_controller.cpp?rev=49699&r1=49698&r2=49699&view=diff
==============================================================================
--- trunk/src/game_controller.cpp (original)
+++ trunk/src/game_controller.cpp Sun May 29 12:17:43 2011
@@ -71,7 +71,6 @@
        arg_(1),
        argv_(argv),
        thread_manager(),
-       video_(),
        font_manager_(),
        prefs_manager_(),
        image_manager_(),
@@ -90,7 +89,6 @@
        force_bpp_(-1),
        game_config_(),
        old_defines_map_(),
-       disp_(NULL),
        state_(),
        multiplayer_server_(),
        jump_to_multiplayer_(false),
@@ -318,9 +316,6 @@
                        // This is a hidden option to enable the new widget 
toolkit.
                        gui2::new_widgets = true;
                }
-               else if (val == "--new-syntax") {
-                       game_config::new_syntax = true;
-               }
                else if(val == "--clock") {
                        gui2::show_debug_clock_button = true;
                } else if(val == "-e" || val == "--editor") {
@@ -374,17 +369,6 @@
        else if (no_music) { // else disable the music in nomusic mode
                preferences::set_music(false);
        }
-}
-
-game_display& game_controller::disp()
-{
-       if(disp_.get() == NULL) {
-               if(get_video_surface() == NULL) {
-                       throw CVideo::error();
-               }
-               disp_.assign(game_display::create_dummy_display(video_));
-       }
-       return *disp_.get();
 }
 
 bool game_controller::init_video()

Modified: trunk/src/game_controller.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_controller.hpp?rev=49699&r1=49698&r2=49699&view=diff
==============================================================================
--- trunk/src/game_controller.hpp (original)
+++ trunk/src/game_controller.hpp Sun May 29 12:17:43 2011
@@ -47,8 +47,6 @@
 public:
        game_controller(int argc, char** argv);
        ~game_controller();
-
-       game_display& disp();
 
        bool init_config() { return init_config(false); }
        bool init_video();
@@ -103,8 +101,6 @@
        //to clean up threads after the display disappears.
        const threading::manager thread_manager;
 
-       CVideo video_;
-
        const font::manager font_manager_;
        const preferences::manager prefs_manager_;
        const image::manager image_manager_;
@@ -123,8 +119,6 @@
        config game_config_;
        preproc_map old_defines_map_;
 
-       util::scoped_ptr<game_display> disp_;
-
        /// 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.
        game_state state_;
 

Copied: trunk/src/game_controller_abstract.cpp (from r49698, 
trunk/src/game_controller_new.hpp)
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_controller_abstract.cpp?p2=trunk/src/game_controller_abstract.cpp&p1=trunk/src/game_controller_new.hpp&r1=49698&r2=49699&rev=49699&view=diff
==============================================================================
--- trunk/src/game_controller_new.hpp (original)
+++ trunk/src/game_controller_abstract.cpp Sun May 29 12:17:43 2011
@@ -13,12 +13,24 @@
    See the COPYING file for more details.
 */
 
-#ifndef GAME_CONTROLLER_NEW_HPP_INCLUDED
-#define GAME_CONTROLLER_NEW_HPP_INCLUDED
 #include "game_controller_abstract.hpp"
 
-class game_controller_new : public game_controller_abstract
+#include "game_display.hpp"
+
+game_controller_abstract::game_controller_abstract() :
+       disp_(NULL),
+       video_()
 {
-};
 
-#endif
+}
+
+game_display& game_controller_abstract::disp()
+{
+       if(disp_.get() == NULL) {
+               if(get_video_surface() == NULL) {
+                       throw CVideo::error();
+               }
+               disp_.assign(game_display::create_dummy_display(video_));
+       }
+       return *disp_.get();
+}

Modified: trunk/src/game_controller_abstract.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_controller_abstract.hpp?rev=49699&r1=49698&r2=49699&view=diff
==============================================================================
--- trunk/src/game_controller_abstract.hpp (original)
+++ trunk/src/game_controller_abstract.hpp Sun May 29 12:17:43 2011
@@ -15,6 +15,8 @@
 #ifndef GAME_CONTROLLER_ABSTRACT_H_INCLUDED
 #define GAME_CONTROLLER_ABSTRACT_H_INCLUDED
 #include "editor/editor_main.hpp"
+#include "scoped_resource.hpp"
+#include "video.hpp"
 #include <string>
 
 class config;
@@ -23,9 +25,10 @@
 class game_controller_abstract
 {
 public:
+       game_controller_abstract();
        virtual ~game_controller_abstract() {}
 
-       virtual game_display& disp() = 0;
+       game_display& disp();
 
        virtual bool init_video() = 0;
        virtual bool init_config() = 0;
@@ -59,5 +62,9 @@
        virtual editor::EXIT_STATUS start_editor() = 0;
 
        virtual const config& game_config() const = 0;
+protected:
+       util::scoped_ptr<game_display> disp_;
+
+       CVideo video_;
 };
 #endif

Modified: trunk/src/game_controller_new.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_controller_new.cpp?rev=49699&r1=49698&r2=49699&view=diff
==============================================================================
--- trunk/src/game_controller_new.cpp (original)
+++ trunk/src/game_controller_new.cpp Sun May 29 12:17:43 2011
@@ -14,3 +14,131 @@
 */
 
 #include "game_controller_new.hpp"
+#include "game_display.hpp"
+
+#include <iostream>
+
+game_controller_new::game_controller_new() :
+       main_config_()
+{
+}
+
+game_controller_new::~game_controller_new()
+{
+
+}
+
+bool game_controller_new::init_config()
+{
+       return true;
+}
+
+bool game_controller_new::init_video()
+{
+       return true;
+}
+
+bool game_controller_new::init_language()
+{
+       return true;
+}
+
+bool game_controller_new::play_test()
+{
+       return true;
+}
+
+bool game_controller_new::play_multiplayer_mode()
+{
+       return true;
+}
+
+bool game_controller_new::play_screenshot_mode()
+{
+       return true;
+}
+
+void game_controller_new::reload_changed_game_config()
+{
+
+}
+
+bool game_controller_new::is_loading() const
+{
+       return true;
+}
+
+void game_controller_new::clear_loaded_game()
+{
+
+}
+
+bool game_controller_new::load_game()
+{
+       return true;
+}
+
+void game_controller_new::set_tutorial()
+{
+
+}
+
+std::string game_controller_new::jump_to_campaign_id() const
+{
+       return std::string();
+}
+
+bool game_controller_new::new_campaign()
+{
+       return true;
+}
+
+bool game_controller_new::goto_campaign()
+{
+       return true;
+}
+
+bool game_controller_new::goto_multiplayer()
+{
+       return true;
+}
+
+bool game_controller_new::goto_editor()
+{
+       return true;
+}
+
+bool game_controller_new::play_multiplayer()
+{
+       return true;
+}
+
+bool game_controller_new::change_language()
+{
+       return true;
+}
+
+void game_controller_new::show_preferences()
+{
+
+}
+
+void game_controller_new::launch_game ( 
game_controller_abstract::RELOAD_GAME_DATA /*reload*/ )
+{
+
+}
+
+void game_controller_new::play_replay()
+{
+
+}
+
+editor::EXIT_STATUS game_controller_new::start_editor()
+{
+       return editor::EXIT_NORMAL;
+}
+
+const config& game_controller_new::game_config() const
+{
+       return main_config_;
+}

Modified: trunk/src/game_controller_new.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_controller_new.hpp?rev=49699&r1=49698&r2=49699&view=diff
==============================================================================
--- trunk/src/game_controller_new.hpp (original)
+++ trunk/src/game_controller_new.hpp Sun May 29 12:17:43 2011
@@ -17,8 +17,49 @@
 #define GAME_CONTROLLER_NEW_HPP_INCLUDED
 #include "game_controller_abstract.hpp"
 
+#include "config.hpp"
+
 class game_controller_new : public game_controller_abstract
 {
+public:
+       game_controller_new();
+       ~game_controller_new();
+
+       bool init_config();
+       bool init_video();
+       bool init_language();
+       bool play_test();
+       bool play_multiplayer_mode();
+       bool play_screenshot_mode();
+
+       void reload_changed_game_config();
+
+       bool is_loading() const;
+       void clear_loaded_game();
+       bool load_game();
+       void set_tutorial();
+
+       std::string jump_to_campaign_id() const;
+       bool new_campaign();
+       bool goto_campaign();
+       bool goto_multiplayer();
+       bool goto_editor();
+
+       bool play_multiplayer();
+       bool change_language();
+
+       void show_preferences();
+
+       void launch_game(RELOAD_GAME_DATA reload=RELOAD_DATA);
+       void play_replay();
+
+       editor::EXIT_STATUS start_editor();
+
+       const config& game_config() const;
+
+private:
+       config main_config_;
+
 };
 
 #endif


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

Reply via email to