1
0
forked from mirrors/0ad

Suppress a file not found error and show the placeholder image instead of plain magenta if the mappreview wasn't found.

This was SVN commit r18614.
This commit is contained in:
elexis
2016-08-17 23:11:11 +00:00
parent 7470e88624
commit 9846f374a0
@@ -149,7 +149,10 @@ function getMapDescriptionAndPreview(mapType, mapName)
*/
function setMapPreviewImage(guiObject, filename)
{
Engine.GetGUIObjectByName(guiObject).sprite = "cropped:" + 400/512+ "," + 300/512 + ":session/icons/mappreview/" + filename;
let path = "session/icons/mappreview/";
Engine.GetGUIObjectByName(guiObject).sprite =
"cropped:" + 400/512 + "," + 300/512 + ":" +
path + (Engine.FileExists("art/textures/ui/" + path + filename) ? filename : "nopreview.png");
}
/**