From 555bafae0b8696e758ac0383cf0c1cc64f5fb78b Mon Sep 17 00:00:00 2001 From: otavepto Date: Sat, 23 Dec 2023 19:08:16 +0200 Subject: [PATCH] use the index argument to grab the preview URL from UGC query result, thanks to remelt from: viewtopic.php?p=2964432#p2964432 --- dll/steam_ugc.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dll/steam_ugc.h b/dll/steam_ugc.h index c7c752d8..e64d35fa 100644 --- a/dll/steam_ugc.h +++ b/dll/steam_ugc.h @@ -227,8 +227,13 @@ bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STR //TODO: escape simulator tries downloading this url and unsubscribes if it fails auto request = std::find_if(ugc_queries.begin(), ugc_queries.end(), [&handle](struct UGC_query const& item) { return item.handle == handle; }); - if ((ugc_queries.end() != request) && !(index >= request->results.size())) { + if ((ugc_queries.end() != request) && (index < request->results.size())) { + // point at the beginning of the results auto it = request->results.begin(); + // then get the target result + //this is required for Escape Simulator to show the correct Preview Image, else it will be always the first + std::advance(it, index); + uint32 it2 = (uint32)*it; PRINT_DEBUG("Steam_UGC:GetQueryUGCPreviewURL: %u %s\n", it2, settings->getMod(it2).previewURL.c_str()); snprintf(pchURL, cchURLSize, "%s", settings->getMod(it2).previewURL.c_str());