summaryrefslogtreecommitdiff
path: root/src/gfxinit.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2009-02-07 01:01:02 +0000
committerpeter1138 <peter1138@openttd.org>2009-02-07 01:01:02 +0000
commit43a8400647ddeb1009f8a17a8cc384e43729d25f (patch)
tree96e2527960abf9f0224b1ad21987e0e62bb6985c /src/gfxinit.cpp
parent1a14688926623f8e413a133f849b6f0b0076ebb2 (diff)
downloadopenttd-43a8400647ddeb1009f8a17a8cc384e43729d25f.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.cpp40
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