summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-08-26 20:26:40 +0000
committerrubidium <rubidium@openttd.org>2009-08-26 20:26:40 +0000
commit984efae368da7a7a7e5090820ef31c9c3a678670 (patch)
tree11323bd20267db20ec28f3fca8fdb49033ced626 /src
parent57a05d693314c816220b47e9a79974192d919fc2 (diff)
downloadopenttd-984efae368da7a7a7e5090820ef31c9c3a678670.tar.xz
(svn r17291) -Fix [FS#3147]: crash after upgrading base graphics/sound set when opening the game options menu and you were using the upgraded set
Diffstat (limited to 'src')
-rw-r--r--src/base_media_func.h5
-rw-r--r--src/network/network_content_gui.cpp2
2 files changed, 7 insertions, 0 deletions
diff --git a/src/base_media_func.h b/src/base_media_func.h
index 2117d7ff9..40d154d65 100644
--- a/src/base_media_func.h
+++ b/src/base_media_func.h
@@ -159,6 +159,11 @@ bool BaseMedia<Tbase_set>::AddFile(const char *filename, size_t basepath_length)
/* don't allow recursive delete of all remaining items */
duplicate->next = NULL;
+ /* If the duplicate set is currently used (due to rescanning this can happen)
+ * update the currently used set to the new one. This will 'lie' about the
+ * version number until a new game is started which isn't a big problem */
+ if (BaseMedia<Tbase_set>::used_set == duplicate) BaseMedia<Tbase_set>::used_set = set;
+
DEBUG(grf, 1, "Removing %s (%i) as base " SET_TYPE " set (duplicate)", duplicate->name, duplicate->version);
delete duplicate;
ret = true;
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 7dd89d4d4..8b4c88978 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -100,10 +100,12 @@ public:
case CONTENT_TYPE_BASE_GRAPHICS:
BaseGraphics::FindSets();
+ InvalidateWindow(WC_GAME_OPTIONS, 0);
break;
case CONTENT_TYPE_BASE_SOUNDS:
BaseSounds::FindSets();
+ InvalidateWindow(WC_GAME_OPTIONS, 0);
break;
case CONTENT_TYPE_NEWGRF: