From 871552eab28d07c3aaf0cabb5fb167c0eb365bdf Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 22 Dec 2014 16:02:48 +0000 Subject: Fixed a bug where the lad/savegame dialog wouldn't show the screenshot of the first selected savegame, minor code cleamups in material handling. --- src/client/savegamemenu.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/client') diff --git a/src/client/savegamemenu.cc b/src/client/savegamemenu.cc index 4b546ac..b91a45c 100644 --- a/src/client/savegamemenu.cc +++ b/src/client/savegamemenu.cc @@ -152,7 +152,7 @@ void SaveGameMenu::resize() ); // resize screenshot - model::Material *screenshotmaterial = model::Material::find("ui/screenshot"); + const model::Material *screenshotmaterial = model::Material::find("ui/screenshot"); if (screenshotmaterial) { float sx = savegamemenu_descrtitle->width() / screenshotmaterial->size().width(); float sy = ui::UI::elementsize.width() / screenshotmaterial->size().height(); @@ -280,6 +280,7 @@ void SaveGameMenu::hide() if ((*lit)->texture().size()) { render::Textures::unload((*lit)->texture()); (*lit)->set_texture(""); + (*lit)->set_texture_id(0); } } @@ -329,8 +330,7 @@ void SaveGameMenu::show_file_info() model::Material *screenshotmaterial = model::Material::find("ui/screenshot"); if (!screenshotmaterial) { - screenshotmaterial = new model::Material("ui/screenshot"); - model::Material::registry()[screenshotmaterial->name()] = screenshotmaterial; + screenshotmaterial = model::Material::add("ui/screenshot"); } model::Layer *screenshotlayer = 0; @@ -345,16 +345,16 @@ void SaveGameMenu::show_file_info() screenshotlayer->set_texture(""); } - std::string screenshotfilename("savegames/" + savename); + const std::string screenshotfilename("savegames/" + savename); screenshotlayer->set_texture(screenshotfilename); render::Textures::image_loader(screenshotlayer); screenshotmaterial->set_size(screenshotlayer->size()); - + savegamemenu_screenshot->set_texture(screenshotmaterial->name()); savegamemenu_screenshot->show(); resize(); - + } else { // new savegame, immediatly show the save game dialog show_save_dialog(); -- cgit v1.2.3