started move of game_controller to separate file,

...removed anonymous namespaces in game.cpp
This commit is contained in:
Lukasz Dobrogowski 2011-05-27 22:04:06 +00:00
parent 053d5e374e
commit 9fda56ab2b
5 changed files with 131 additions and 7 deletions

View file

@ -358,6 +358,7 @@ set(wesnoth-main_SRC
formula_function.cpp
formula_string_utils.cpp
formula_tokenizer.cpp
game_controller.cpp
game_display.cpp
game_errors.cpp
game_events.cpp

View file

@ -220,6 +220,7 @@ wesnoth_sources = Split("""
formula_function.cpp
formula_string_utils.cpp
formula_tokenizer.cpp
game_controller.cpp
game_display.cpp
game_errors.cpp
game_events.cpp

View file

@ -129,7 +129,6 @@ static bool less_campaigns_rank(const config &a, const config &b) {
return a["rank"].to_int(1000) < b["rank"].to_int(1000);
}
namespace {
struct jump_to_campaign_info
{
public:
@ -1196,8 +1195,6 @@ bool game_controller::new_campaign()
return true;
}
}
std::string game_controller::jump_to_campaign_id() const
{
return jump_to_campaign_.campaign_id_;
@ -1244,8 +1241,6 @@ bool game_controller::goto_editor()
return true;
}
namespace
{
void game_controller::reload_changed_game_config()
{
// rebuild addon version info cache
@ -1633,8 +1628,6 @@ void game_controller::launch_game(RELOAD_GAME_DATA reload)
}
}
} //end anon namespace
void game_controller::play_replay()
{
const binary_paths_manager bin_paths_manager(game_config());

17
src/game_controller.cpp Normal file
View file

@ -0,0 +1,17 @@
/* $Id$ */
/*
Copyright (C) 2003 - 2011 by David White <dave@whitevine.net>
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.
*/
#include "game_controller.hpp"

112
src/game_controller.hpp Normal file
View file

@ -0,0 +1,112 @@
/* $Id$ */
/*
Copyright (C) 2003 - 2011 by David White <dave@whitevine.net>
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_H_INCLUDED
#define GAME_CONTROLLER_H_INCLUDED
// class game_controller
// {
// public:
// game_controller(int argc, char** argv);
// ~game_controller();
//
// game_display& disp();
//
// bool init_video();
// bool init_config(const bool force=false);
// 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() { game::load_game_exception::game.clear(); }
// 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();
//
// 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 = "");
//
// void start_wesnothd();
// const config& game_config() const { return game_config_; }
//
// private:
// game_controller(const game_controller&);
// void operator=(const game_controller&);
//
// void load_game_cfg(const bool force=false);
// void set_unit_data();
//
// void mark_completed_campaigns(std::vector<config>& campaigns);
//
// const int argc_;
// int arg_;
// const char* const * const argv_;
//
// //this should get destroyed *after* the video, since we want
// //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_;
// const events::event_context main_event_context_;
// const hotkey::manager hotkey_manager_;
// sound::music_thinker music_thinker_;
// resize_monitor resize_monitor_;
// binary_paths_manager paths_manager_;
//
// std::string test_scenario_;
//
// bool test_mode_, multiplayer_mode_, no_gui_, screenshot_mode_;
// std::string screenshot_map_, screenshot_filename_;
// int force_bpp_;
//
// 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_instance game_instance_;
// game_state state_;
//
// std::string multiplayer_server_;
// bool jump_to_multiplayer_;
// jump_to_campaign_info jump_to_campaign_;
//
// bool jump_to_editor_;
//
// game_config::config_cache& cache_;
// };
#endif