Refresh the image from the locator upon redraw.

This fixes the title screen logo and map not to change after changing
the language. (Fixes bug #16631.)
This commit is contained in:
Mark de Wever 2010-09-29 20:21:54 +00:00
parent ffc051d908
commit 887bd5f7d6
2 changed files with 22 additions and 36 deletions

View File

@ -37,6 +37,8 @@ Version 1.9.1+svn:
* Fixed: Enter no longer shows the credits in the title screen.
* Changed: The title screen now has a maximum width for the tips text.
* Changed: Improved the layout of the title screen.
* Fixed: Changing the language updates map and logo in title screen
(bug #16631).
* WML Engine:
* id= in SUFs now accepts a comma-separated list
* [capture_village] now accepts a full SLF

View File

@ -785,20 +785,6 @@ timage::timage(const config& cfg)
* Also the general variables are available, see [[#general_variables|Line]].
*/
if(!image_name_.has_formula()) {
surface tmp(image::get_image(image::locator(cfg["name"])));
if(!tmp) {
ERR_GUI_D << "Image: '" << cfg["name"]
<< "' not found and won't be drawn.\n";
return;
}
image_.assign(make_neutral_surface(tmp));
assert(image_);
src_clip_ = ::create_rect(0, 0, image_->w, image_->h);
}
const std::string& debug = (cfg["debug"]);
if(!debug.empty()) {
DBG_GUI_P << "Image: found debug message '" << debug << "'.\n";
@ -815,32 +801,30 @@ void timage::draw(surface& canvas
* silly unless there has been a resize. So to optimize we should use an
* extra flag or do the calculation in a separate routine.
*/
if(image_name_.has_formula()) {
const std::string& name = image_name_(variables);
const std::string& name = image_name_(variables);
if(name.empty()) {
DBG_GUI_D
<< "Image: formula returned no value, will not be drawn.\n";
return;
}
surface tmp(image::get_image(image::locator(name)));
if(!tmp) {
ERR_GUI_D << "Image: formula returned name '"
<< name << "'not found and won't be drawn.\n";
return;
}
image_.assign(make_neutral_surface(tmp));
assert(image_);
src_clip_ = ::create_rect(0, 0, image_->w, image_->h);
} else if(!image_){
// The warning about no image should already have taken place
// so leave silently.
if(name.empty()) {
DBG_GUI_D
<< "Image: formula returned no value, will not be drawn.\n";
return;
}
/*
* The locator might return a different surface for every call so we can't
* cache the output, also not if no formula is used.
*/
surface tmp(image::get_image(image::locator(name)));
if(!tmp) {
ERR_GUI_D << "Image: '" << name
<< "' not found and won't be drawn.\n";
return;
}
image_.assign(make_neutral_surface(tmp));
assert(image_);
src_clip_ = ::create_rect(0, 0, image_->w, image_->h);
game_logic::map_formula_callable local_variables(variables);
local_variables.add("image_original_width", variant(image_->w));
local_variables.add("image_original_height", variant(image_->h));