Fixed bug #17207
This commit is contained in:
parent
08b81853bf
commit
cc6ffebbbc
5 changed files with 33 additions and 9 deletions
|
@ -91,6 +91,7 @@ display::display(CVideo& video, const gamemap* map, const config& theme_cfg, con
|
|||
invalidateGameStatus_(true),
|
||||
map_labels_(new map_labels(*this, 0)),
|
||||
scroll_event_("scrolled"),
|
||||
complete_redraw_event_("completely_redrawn"),
|
||||
nextDraw_(0),
|
||||
reportRects_(),
|
||||
reportSurfaces_(),
|
||||
|
@ -1960,6 +1961,8 @@ void display::redraw_everything()
|
|||
foreach (boost::function<void(display&)> f, redraw_observers_) {
|
||||
f(*this);
|
||||
}
|
||||
|
||||
complete_redraw_event_.notify_observers();
|
||||
}
|
||||
|
||||
void display::add_redraw_observer(boost::function<void(display&)> f)
|
||||
|
|
|
@ -425,6 +425,8 @@ public:
|
|||
|
||||
/** Expose the event, so observers can be notified about map scrolling. */
|
||||
events::generic_event &scroll_event() const { return scroll_event_; }
|
||||
|
||||
events::generic_event& complete_redraw_event() { return complete_redraw_event_; }
|
||||
|
||||
/** Check if a tile is fully visible on screen. */
|
||||
bool tile_fully_on_screen(const map_location& loc);
|
||||
|
@ -567,6 +569,12 @@ protected:
|
|||
|
||||
/** Event raised when the map is being scrolled */
|
||||
mutable events::generic_event scroll_event_;
|
||||
|
||||
/**
|
||||
* notify observers that the screen has been redrawn completely
|
||||
* atm this is used for replay_controller to add replay controls to the standard theme
|
||||
*/
|
||||
events::generic_event complete_redraw_event_;
|
||||
|
||||
/**
|
||||
* Holds the tick count for when the next drawing event is scheduled.
|
||||
|
|
|
@ -85,7 +85,8 @@ replay_controller::~replay_controller()
|
|||
//YogiHH
|
||||
//not absolutely sure if this is needed, but it makes me feel a lot better ;-)
|
||||
//feel free to delete this if it is not necessary
|
||||
gui_->get_theme().theme_reset().detach_handler(this);
|
||||
gui_->get_theme().theme_reset_event().detach_handler(this);
|
||||
gui_->complete_redraw_event().detach_handler(this);
|
||||
}
|
||||
|
||||
void replay_controller::init(){
|
||||
|
@ -118,7 +119,8 @@ void replay_controller::init_replay_display(){
|
|||
DBG_REPLAY << "initializing replay-display... " << (SDL_GetTicks() - ticks_) << "\n";
|
||||
|
||||
rebuild_replay_theme();
|
||||
gui_->get_theme().theme_reset().attach_handler(this);
|
||||
gui_->get_theme().theme_reset_event().attach_handler(this);
|
||||
gui_->complete_redraw_event().attach_handler(this);
|
||||
DBG_REPLAY << "done initializing replay-display... " << (SDL_GetTicks() - ticks_) << "\n";
|
||||
}
|
||||
|
||||
|
@ -230,8 +232,10 @@ void replay_controller::reset_replay(){
|
|||
player_number_ = 1;
|
||||
current_turn_ = 1;
|
||||
previous_turn_ = 0;
|
||||
skip_replay_ = false;
|
||||
tod_manager_= tod_manager_start_;
|
||||
recorder.start_replay();
|
||||
recorder.set_skip(false);
|
||||
units_ = units_start_;
|
||||
gamestate_ = gamestate_start_;
|
||||
teams_ = teams_start_;
|
||||
|
@ -326,8 +330,8 @@ void replay_controller::replay_show_team1(){
|
|||
}
|
||||
|
||||
void replay_controller::replay_skip_animation(){
|
||||
recorder.set_skip(!recorder.is_skipping());
|
||||
skip_replay_ = !skip_replay_;
|
||||
recorder.set_skip(skip_replay_);
|
||||
}
|
||||
|
||||
//move all sides till stop/end
|
||||
|
@ -458,8 +462,17 @@ void replay_controller::show_statistics(){
|
|||
menu_handler_.show_statistics(gui_->playing_team()+1);
|
||||
}
|
||||
|
||||
void replay_controller::handle_generic_event(const std::string& /*name*/){
|
||||
rebuild_replay_theme();
|
||||
void replay_controller::handle_generic_event(const std::string& name){
|
||||
|
||||
if( name == "completely_redrawn" ) {
|
||||
buttons_.update(gui_);
|
||||
|
||||
gui::button* skip_animation_button = gui_->find_button("skip-animation");
|
||||
|
||||
skip_animation_button->set_check(skip_replay_);
|
||||
} else {
|
||||
rebuild_replay_theme();
|
||||
}
|
||||
}
|
||||
|
||||
bool replay_controller::can_execute_command(hotkey::HOTKEY_COMMAND command, int index) const
|
||||
|
|
|
@ -524,7 +524,7 @@ theme::menu::menu(const config &cfg):
|
|||
}
|
||||
|
||||
theme::theme(const config& cfg, const SDL_Rect& screen) :
|
||||
theme_reset_("theme_reset"),
|
||||
theme_reset_event_("theme_reset"),
|
||||
cur_theme(),
|
||||
cfg_(),
|
||||
panels_(),
|
||||
|
@ -594,7 +594,7 @@ bool theme::set_resolution(const SDL_Rect& screen)
|
|||
m->set_title(title_stash[m->get_id()]);
|
||||
}
|
||||
|
||||
theme_reset_.notify_observers();
|
||||
theme_reset_event_.notify_observers();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ public:
|
|||
|
||||
const tborder& border() const { return border_; }
|
||||
|
||||
events::generic_event& theme_reset() { return theme_reset_; }
|
||||
events::generic_event& theme_reset_event() { return theme_reset_event_; }
|
||||
|
||||
private:
|
||||
theme::object& find_element(std::string id);
|
||||
|
@ -233,7 +233,7 @@ private:
|
|||
|
||||
//notify observers that the theme has been rebuilt completely
|
||||
//atm this is used for replay_controller to add replay controls to the standard theme
|
||||
events::generic_event theme_reset_;
|
||||
events::generic_event theme_reset_event_;
|
||||
|
||||
static std::map<std::string, config> known_themes;
|
||||
std::string cur_theme;
|
||||
|
|
Loading…
Add table
Reference in a new issue