From: Holger Schemel Date: Thu, 11 Feb 2021 00:39:33 +0000 (+0100) Subject: added storing and checking program version in artwork info cache X-Git-Tag: 4.2.3.0~14 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=5985bdeb8c45af7f98466f3bda30b1913a2fc9cf;p=rocksndiamonds.git added storing and checking program version in artwork info cache --- diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 458ad40b..a135b0d5 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -2330,6 +2330,8 @@ static void saveSetupFileHash(SetupFileHash *hash, char *filename) return; } + fprintf(file, "%s\n\n", getFormattedSetupEntry("program.version", + program.version_string)); for (i = 0; i < item_count; i++) fprintf(file, "%s\n", getFormattedSetupEntry(sort_array[i].token, sort_array[i].value)); @@ -2927,6 +2929,17 @@ static void LoadArtworkInfoCache(void) // try to load artwork info hash from already existing cache file artworkinfo_cache_old = loadSetupFileHash(filename); + // try to get program version that artwork info cache was written with + char *version = getHashEntry(artworkinfo_cache_old, "program.version"); + + // check program version of artwork info cache against current version + if (!strEqual(version, program.version_string)) + { + freeSetupFileHash(artworkinfo_cache_old); + + artworkinfo_cache_old = NULL; + } + // if no artwork info cache file was found, start with empty hash if (artworkinfo_cache_old == NULL) artworkinfo_cache_old = newSetupFileHash();