The long-awaited dynamic modification of the End Turn button for linger mode.
This commit is contained in:
parent
70e39ffbfd
commit
541df15e2d
5 changed files with 20 additions and 13 deletions
|
@ -143,7 +143,7 @@
|
|||
[menu]
|
||||
id=button-endturn
|
||||
title= _ "End Turn"
|
||||
title2= _ "Advance"
|
||||
title2= _ "Next Scenario"
|
||||
items=endturn
|
||||
ref=bottom-right-panel
|
||||
rect="=+17,=+7,+80,+20"
|
||||
|
|
|
@ -159,7 +159,7 @@
|
|||
[menu]
|
||||
id=button-endturn
|
||||
title= _ "End Turn"
|
||||
title2= _ "Advance"
|
||||
title2= _ "Next Scenario"
|
||||
image=lite_small
|
||||
items=endturn
|
||||
ref=bottom-right-panel
|
||||
|
|
|
@ -234,6 +234,10 @@ void playmp_controller::linger(upload_log& log)
|
|||
}
|
||||
beep_warning_time_=-1;
|
||||
|
||||
// change the end-turn button text to its alternate label
|
||||
gui_->get_theme().refresh_title2(std::string("button-endturn"), std::string("title2"));
|
||||
gui_->invalidate_theme();
|
||||
|
||||
// switch to observer viewpoint
|
||||
gui_->set_team(0,true);
|
||||
gui_->recalculate_minimap();
|
||||
|
@ -255,6 +259,11 @@ void playmp_controller::linger(upload_log& log)
|
|||
log.quit(status_.turn());
|
||||
throw;
|
||||
}
|
||||
|
||||
// revert the end-turn button text to its normal label
|
||||
gui_->get_theme().refresh_title2(std::string("button-endturn"), std::string("title"));
|
||||
gui_->invalidate_theme();
|
||||
|
||||
LOG_NG << "ending end-of-scenario linger";
|
||||
}
|
||||
|
||||
|
|
|
@ -567,8 +567,9 @@ void playsingle_controller::linger(upload_log& log)
|
|||
// is over.
|
||||
gamestate_.completion = "running";
|
||||
|
||||
//FIXME: Change the button text
|
||||
//gui::button* b = gui_->find_button("button-endturn");
|
||||
// change the end-turn button text to its alternate label
|
||||
gui_->get_theme().refresh_title2(std::string("button-endturn"), std::string("title2"));
|
||||
gui_->invalidate_theme();
|
||||
|
||||
// End all unit moves
|
||||
for (unit_map::iterator u = units_.begin(); u != units_.end(); u++) {
|
||||
|
@ -588,6 +589,11 @@ void playsingle_controller::linger(upload_log& log)
|
|||
log.quit(status_.turn());
|
||||
throw;
|
||||
}
|
||||
|
||||
// revert the end-turn button text to its normal label
|
||||
gui_->get_theme().refresh_title2(std::string("button-endturn"), std::string("title"));
|
||||
gui_->invalidate_theme();
|
||||
|
||||
LOG_NG << "ending end-of-scenario linger";
|
||||
}
|
||||
|
||||
|
|
|
@ -738,19 +738,11 @@ theme::menu* theme::refresh_title(const std::string& id, const std::string& new_
|
|||
}
|
||||
|
||||
theme::menu* theme::refresh_title2(const std::string& id, const std::string& title_tag){
|
||||
theme::menu* res = NULL;
|
||||
std::string new_title = "";
|
||||
|
||||
config& cfg = find_ref(id, cfg_, false);
|
||||
if (! cfg[title_tag].empty())
|
||||
new_title = cfg[title_tag];
|
||||
|
||||
for (std::vector<theme::menu>::iterator m = menus_.begin(); m != menus_.end(); ++m){
|
||||
if (m->get_id() == id) {
|
||||
res = &(*m);
|
||||
res->set_title(new_title);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
return refresh_title(id, new_title);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue