implement linger mode in mp
nothing gets saved in linger mode it seems so any chat in linger mode will not be replayed
This commit is contained in:
parent
9895112812
commit
325d220bb6
4 changed files with 63 additions and 0 deletions
|
@ -28,6 +28,7 @@
|
|||
* the server sends the game id and not only the game name if a player joins
|
||||
a game to avoid ambiguity in case of multiple games with the same name
|
||||
* show observer team chat messages in the 'Chat Log' window
|
||||
* implement linger mode for multiplayer
|
||||
* units:
|
||||
* balancing changes:
|
||||
* gave the Fugitive the concealment ability (village hiding)
|
||||
|
|
|
@ -26,6 +26,7 @@ Version 1.3.7+svn:
|
|||
* Multiplayer
|
||||
* Revised maps: Charge, Den of Onis, Meteor Lake, Silverhead Crossing,
|
||||
Triple Blitz, Clash.
|
||||
* Linger mode now allows chatting.
|
||||
|
||||
* Unit changes and balancing
|
||||
* Gave the Fugitive the concealment ability. (village hiding)
|
||||
|
|
|
@ -215,6 +215,66 @@ void playmp_controller::play_human_turn(){
|
|||
menu_handler_.clear_undo_stack(player_number_);
|
||||
}
|
||||
|
||||
void playmp_controller::linger(upload_log& log)
|
||||
{
|
||||
LOG_NG << "beginning end-of-scenario linger";
|
||||
browse_ = true;
|
||||
linger_ = true;
|
||||
// this is actually for after linger mode is over -- we don't want to
|
||||
// stay stuck in linger state when the *next* scenario is over.
|
||||
gamestate_.completion = "running";
|
||||
// End all unit moves
|
||||
for (unit_map::iterator u = units_.begin(); u != units_.end(); u++) {
|
||||
u->second.set_user_end_turn(true);
|
||||
}
|
||||
try {
|
||||
// reimplement parts of play_side()
|
||||
//! @todo FIXME: needs cleaning up of unnecessary stuff
|
||||
// the timer probably needs some handling
|
||||
turn_data_ = new turn_info(gameinfo_,gamestate_,status_,
|
||||
*gui_,map_,teams_,player_number_,units_,replay_sender_, undo_stack_);
|
||||
turn_data_->replay_error().attach_handler(this);
|
||||
gui_->enable_menu("endturn", true);
|
||||
while(!end_turn_) {
|
||||
config cfg;
|
||||
const network::connection res = network::receive_data(cfg);
|
||||
std::deque<config> backlog;
|
||||
|
||||
if(res != network::null_connection) {
|
||||
try{
|
||||
turn_data_->process_network_data(cfg,res,backlog,skip_replay_);
|
||||
}
|
||||
catch (replay::error& e){
|
||||
process_oos(e.message);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
play_slice();
|
||||
// } catch(end_level_exception& e) {
|
||||
// turn_data_->send_data();
|
||||
// throw e;
|
||||
|
||||
gui_->draw();
|
||||
|
||||
turn_data_->send_data();
|
||||
}
|
||||
menu_handler_.clear_undo_stack(player_number_);
|
||||
// send any remaining data
|
||||
turn_data_->send_data();
|
||||
if (turn_data_ != NULL){
|
||||
turn_data_->replay_error().detach_handler(this);
|
||||
delete turn_data_;
|
||||
turn_data_ = NULL;
|
||||
}
|
||||
} catch(game::load_game_exception&) {
|
||||
// Loading a new game is effectively a quit.
|
||||
log.quit(status_.turn());
|
||||
throw;
|
||||
}
|
||||
LOG_NG << "ending end-of-scenario linger";
|
||||
}
|
||||
|
||||
void playmp_controller::after_human_turn(){
|
||||
if ( level_["mp_countdown"] == "yes" ){
|
||||
const int action_increment = lexical_cast_default<int>(level_["mp_countdown_action_bonus"],0);
|
||||
|
|
|
@ -36,6 +36,7 @@ public:
|
|||
bool counting_down();
|
||||
void think_about_countdown(int ticks);
|
||||
void process(events::pump_info &info);
|
||||
void linger(upload_log&);
|
||||
|
||||
protected:
|
||||
virtual void handle_generic_event(const std::string& name);
|
||||
|
|
Loading…
Add table
Reference in a new issue