diff options
author | rubidium <rubidium@openttd.org> | 2007-03-01 00:58:09 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-03-01 00:58:09 +0000 |
commit | 3e9cc1a6519a047d558115032c6b4dfcd707f105 (patch) | |
tree | ebdcf69054797bb9fc5617433a69657bed21ed6f /src/network/network.cpp | |
parent | 51d2dfa05d25d6dc7ba63a6501807562eacb47fc (diff) | |
download | openttd-3e9cc1a6519a047d558115032c6b4dfcd707f105.tar.xz |
(svn r8949) -Codechange: only test the first NETWORK_REVISION_LENGTH - 1 characters when determining network compatability. This makes it possible to have 'long' branch names while still being able to play network games.
Diffstat (limited to 'src/network/network.cpp')
-rw-r--r-- | src/network/network.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp index aa45ef748..c523623ce 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -1421,4 +1421,17 @@ void NetworkShutDown(void) NetworkCoreShutdown(); } +/** + * Checks whether the given version string is compatible with our version. + * It'll check the first NETWORK_REVISION_LENGTH - 1 characters (-1 for '\0') + * against the current version and the NOREV_STRING. + * @param other the version string to compare to + */ +bool IsNetworkCompatibleVersion(const char *other) +{ + extern const char _openttd_revision[]; + return strncmp(NOREV_STRING, other, NETWORK_REVISION_LENGTH - 1) == 0 || + strncmp(_openttd_revision, other, NETWORK_REVISION_LENGTH - 1) == 0; +} + #endif /* ENABLE_NETWORK */ |