mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 18:40:29 +00:00
Codechange: Simplify CheckAPIVersion()
This commit is contained in:
parent
05b50aa437
commit
47790b09a4
@ -15,6 +15,7 @@
|
|||||||
#include "../debug.h"
|
#include "../debug.h"
|
||||||
#include "../string_func.h"
|
#include "../string_func.h"
|
||||||
#include "../rev.h"
|
#include "../rev.h"
|
||||||
|
#include <set>
|
||||||
|
|
||||||
#include "../safeguards.h"
|
#include "../safeguards.h"
|
||||||
|
|
||||||
@ -24,11 +25,8 @@
|
|||||||
*/
|
*/
|
||||||
static bool CheckAPIVersion(const char *api_version)
|
static bool CheckAPIVersion(const char *api_version)
|
||||||
{
|
{
|
||||||
return strcmp(api_version, "0.7") == 0 || strcmp(api_version, "1.0") == 0 || strcmp(api_version, "1.1") == 0 ||
|
static const std::set<std::string> versions = { "0.7", "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "1.10", "1.11" };
|
||||||
strcmp(api_version, "1.2") == 0 || strcmp(api_version, "1.3") == 0 || strcmp(api_version, "1.4") == 0 ||
|
return versions.find(api_version) != versions.end();
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "game_info.hpp"
|
#include "game_info.hpp"
|
||||||
#include "game_scanner.hpp"
|
#include "game_scanner.hpp"
|
||||||
#include "../debug.h"
|
#include "../debug.h"
|
||||||
|
#include <set>
|
||||||
|
|
||||||
#include "../safeguards.h"
|
#include "../safeguards.h"
|
||||||
|
|
||||||
@ -22,10 +23,8 @@
|
|||||||
*/
|
*/
|
||||||
static bool CheckAPIVersion(const char *api_version)
|
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 ||
|
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"};
|
||||||
strcmp(api_version, "1.5") == 0 || strcmp(api_version, "1.6") == 0 || strcmp(api_version, "1.7") == 0 ||
|
return versions.find(api_version) != versions.end();
|
||||||
strcmp(api_version, "1.8") == 0 || strcmp(api_version, "1.9") == 0 || strcmp(api_version, "1.10") == 0 ||
|
|
||||||
strcmp(api_version, "1.11") == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
Loading…
Reference in New Issue
Block a user