Author: zaroth
Date: Sat May 28 00:44:45 2011
New Revision: 49673
URL: http://svn.gna.org/viewcvs/wesnoth?rev=49673&view=rev
Log:
Created pure virtual game_controller_abstract class, which is game_controller's
parent
Added:
trunk/src/game_controller_abstract.hpp
Modified:
trunk/src/game.cpp
trunk/src/game_controller.hpp
Modified: trunk/src/game.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game.cpp?rev=49673&r1=49672&r2=49673&view=diff
==============================================================================
--- trunk/src/game.cpp (original)
+++ trunk/src/game.cpp Sat May 28 00:44:45 2011
@@ -619,7 +619,7 @@
//static initialization (before any srand() call)
recorder.set_seed(rand());
- boost::shared_ptr<game_controller> game =
boost::shared_ptr<game_controller>(new game_controller(argc,argv));
+ boost::shared_ptr<game_controller_abstract> game =
boost::shared_ptr<game_controller_abstract>(new game_controller(argc,argv));
const int start_ticks = SDL_GetTicks();
init_locale();
@@ -756,7 +756,7 @@
res =
static_cast<gui2::ttitle_screen::tresult>(dlg.get_retval());
}
- game_controller::RELOAD_GAME_DATA should_reload =
game_controller::RELOAD_DATA;
+ game_controller_abstract::RELOAD_GAME_DATA should_reload =
game_controller_abstract::RELOAD_DATA;
if(res == gui2::ttitle_screen::QUIT_GAME) {
LOG_GENERAL << "quitting game->..\n";
@@ -767,7 +767,7 @@
res = gui2::ttitle_screen::NOTHING;
continue;
}
- should_reload = game_controller::NO_RELOAD_DATA;
+ should_reload =
game_controller_abstract::NO_RELOAD_DATA;
} else if(res == gui2::ttitle_screen::TUTORIAL) {
game->set_tutorial();
} else if(res == gui2::ttitle_screen::NEW_CAMPAIGN) {
Modified: trunk/src/game_controller.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_controller.hpp?rev=49673&r1=49672&r2=49673&view=diff
==============================================================================
--- trunk/src/game_controller.hpp (original)
+++ trunk/src/game_controller.hpp Sat May 28 00:44:45 2011
@@ -15,8 +15,9 @@
#ifndef GAME_CONTROLLER_H_INCLUDED
#define GAME_CONTROLLER_H_INCLUDED
+#include "game_controller_abstract.hpp"
+
#include "config_cache.hpp"
-#include "editor/editor_main.hpp"
#include "filesystem.hpp"
#include "gamestatus.hpp"
#include "game_config.hpp"
@@ -41,7 +42,7 @@
std::string campaign_id_,scenario_id_;
};
-class game_controller
+class game_controller : public game_controller_abstract
{
public:
game_controller(int argc, char** argv);
@@ -49,8 +50,8 @@
game_display& disp();
+ bool init_config() { return init_config(false); }
bool init_video();
- bool init_config(const bool force=false);
bool init_language();
bool play_test();
bool play_multiplayer_mode();
@@ -74,11 +75,10 @@
void show_preferences();
- enum RELOAD_GAME_DATA { RELOAD_DATA, NO_RELOAD_DATA };
void launch_game(RELOAD_GAME_DATA reload=RELOAD_DATA);
void play_replay();
- editor::EXIT_STATUS start_editor(const std::string& filename = "");
+ editor::EXIT_STATUS start_editor() { return start_editor(""); }
void start_wesnothd();
const config& game_config() const { return game_config_; }
@@ -87,10 +87,13 @@
game_controller(const game_controller&);
void operator=(const game_controller&);
+ bool init_config(const bool force);
void load_game_cfg(const bool force=false);
void set_unit_data();
void mark_completed_campaigns(std::vector<config>& campaigns);
+
+ editor::EXIT_STATUS start_editor(const std::string& filename);
const int argc_;
int arg_;
Added: trunk/src/game_controller_abstract.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_controller_abstract.hpp?rev=49673&view=auto
==============================================================================
--- trunk/src/game_controller_abstract.hpp (added)
+++ trunk/src/game_controller_abstract.hpp Sat May 28 00:44:45 2011
@@ -1,0 +1,61 @@
+/* $Id$ */
+/*
+ Copyright (C) 2011 by Lukasz Dobrogowski <[email protected]>
+ Part of the Battle for Wesnoth Project http://www.wesnoth.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY.
+
+ See the COPYING file for more details.
+*/
+#ifndef GAME_CONTROLLER_ABSTRACT_H_INCLUDED
+#define GAME_CONTROLLER_ABSTRACT_H_INCLUDED
+#include "editor/editor_main.hpp"
+#include <string>
+
+class config;
+class game_display;
+
+class game_controller_abstract
+{
+public:
+ virtual game_display& disp() = 0;
+
+ virtual bool init_video() = 0;
+ virtual bool init_config() = 0;
+ virtual bool init_language() = 0;
+ virtual bool play_test() = 0;
+ virtual bool play_multiplayer_mode() = 0;
+ virtual bool play_screenshot_mode() = 0;
+
+ virtual void reload_changed_game_config() = 0;
+
+ virtual bool is_loading() const = 0;
+ virtual void clear_loaded_game() = 0;
+ virtual bool load_game() = 0;
+ virtual void set_tutorial() = 0;
+
+ virtual std::string jump_to_campaign_id() const = 0;
+ virtual bool new_campaign() = 0;
+ virtual bool goto_campaign() = 0;
+ virtual bool goto_multiplayer() = 0;
+ virtual bool goto_editor() = 0;
+
+ virtual bool play_multiplayer() = 0;
+ virtual bool change_language() = 0;
+
+ virtual void show_preferences() = 0;
+
+ enum RELOAD_GAME_DATA { RELOAD_DATA, NO_RELOAD_DATA };
+ virtual void launch_game(RELOAD_GAME_DATA) = 0;
+ virtual void play_replay() = 0;
+
+ virtual editor::EXIT_STATUS start_editor() = 0;
+
+ virtual const config& game_config() const = 0;
+};
+#endif
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits