Skip to content

Commit

Permalink
remove unnecessary resource:: ptr uses
Browse files Browse the repository at this point in the history
play_controller contains the whiteboard manager as a local variable,
and therefore doesn't need to use the externally linked resource
pointers.
  • Loading branch information
cbeck88 committed Jun 13, 2014
1 parent 95749ec commit 7df5aab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/play_controller.cpp
Expand Up @@ -734,7 +734,7 @@ void play_controller::do_init_side(bool is_replay, bool only_visual) {
loading_game_ = false;

check_victory();
resources::whiteboard->on_init_side();
whiteboard_manager_->on_init_side();
}

//builds the snapshot config from its members and their configs respectively
Expand Down Expand Up @@ -792,7 +792,7 @@ config play_controller::to_config() const

void play_controller::finish_side_turn(){

resources::whiteboard->on_finish_side_turn(player_number_);
whiteboard_manager_->on_finish_side_turn(player_number_);

gameboard_.end_turn(player_number_);

Expand Down
24 changes: 12 additions & 12 deletions src/playsingle_controller.cpp
Expand Up @@ -112,21 +112,21 @@ void playsingle_controller::init_gui(){
void playsingle_controller::recruit(){
if (!browse_)
menu_handler_.recruit(player_number_, mouse_handler_.get_last_hex());
else if (resources::whiteboard->is_active())
else if (whiteboard_manager_->is_active())
menu_handler_.recruit(resources::screen->viewing_side(), mouse_handler_.get_last_hex());
}

void playsingle_controller::repeat_recruit(){
if (!browse_)
menu_handler_.repeat_recruit(player_number_, mouse_handler_.get_last_hex());
else if (resources::whiteboard->is_active())
else if (whiteboard_manager_->is_active())
menu_handler_.repeat_recruit(resources::screen->viewing_side(), mouse_handler_.get_last_hex());
}

void playsingle_controller::recall(){
if (!browse_)
menu_handler_.recall(player_number_, mouse_handler_.get_last_hex());
else if (resources::whiteboard->is_active())
else if (whiteboard_manager_->is_active())
menu_handler_.recall(resources::screen->viewing_side(), mouse_handler_.get_last_hex());
}

Expand Down Expand Up @@ -223,9 +223,9 @@ void playsingle_controller::clear_messages(){
}

void playsingle_controller::whiteboard_toggle() {
resources::whiteboard->set_active(!resources::whiteboard->is_active());
whiteboard_manager_->set_active(!whiteboard_manager_->is_active());

if (resources::whiteboard->is_active()) {
if (whiteboard_manager_->is_active()) {
std::string hk = hotkey::get_names(hotkey::hotkey_command::get_command_by_command(hotkey::HOTKEY_WB_TOGGLE).command);
utils::string_map symbols;
symbols["hotkey"] = hk;
Expand All @@ -236,7 +236,7 @@ void playsingle_controller::whiteboard_toggle() {
gui_->announce(_("Planning mode deactivated!"), font::NORMAL_COLOR);
}
//@todo Stop printing whiteboard help in the chat once we have better documentation/help
resources::whiteboard->print_help_once();
whiteboard_manager_->print_help_once();
}

void playsingle_controller::whiteboard_execute_action(){
Expand Down Expand Up @@ -617,7 +617,7 @@ LEVEL_RESULT playsingle_controller::play_scenario(

possible_end_play_signal playsingle_controller::play_turn()
{
resources::whiteboard->on_gamestate_change();
whiteboard_manager_->on_gamestate_change();
gui_->new_turn();
gui_->invalidate_game_status();
events::raise_draw_event();
Expand Down Expand Up @@ -926,7 +926,7 @@ hotkey::ACTION_STATE playsingle_controller::get_action_state(hotkey::HOTKEY_COMM
{
switch(command) {
case hotkey::HOTKEY_WB_TOGGLE:
return resources::whiteboard->is_active() ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
return whiteboard_manager_->is_active() ? hotkey::ACTION_ON : hotkey::ACTION_OFF;
default:
return play_controller::get_action_state(command, index);
}
Expand Down Expand Up @@ -1055,7 +1055,7 @@ bool playsingle_controller::can_execute_command(const hotkey::hotkey_command& cm
case hotkey::HOTKEY_RECRUIT:
case hotkey::HOTKEY_REPEAT_RECRUIT:
case hotkey::HOTKEY_RECALL:
return (!browse_ || resources::whiteboard->is_active()) && !linger_ && !events::commands_disabled;
return (!browse_ || whiteboard_manager_->is_active()) && !linger_ && !events::commands_disabled;
case hotkey::HOTKEY_ENDTURN:
return (!browse_ || linger_) && !events::commands_disabled;

Expand Down Expand Up @@ -1101,12 +1101,12 @@ bool playsingle_controller::can_execute_command(const hotkey::hotkey_command& cm
return !is_observer();
case hotkey::HOTKEY_WB_EXECUTE_ACTION:
case hotkey::HOTKEY_WB_EXECUTE_ALL_ACTIONS:
return resources::whiteboard->can_enable_execution_hotkeys();
return whiteboard_manager_->can_enable_execution_hotkeys();
case hotkey::HOTKEY_WB_DELETE_ACTION:
return resources::whiteboard->can_enable_modifier_hotkeys();
return whiteboard_manager_->can_enable_modifier_hotkeys();
case hotkey::HOTKEY_WB_BUMP_UP_ACTION:
case hotkey::HOTKEY_WB_BUMP_DOWN_ACTION:
return resources::whiteboard->can_enable_reorder_hotkeys();
return whiteboard_manager_->can_enable_reorder_hotkeys();
case hotkey::HOTKEY_WB_SUPPOSE_DEAD:
{
//@todo re-enable this once we figure out a decent UI for suppose_dead
Expand Down

0 comments on commit 7df5aab

Please sign in to comment.