Skip to content

Commit

Permalink
replace "Team1" option with "First human team" in replay viewer.
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf committed Jun 2, 2015
1 parent 83eb7d3 commit cabbede
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/hotkey/hotkey_command.cpp
Expand Up @@ -103,7 +103,7 @@ hotkey::hotkey_command_temp hotkey_list_[] = {
{ hotkey::HOTKEY_REPLAY_NEXT_MOVE, "replaynextmove", N_("Next Move"), false, scope_game, "" },
{ hotkey::HOTKEY_REPLAY_SHOW_EVERYTHING, "replayshoweverything", N_("Full Map"), false, scope_game, "" },
{ hotkey::HOTKEY_REPLAY_SHOW_EACH, "replayshoweach", N_("Each Team"), false, scope_game, "" },
{ hotkey::HOTKEY_REPLAY_SHOW_TEAM1, "replayshowteam1", N_("Team 1"), false, scope_game, "" },
{ hotkey::HOTKEY_REPLAY_SHOW_TEAM1, "replayshowteam1", N_("Human Team"), false, scope_game, "" },
{ hotkey::HOTKEY_REPLAY_SKIP_ANIMATION, "replayskipanimation", N_("Skip Animation"), false, scope_game, "" },
// Whiteboard commands
// TRANSLATORS: whiteboard menu entry: toggle planning mode
Expand Down
38 changes: 14 additions & 24 deletions src/replay_controller.cpp
Expand Up @@ -115,8 +115,7 @@ replay_controller::replay_controller(const config& level,
, gameboard_start_(gamestate_.board_)
, tod_manager_start_(level)
, is_playing_(false)
, show_everything_(false)
, show_team_(state_of_game.classification().campaign_type == game_classification::MULTIPLAYER ? 0 : 1)
, vision_(state_of_game.classification().campaign_type == game_classification::MULTIPLAYER ? CURRENT_TEAM : HUMAN_TEAM)
{
hotkey_handler_.reset(new hotkey_handler(*this, saved_game_)); //upgrade hotkey handler to the replay controller version

Expand Down Expand Up @@ -149,11 +148,7 @@ void replay_controller::init_gui(){
DBG_NG << "Initializing GUI... " << (SDL_GetTicks() - ticks_) << "\n";
play_controller::init_gui();

if (show_team_)
gui_->set_team(show_team_ - 1, show_everything_);
else
gui_->set_team(0, show_everything_);

gui_->set_team(vision_ == HUMAN_TEAM ? gamestate_.first_human_team_ : 0, vision_ == SHOW_ALL);
gui_->scroll_to_leader(player_number_, display::WARP);
update_locker lock_display((*gui_).video(),false);
BOOST_FOREACH(const team & t, gamestate_.board_.teams()) {
Expand Down Expand Up @@ -423,23 +418,23 @@ void replay_controller::process_oos(const std::string& msg) const
}
}

void replay_controller::replay_show_everything(){
show_everything_ = true;
show_team_ = 0;
void replay_controller::replay_show_everything()
{
vision_ = SHOW_ALL;
update_teams();
update_gui();
}

void replay_controller::replay_show_each(){
show_everything_ = false;
show_team_ = 0;
void replay_controller::replay_show_each()
{
vision_ = CURRENT_TEAM;
update_teams();
update_gui();
}

void replay_controller::replay_show_team1(){
show_everything_ = false;
show_team_ = 1;
void replay_controller::replay_show_team1()
{
vision_ = HUMAN_TEAM;
update_teams();
update_gui();
}
Expand Down Expand Up @@ -557,18 +552,13 @@ void replay_controller::play_move_or_side(bool one_move) {

void replay_controller::update_teams()
{

int next_team = player_number_;
if(static_cast<size_t>(next_team) > gamestate_.board_.teams().size()) {
next_team = 1;
}

if ( show_team_ == 0 ) {
gui_->set_team(next_team - 1, show_everything_);
} else {
gui_->set_team(show_team_ - 1, show_everything_);
}


gui_->set_team(vision_ == HUMAN_TEAM ? gamestate_.first_human_team_ : next_team - 1, vision_ == SHOW_ALL);

gui_->set_playing_team(next_team - 1);
gui_->invalidate_all();
}
Expand Down
10 changes: 7 additions & 3 deletions src/replay_controller.hpp
Expand Up @@ -60,6 +60,12 @@ class replay_controller : public play_controller
virtual void init_gui();

private:
enum REPLAY_VISION
{
HUMAN_TEAM,
CURRENT_TEAM,
SHOW_ALL,
};
void init();
void play_turn();
void play_move_or_side(bool one_move = false);
Expand Down Expand Up @@ -95,9 +101,7 @@ class replay_controller : public play_controller
unsigned int last_replay_action;

bool is_playing_;

bool show_everything_;
unsigned int show_team_;
REPLAY_VISION vision_;
};


Expand Down

0 comments on commit cabbede

Please sign in to comment.