Skip to content

Commit

Permalink
rename ambiguous "game_controller" to "game_launcher"
Browse files Browse the repository at this point in the history
Minor change but helps to reduce the overuse / misuse of the term
"controller" in key class names in the project.
  • Loading branch information
cbeck88 committed Jun 29, 2014
1 parent da41bf9 commit b4d6a25
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 55 deletions.
4 changes: 2 additions & 2 deletions projectfiles/CodeBlocks/wesnoth.cbp
Expand Up @@ -338,8 +338,6 @@
<Unit filename="..\..\src\game_config.hpp" />
<Unit filename="..\..\src\game_config_manager.cpp" />
<Unit filename="..\..\src\game_config_manager.hpp" />
<Unit filename="..\..\src\game_controller.cpp" />
<Unit filename="..\..\src\game_controller.hpp" />
<Unit filename="..\..\src\game_data.cpp" />
<Unit filename="..\..\src\game_data.hpp" />
<Unit filename="..\..\src\game_display.cpp" />
Expand All @@ -362,6 +360,8 @@
<Unit filename="..\..\src\game_events\pump.hpp" />
<Unit filename="..\..\src\game_events\wmi_container.cpp" />
<Unit filename="..\..\src\game_events\wmi_container.hpp" />
<Unit filename="..\..\src\game_launcher.cpp" />
<Unit filename="..\..\src\game_launcher.hpp" />
<Unit filename="..\..\src\game_preferences.cpp" />
<Unit filename="..\..\src\game_preferences.hpp" />
<Unit filename="..\..\src\game_preferences_display.cpp" />
Expand Down
16 changes: 8 additions & 8 deletions projectfiles/VC9/wesnoth.vcproj
Expand Up @@ -20284,14 +20284,6 @@
RelativePath="..\..\src\game_config_manager.hpp"
>
</File>
<File
RelativePath="..\..\src\game_controller.cpp"
>
</File>
<File
RelativePath="..\..\src\game_controller.hpp"
>
</File>
<File
RelativePath="..\..\src\game_data.cpp"
>
Expand Down Expand Up @@ -20324,6 +20316,14 @@
RelativePath="..\..\src\game_errors.hpp"
>
</File>
<File
RelativePath="..\..\src\game_launcher.cpp"
>
</File>
<File
RelativePath="..\..\src\game_launcher.hpp"
>
</File>
<File
RelativePath="..\..\src\game_preferences.cpp"
>
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Expand Up @@ -743,7 +743,6 @@ set(wesnoth-main_SRC
game_board.cpp
game_classification.cpp
game_config_manager.cpp
game_controller.cpp
game_data.cpp
game_display.cpp
game_errors.cpp
Expand All @@ -754,6 +753,7 @@ set(wesnoth-main_SRC
game_events/menu_item.cpp
game_events/pump.cpp
game_events/wmi_container.cpp
game_launcher.cpp
game_preferences.cpp
game_preferences_display.cpp
game_state.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/SConscript
Expand Up @@ -276,7 +276,6 @@ wesnoth_sources = Split("""
game_board.cpp
game_classification.cpp
game_config_manager.cpp
game_controller.cpp
game_data.cpp
game_display.cpp
game_errors.cpp
Expand All @@ -287,6 +286,7 @@ wesnoth_sources = Split("""
game_events/menu_item.cpp
game_events/pump.cpp
game_events/wmi_container.cpp
game_launcher.cpp
game_preferences.cpp
game_state.cpp
gui/auxiliary/canvas.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/construct_dialog.hpp
Expand Up @@ -282,7 +282,7 @@ class dialog {
/// Explicit freeing of class static resources.
/// Must not be called if any instances of this class exist.
/// Should be called if the display goes out of scope.
/// (Currently called by ~game_controller.)
/// (Currently called by ~game_launcher.)
static void delete_empty_menu() { delete empty_menu; empty_menu = NULL; }

protected:
Expand Down
56 changes: 28 additions & 28 deletions src/game_controller.cpp → src/game_launcher.cpp
Expand Up @@ -12,7 +12,7 @@
See the COPYING file for more details.
*/

#include "game_controller.hpp"
#include "game_launcher.hpp"
#include "global.hpp" // for false_, bool_

#include "about.hpp" //for show_about
Expand Down Expand Up @@ -100,7 +100,7 @@ static bool less_campaigns_rank(const config &a, const config &b) {
return a["rank"].to_int(1000) < b["rank"].to_int(1000);
}

game_controller::game_controller(const commandline_options& cmdline_opts, const char *appname) :
game_launcher::game_launcher(const commandline_options& cmdline_opts, const char *appname) :
cmdline_opts_(cmdline_opts),
disp_(NULL),
video_(),
Expand Down Expand Up @@ -307,7 +307,7 @@ game_controller::game_controller(const commandline_options& cmdline_opts, const
}
}

game_display& game_controller::disp()
game_display& game_launcher::disp()
{
if(disp_.get() == NULL) {
if(get_video_surface() == NULL) {
Expand All @@ -318,7 +318,7 @@ game_display& game_controller::disp()
return *disp_.get();
}

bool game_controller::init_joystick()
bool game_launcher::init_joystick()
{
if (!preferences::joystick_support_enabled())
return false;
Expand All @@ -341,7 +341,7 @@ bool game_controller::init_joystick()
return joystick_found;
}

bool game_controller::init_language()
bool game_launcher::init_language()
{
if(!::load_language_list())
return false;
Expand All @@ -367,7 +367,7 @@ bool game_controller::init_language()
return true;
}

bool game_controller::init_video()
bool game_launcher::init_video()
{
if(cmdline_opts_.nogui || cmdline_opts_.headless_unit_test) {
if( !(cmdline_opts_.multiplayer || cmdline_opts_.screenshot || cmdline_opts_.headless_unit_test) ) {
Expand Down Expand Up @@ -442,7 +442,7 @@ bool game_controller::init_video()
return true;
}

bool game_controller::play_test()
bool game_launcher::play_test()
{
static bool first_time = true;

Expand Down Expand Up @@ -471,7 +471,7 @@ bool game_controller::play_test()
}

// Same as play_test except that we return the results of play_game.
int game_controller::unit_test()
int game_launcher::unit_test()
{
static bool first_time_unit = true;

Expand Down Expand Up @@ -546,7 +546,7 @@ int game_controller::unit_test()
return 0; //we passed, huzzah!
}

bool game_controller::play_screenshot_mode()
bool game_launcher::play_screenshot_mode()
{
if(!cmdline_opts_.screenshot) {
return true;
Expand All @@ -561,12 +561,12 @@ bool game_controller::play_screenshot_mode()
return false;
}

bool game_controller::is_loading() const
bool game_launcher::is_loading() const
{
return !game::load_game_exception::game.empty();
}

bool game_controller::load_game()
bool game_launcher::load_game()
{
savegame::loadgame load(disp(), resources::config_manager->game_config(),
state_);
Expand Down Expand Up @@ -670,22 +670,22 @@ bool game_controller::load_game()
return true;
}

void game_controller::set_tutorial()
void game_launcher::set_tutorial()
{
state_ = saved_game();
state_.classification().campaign_type = game_classification::TUTORIAL;
state_.carryover_sides_start["next_scenario"] = "tutorial";
state_.classification().campaign_define = "TUTORIAL";
}

void game_controller::mark_completed_campaigns(std::vector<config> &campaigns)
void game_launcher::mark_completed_campaigns(std::vector<config> &campaigns)
{
BOOST_FOREACH(config &campaign, campaigns) {
campaign["completed"] = preferences::is_campaign_completed(campaign["id"]);
}
}

bool game_controller::new_campaign()
bool game_launcher::new_campaign()
{
state_ = saved_game();
state_.classification().campaign_type = game_classification::SCENARIO;
Expand Down Expand Up @@ -828,17 +828,17 @@ bool game_controller::new_campaign()
return true;
}

std::string game_controller::jump_to_campaign_id() const
std::string game_launcher::jump_to_campaign_id() const
{
return jump_to_campaign_.campaign_id_;
}

bool game_controller::goto_campaign()
bool game_launcher::goto_campaign()
{
if(jump_to_campaign_.jump_){
if(new_campaign()) {
jump_to_campaign_.jump_ = false;
launch_game(game_controller::RELOAD_DATA);
launch_game(game_launcher::RELOAD_DATA);
}else{
jump_to_campaign_.jump_ = false;
return false;
Expand All @@ -847,7 +847,7 @@ bool game_controller::goto_campaign()
return true;
}

bool game_controller::goto_multiplayer()
bool game_launcher::goto_multiplayer()
{
if(jump_to_multiplayer_){
jump_to_multiplayer_ = false;
Expand All @@ -860,7 +860,7 @@ bool game_controller::goto_multiplayer()
return true;
}

bool game_controller::goto_editor()
bool game_launcher::goto_editor()
{
if(jump_to_editor_){
jump_to_editor_ = false;
Expand All @@ -874,7 +874,7 @@ bool game_controller::goto_editor()
return true;
}

void game_controller::start_wesnothd()
void game_launcher::start_wesnothd()
{
const std::string wesnothd_program =
preferences::get_mp_server_program_name().empty() ?
Expand Down Expand Up @@ -905,7 +905,7 @@ void game_controller::start_wesnothd()
throw game::mp_server_error("Starting MP server failed!");
}

bool game_controller::play_multiplayer()
bool game_launcher::play_multiplayer()
{
int res;

Expand Down Expand Up @@ -1021,7 +1021,7 @@ bool game_controller::play_multiplayer()
return false;
}

bool game_controller::play_multiplayer_commandline()
bool game_launcher::play_multiplayer_commandline()
{
if(!cmdline_opts_.multiplayer) {
return true;
Expand All @@ -1045,7 +1045,7 @@ bool game_controller::play_multiplayer_commandline()
return false;
}

bool game_controller::change_language()
bool game_launcher::change_language()
{
gui2::tlanguage_selection dlg;
dlg.show(disp().video());
Expand All @@ -1064,7 +1064,7 @@ bool game_controller::change_language()
return true;
}

void game_controller::show_preferences()
void game_launcher::show_preferences()
{
const preferences::display_manager disp_manager(&disp());
preferences::show_preferences_dialog(disp(),
Expand All @@ -1073,7 +1073,7 @@ void game_controller::show_preferences()
disp().redraw_everything();
}

void game_controller::launch_game(RELOAD_GAME_DATA reload)
void game_launcher::launch_game(RELOAD_GAME_DATA reload)
{
loadscreen::global_loadscreen_manager loadscreen_manager(disp().video());
loadscreen::start_stage("load data");
Expand Down Expand Up @@ -1107,7 +1107,7 @@ void game_controller::launch_game(RELOAD_GAME_DATA reload)
}
}

void game_controller::play_replay()
void game_launcher::play_replay()
{
try {
::play_replay(disp(),state_,resources::config_manager->game_config(),
Expand All @@ -1121,7 +1121,7 @@ void game_controller::play_replay()
}
}

editor::EXIT_STATUS game_controller::start_editor(const std::string& filename)
editor::EXIT_STATUS game_launcher::start_editor(const std::string& filename)
{
while(true){
resources::config_manager->load_game_config_for_editor();
Expand All @@ -1140,7 +1140,7 @@ editor::EXIT_STATUS game_controller::start_editor(const std::string& filename)
return editor::EXIT_ERROR; // not supposed to happen
}

game_controller::~game_controller()
game_launcher::~game_launcher()
{
try {
gui::dialog::delete_empty_menu();
Expand Down
14 changes: 7 additions & 7 deletions src/game_controller.hpp → src/game_launcher.hpp
Expand Up @@ -11,8 +11,8 @@
See the COPYING file for more details.
*/
#ifndef GAME_CONTROLLER_H_INCLUDED
#define GAME_CONTROLLER_H_INCLUDED
#ifndef GAME_LAUNCHER_H_INCLUDED
#define GAME_LAUNCHER_H_INCLUDED

#include "global.hpp"

Expand Down Expand Up @@ -51,11 +51,11 @@ struct jump_to_campaign_info
std::string campaign_id_,scenario_id_;
};

class game_controller
class game_launcher
{
public:
game_controller(const commandline_options& cmdline_opts, const char* appname);
~game_controller();
game_launcher(const commandline_options& cmdline_opts, const char* appname);
~game_launcher();

game_display& disp();

Expand Down Expand Up @@ -94,8 +94,8 @@ class game_controller

void start_wesnothd();
private:
game_controller(const game_controller&);
void operator=(const game_controller&);
game_launcher(const game_launcher&);
void operator=(const game_launcher&);

void mark_completed_campaigns(std::vector<config>& campaigns);

Expand Down

0 comments on commit b4d6a25

Please sign in to comment.