From b36d54ec767afca8c8f135dd1279b0c312b3b729 Mon Sep 17 00:00:00 2001 From: ANAND Date: Tue, 29 Oct 2019 14:18:58 +0530 Subject: [PATCH] Auto-detect screenshots without requiring a map meta field --- mods/ctf/ctf_map/maps_catalog.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/ctf/ctf_map/maps_catalog.lua b/mods/ctf/ctf_map/maps_catalog.lua index ccc93c1..32d7f67 100644 --- a/mods/ctf/ctf_map/maps_catalog.lua +++ b/mods/ctf/ctf_map/maps_catalog.lua @@ -45,8 +45,10 @@ local function show_catalog(name, idx) -- Display screenshot if present, and move other elements down local y = 1 - if map.screenshot then - fs = fs .. "image[4,1.5;6.5,3.5;" .. map.screenshot .. "]" + if ctf_map.file_exists(map.dirname, "screenshot.png") then + -- Check for mapdir .. "/screenshot.png", but pass in the texture + -- name, which would've been renamed to mapdir .. ".png" + fs = fs .. "image[4,1.5;6.5,3.5;" .. map.dirname .. ".png" .. "]" y = y + 3.5 end