summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2020-02-14 17:53:24 +0100
committerglx22 <glx22@users.noreply.github.com>2020-02-14 21:43:21 +0100
commit47790b09a41429fd7673d152e0c64c33630505ee (patch)
tree3b21f839800c09514e005fede34fba86e2f53a59 /src/game
parent05b50aa437cd8049f6cc822264cfa74851957710 (diff)
downloadopenttd-47790b09a41429fd7673d152e0c64c33630505ee.tar.xz
Codechange: Simplify CheckAPIVersion()
Diffstat (limited to 'src/game')
-rw-r--r--src/game/game_info.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/game/game_info.cpp b/src/game/game_info.cpp
index a039401b3..77725c5e7 100644
--- a/src/game/game_info.cpp
+++ b/src/game/game_info.cpp
@@ -13,6 +13,7 @@
#include "game_info.hpp"
#include "game_scanner.hpp"
#include "../debug.h"
+#include <set>
#include "../safeguards.h"
@@ -22,10 +23,8 @@
*/
static bool CheckAPIVersion(const char *api_version)
{
- return strcmp(api_version, "1.2") == 0 || strcmp(api_version, "1.3") == 0 || strcmp(api_version, "1.4") == 0 ||
- strcmp(api_version, "1.5") == 0 || strcmp(api_version, "1.6") == 0 || strcmp(api_version, "1.7") == 0 ||
- strcmp(api_version, "1.8") == 0 || strcmp(api_version, "1.9") == 0 || strcmp(api_version, "1.10") == 0 ||
- strcmp(api_version, "1.11") == 0;
+ static const std::set<std::string> versions = {"1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "1.10", "1.11"};
+ return versions.find(api_version) != versions.end();
}
#if defined(_WIN32)