Skip to content

Commit

Permalink
remove more unnecessary arguments, from play_controller::play_side
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed May 30, 2014
1 parent 1e4858f commit 890f6f0
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/play_controller.hpp
Expand Up @@ -112,7 +112,7 @@ class play_controller : public controller_base, public events::observer, public

void maybe_do_init_side(bool is_replay = false, bool only_visual = false);
void do_init_side(bool is_replay = false, bool only_visual = false);
virtual void play_side(const unsigned int side_number, bool save) = 0;
virtual void play_side(bool save) = 0;

virtual void force_end_turn() = 0;
virtual void force_end_level(LEVEL_RESULT res) = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/playmp_controller.cpp
Expand Up @@ -92,7 +92,7 @@ void playmp_controller::stop_network(){
LOG_NG << "network processing stopped";
}

void playmp_controller::play_side(const unsigned int side_number, bool save)
void playmp_controller::play_side(bool save)
{
utils::string_map player;
player["name"] = current_team().current_player();
Expand All @@ -101,7 +101,7 @@ void playmp_controller::play_side(const unsigned int side_number, bool save)
gui_->send_notification(_("Turn changed"), turn_notification_msg);

// Proceed with the parent function.
playsingle_controller::play_side(side_number, save);
playsingle_controller::play_side(save);
}

void playmp_controller::before_human_turn(bool save){
Expand Down
2 changes: 1 addition & 1 deletion src/playmp_controller.hpp
Expand Up @@ -48,7 +48,7 @@ class playmp_controller : public playsingle_controller, public events::pump_moni
virtual void stop_network();
virtual bool can_execute_command(const hotkey::hotkey_command& command, int index=-1) const;

virtual void play_side(const unsigned int side_number, bool save);
virtual void play_side(bool save);
virtual void before_human_turn(bool save);
virtual void play_human_turn();
virtual void after_human_turn();
Expand Down
19 changes: 9 additions & 10 deletions src/playsingle_controller.cpp
Expand Up @@ -633,7 +633,7 @@ void playsingle_controller::play_turn(bool save)
LOG_NG << "result of replay: " << (replaying_?"true":"false") << "\n";
} else {
ai_testing::log_turn_start(player_number_);
play_side(player_number_, save);
play_side(save);
}

finish_side_turn();
Expand Down Expand Up @@ -670,9 +670,8 @@ void playsingle_controller::play_idle_loop()
}
}

void playsingle_controller::play_side(const unsigned int side_number, bool save)
void playsingle_controller::play_side(bool save)
{
assert(static_cast<int>(side_number) == player_number_);
//check for team-specific items in the scenario
gui_->parse_team_overlays();

Expand All @@ -686,7 +685,7 @@ void playsingle_controller::play_side(const unsigned int side_number, bool save)
if (!skip_next_turn_)
end_turn_ = false;

statistics::reset_turn_stats(teams_[side_number - 1].save_id());
statistics::reset_turn_stats(teams_[player_number_ - 1].save_id());

if(current_team().is_human() || temporary_human) {
LOG_NG << "is human...\n";
Expand All @@ -701,13 +700,13 @@ void playsingle_controller::play_side(const unsigned int side_number, bool save)
play_human_turn();
}
} catch(end_turn_exception& end_turn) {
if (end_turn.redo == side_number) {
if (end_turn.redo == player_number_) {
player_type_changed_ = true;
// If new controller is not human,
// reset gui to prev human one
if (!teams_[side_number-1].is_human()) {
if (!teams_[player_number_-1].is_human()) {
browse_ = true;
int s = find_human_team_before(side_number);
int s = find_human_team_before(player_number_);
if (s <= 0)
s = gui_->playing_side();
update_gui_to_player(s-1);
Expand Down Expand Up @@ -740,13 +739,13 @@ void playsingle_controller::play_side(const unsigned int side_number, bool save)

} catch(end_turn_exception& end_turn) {
LOG_NG << "Escaped from idle state with exception!" << std::endl;
if (end_turn.redo == side_number) {
if (end_turn.redo == player_number_) {
player_type_changed_ = true;
// If new controller is not human,
// reset gui to prev human one
if (!teams_[side_number-1].is_human()) {
if (!teams_[player_number_-1].is_human()) {
browse_ = true;
int s = find_human_team_before(side_number);
int s = find_human_team_before(player_number_);
if (s <= 0)
s = gui_->playing_side();
update_gui_to_player(s-1);
Expand Down
2 changes: 1 addition & 1 deletion src/playsingle_controller.hpp
Expand Up @@ -75,7 +75,7 @@ class playsingle_controller : public play_controller

protected:
virtual void play_turn(bool save);
virtual void play_side(const unsigned int side_number, bool save);
virtual void play_side(bool save);
virtual void before_human_turn(bool save);
void show_turn_dialog();
void execute_gotos();
Expand Down
8 changes: 4 additions & 4 deletions src/replay_controller.cpp
Expand Up @@ -342,9 +342,9 @@ void replay_controller::replay_next_side(){
is_playing_ = true;
replay_ui_playback_should_start();

play_side(player_number_ - 1, false);
play_side(false);
while (current_team().is_empty()) {
play_side(player_number_ - 1, false);
play_side( false);
}

if (!skip_replay_ || !is_playing_) {
Expand Down Expand Up @@ -439,13 +439,13 @@ void replay_controller::play_turn(){

while ( (!last_team) && (!recorder.at_end()) && is_playing_ ){
last_team = static_cast<size_t>(player_number_) == teams_.size();
play_side(player_number_ - 1, false);
play_side(false);
play_slice();
}
}

//make only one side move
void replay_controller::play_side(const unsigned int /*team_index*/, bool){
void replay_controller::play_side(bool){

DBG_REPLAY << "Status turn number: " << turn() << "\n";
DBG_REPLAY << "Replay_Controller turn number: " << current_turn_ << "\n";
Expand Down
2 changes: 1 addition & 1 deletion src/replay_controller.hpp
Expand Up @@ -62,7 +62,7 @@ class replay_controller : public play_controller
private:
void init();
virtual void play_turn();
virtual void play_side(const unsigned int team_index, bool save);
virtual void play_side(bool save);
void update_teams();
void update_gui();
void init_replay_display();
Expand Down

0 comments on commit 890f6f0

Please sign in to comment.