(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.

This commit is contained in:
rubidium
2007-03-01 00:58:09 +00:00
parent 3dc71e3484
commit 66487d59fd
4 changed files with 17 additions and 6 deletions

View File

@@ -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 */