Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make is possible to switch from replay directly into normal play
http://gna.org/bugs/?23833 I removed the replay_controller class, instead the normal replay also uses the mp_replay_controller class which is a 'plugin' to playsingle_controller which can just be deactivated to switch into normal gameplay.
- Loading branch information
Showing
21 changed files
with
206 additions
and
837 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +0,0 @@ | ||
/* | ||
Copyright (C) 2014 - 2015 by Chris Beck <render787@gmail.com> | ||
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 "hotkey_handler_replay.hpp" | ||
|
||
#include "hotkey/hotkey_command.hpp" | ||
#include "hotkey/hotkey_item.hpp" | ||
#include "network.hpp" //for nconnections (to determine if we are in a networked game) | ||
#include "play_controller.hpp" | ||
#include "replay_controller.hpp" | ||
|
||
replay_controller::hotkey_handler::hotkey_handler(replay_controller & pc, saved_game & sg) | ||
: play_controller::hotkey_handler(pc, sg) | ||
, replay_controller_(pc) | ||
{} | ||
|
||
replay_controller::hotkey_handler::~hotkey_handler(){} | ||
|
||
void replay_controller::hotkey_handler::preferences(){ | ||
play_controller::hotkey_handler::preferences(); | ||
replay_controller_.update_gui(); //todo: why is this needed? | ||
} | ||
|
||
void replay_controller::hotkey_handler::show_statistics(){ | ||
menu_handler_.show_statistics(gui()->playing_team()+1); //playing team instead of viewing team | ||
} | ||
|
||
bool replay_controller::hotkey_handler::can_execute_command(const hotkey::hotkey_command& cmd, int index) const | ||
{ | ||
hotkey::HOTKEY_COMMAND command = cmd.id; | ||
bool result = play_controller::hotkey_handler::can_execute_command(cmd,index); | ||
|
||
switch(command) { | ||
|
||
//commands we can always do | ||
case hotkey::HOTKEY_REPLAY_SHOW_EVERYTHING: | ||
case hotkey::HOTKEY_REPLAY_SHOW_EACH: | ||
case hotkey::HOTKEY_REPLAY_SHOW_TEAM1: | ||
case hotkey::HOTKEY_REPLAY_SKIP_ANIMATION: | ||
case hotkey::HOTKEY_SAVE_GAME: | ||
case hotkey::HOTKEY_SAVE_REPLAY: | ||
case hotkey::HOTKEY_LABEL_SETTINGS: | ||
case hotkey::HOTKEY_CHAT_LOG: | ||
return true; | ||
|
||
case hotkey::HOTKEY_REPLAY_RESET: | ||
return events::commands_disabled <= 1; | ||
|
||
//commands we only can do before the end of the replay | ||
case hotkey::HOTKEY_REPLAY_STOP: | ||
return !replay_controller_.recorder_at_end(); | ||
case hotkey::HOTKEY_REPLAY_PLAY: | ||
case hotkey::HOTKEY_REPLAY_NEXT_TURN: | ||
case hotkey::HOTKEY_REPLAY_NEXT_SIDE: | ||
case hotkey::HOTKEY_REPLAY_NEXT_MOVE: | ||
//we have one events_disabler when starting the replay_controller and a second when entering the synced context. | ||
return replay_controller_.should_stop() && (events::commands_disabled <= 1 ) && !replay_controller_.recorder_at_end(); | ||
default: | ||
return result; | ||
} | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +0,0 @@ | ||
/* | ||
Copyright (C) 2014 - 2015 by Chris Beck <render787@gmail.com> | ||
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. | ||
*/ | ||
|
||
/** | ||
* @file | ||
* An extension of play_controller::hotkey_handler, which has support for | ||
* replay controller features | ||
*/ | ||
|
||
#ifndef HOTKEY_HANDLER_REPLAY_HPP_INCL_ | ||
#define HOTKEY_HANDLER_REPLAY_HPP_INCL_ | ||
|
||
#include "replay_controller.hpp" | ||
#include "hotkey_handler.hpp" | ||
#include "global.hpp" | ||
|
||
class replay_controller::hotkey_handler : public play_controller::hotkey_handler { | ||
|
||
protected: | ||
replay_controller & replay_controller_; | ||
|
||
public: | ||
hotkey_handler(replay_controller &, saved_game &); | ||
~hotkey_handler(); | ||
|
||
virtual void preferences(); | ||
virtual void show_statistics(); | ||
virtual bool can_execute_command(const hotkey::hotkey_command& command, int index=-1) const; | ||
|
||
virtual void reset_replay() OVERRIDE | ||
{ return replay_controller_.reset_replay(); } | ||
virtual void stop_replay() OVERRIDE | ||
{ return replay_controller_.stop_replay(); } | ||
virtual void play_replay() OVERRIDE | ||
{ return replay_controller_.play_replay(); } | ||
virtual void replay_next_turn() OVERRIDE | ||
{ return replay_controller_.replay_next_turn(); } | ||
virtual void replay_next_side() OVERRIDE | ||
{ return replay_controller_.replay_next_side(); } | ||
virtual void replay_next_move() OVERRIDE | ||
{ return replay_controller_.replay_next_move(); } | ||
virtual void replay_show_everything() OVERRIDE | ||
{ return replay_controller_.replay_show_everything(); } | ||
virtual void replay_show_each() OVERRIDE | ||
{ return replay_controller_.replay_show_each(); } | ||
virtual void replay_show_team1() OVERRIDE | ||
{ return replay_controller_.replay_show_team1(); } | ||
|
||
}; | ||
|
||
#endif | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.