diff options
author | peter1138 <peter1138@openttd.org> | 2009-02-07 01:01:02 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2009-02-07 01:01:02 +0000 |
commit | 967491a22d6828686f17c9ea6215d3a48cee7dc8 (patch) | |
tree | 96e2527960abf9f0224b1ad21987e0e62bb6985c /src/gfxinit.cpp | |
parent | ae2fda6c0214d4952a1fadcb891a8daa819e65ba (diff) | |
download | openttd-967491a22d6828686f17c9ea6215d3a48cee7dc8.tar.xz |
(svn r15389) -Feature: Add ability to select which base graphics set is used from the Game Options window. The change takes effect when the window is closed. This option can only be used from the intro menu, as reloading graphics during a game may cause issues.
Diffstat (limited to 'src/gfxinit.cpp')
-rw-r--r-- | src/gfxinit.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index 2db1a4c16..984ea9730 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -569,3 +569,43 @@ bool HasGraphicsSet(const ContentInfo *ci, bool md5sum) } #endif /* ENABLE_NETWORK */ + +/** + * Count the number of available graphics sets. + */ +int GetNumGraphicsSets() +{ + int n = 0; + for (const GraphicsSet *g = _available_graphics_sets; g != NULL; g = g->next) { + if (g->found_grfs <= 1) continue; + n++; + } + return n; +} + +/** + * Get the index of the currently active graphics set + */ +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; + n++; + } + return -1; +} + +/** + * Get the name of the graphics set at the specified index + */ +const char *GetGraphicsSetName(int index) +{ + for (const GraphicsSet *g = _available_graphics_sets; g != NULL; g = g->next) { + if (g->found_grfs <= 1) continue; + if (index == 0) return g->name; + index--; + } + error("GetGraphicsSetName: index %d out of range", index); +}
\ No newline at end of file |