summaryrefslogtreecommitdiff
path: root/src/gfxinit.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-02-14 01:42:12 +0000
committerrubidium <rubidium@openttd.org>2009-02-14 01:42:12 +0000
commit7f245b22dcb2e7bcaa2a2590cc239f96a7eb9994 (patch)
tree60cae27ffc0cd7c540ae679947b62a7f3a5d5b0f /src/gfxinit.cpp
parent7b5c5d44329553e1e4d04bf8dcc4538d1ba47112 (diff)
downloadopenttd-7f245b22dcb2e7bcaa2a2590cc239f96a7eb9994.tar.xz
(svn r15476) -Fix [FS#2630]: crash when opening the game options when the currently loaded base graphics pack has less than 2 valid graphics files. For example when someone replaces all his/her original base graphics with custom work (but keeps the name) or renames the dos ones to windows or vice versa.
Diffstat (limited to 'src/gfxinit.cpp')
-rw-r--r--src/gfxinit.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp
index 549ad77e4..c6b725514 100644
--- a/src/gfxinit.cpp
+++ b/src/gfxinit.cpp
@@ -577,7 +577,7 @@ int GetNumGraphicsSets()
{
int n = 0;
for (const GraphicsSet *g = _available_graphics_sets; g != NULL; g = g->next) {
- if (g->found_grfs <= 1) continue;
+ if (g != _used_graphics_set && g->found_grfs <= 1) continue;
n++;
}
return n;
@@ -590,8 +590,8 @@ int GetIndexOfCurrentGraphicsSet()
{
int n = 0;
for (const GraphicsSet *g = _available_graphics_sets; g != NULL; g = g->next) {
- if (g->found_grfs <= 1) continue;
if (g == _used_graphics_set) return n;
+ if (g->found_grfs <= 1) continue;
n++;
}
return -1;
@@ -603,7 +603,7 @@ int GetIndexOfCurrentGraphicsSet()
const char *GetGraphicsSetName(int index)
{
for (const GraphicsSet *g = _available_graphics_sets; g != NULL; g = g->next) {
- if (g->found_grfs <= 1) continue;
+ if (g != _used_graphics_set && g->found_grfs <= 1) continue;
if (index == 0) return g->name;
index--;
}