Fixed OoS bug when giving control and having move in undo stack.

This commit is contained in:
Pauli Nieminen 2008-08-30 15:29:15 +00:00
parent 30fb091b0b
commit 376e62bb95
3 changed files with 21 additions and 0 deletions

View file

@ -44,6 +44,7 @@ Version 1.5.3+svn:
* Made config cache code available to eveverywhere in wesnoth * Made config cache code available to eveverywhere in wesnoth
* Fixed [modify_turns] giving the unwanted side-effect of changing * Fixed [modify_turns] giving the unwanted side-effect of changing
turn limit when only current= modifier was used. turn limit when only current= modifier was used.
* Fixed OOS bug when giving control and having move in undo stack.
* Fixed [modify_turns] not updating $turn_number when current= was * Fixed [modify_turns] not updating $turn_number when current= was
used. used.
* Fixed a few inconsistencies related to scenarios which are not at * Fixed a few inconsistencies related to scenarios which are not at

View file

@ -23,6 +23,9 @@ Version 1.5.3:
* Parts of the new widget libary are deemed stable enough for testing and * Parts of the new widget libary are deemed stable enough for testing and
have been started to replace the old code. have been started to replace the old code.
* Bug fixes:
* Fixed OOS bug when giving control and having move in undo stack.
Version 1.5.3: Version 1.5.3:
* Campaigns * Campaigns
* Descent into Darkness * Descent into Darkness

View file

@ -23,6 +23,8 @@
#include "sound.hpp" #include "sound.hpp"
#include "upload_log.hpp" #include "upload_log.hpp"
#include "SDL.h"
#include <cassert> #include <cassert>
#define LOG_NG LOG_STREAM(info, engine) #define LOG_NG LOG_STREAM(info, engine)
@ -186,6 +188,21 @@ void playmp_controller::play_human_turn(){
try{ try{
if (turn_data_->process_network_data(cfg,res,backlog,skip_replay_) == turn_info::PROCESS_RESTART_TURN) if (turn_data_->process_network_data(cfg,res,backlog,skip_replay_) == turn_info::PROCESS_RESTART_TURN)
{ {
// Clean undo stack if turn has to be restarted (losing control)
if (!undo_stack_.empty())
{
const std::string msg =_("Undoing moves not yet transmited to server.");
const int size = 20;
const int lifetime = 150;
SDL_Color colour = {255,255,255,255};
SDL_Rect rect = gui_->map_area();
font::add_floating_label(msg,size, colour,
rect.w/2,rect.h/2,0.0,0.0,lifetime,rect,font::CENTER_ALIGN);
}
while(!undo_stack_.empty())
menu_handler_.undo(gui_->get_playing_team() + 1);
throw end_turn_exception(gui_->get_playing_team() + 1); throw end_turn_exception(gui_->get_playing_team() + 1);
} }
} }