summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/network/network_client.cpp2
-rw-r--r--src/network/network_server.cpp2
-rw-r--r--src/rev.cpp.in10
-rw-r--r--src/rev.h2
4 files changed, 14 insertions, 2 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 1f16332c9..5e03e638a 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -381,7 +381,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendGetMap()
* branches we make tarballs of the OpenTTDs compiled from tarball
* will have the lower bits set to 0. As such they would become
* incompatible, which we would like to prevent by this. */
- if (HasBit(_openttd_newgrf_version, 19)) p->Send_uint32(_openttd_newgrf_version);
+ if (IsReleasedVersion()) p->Send_uint32(_openttd_newgrf_version);
my_client->SendPacket(p);
return NETWORK_RECV_STATUS_OKAY;
}
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index bd4b16056..507c9232e 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -975,7 +975,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_GETMAP(Packet *
* branches we make tarballs of the OpenTTDs compiled from tarball
* will have the lower bits set to 0. As such they would become
* incompatible, which we would like to prevent by this. */
- if (HasBit(_openttd_newgrf_version, 19)) {
+ if (IsReleasedVersion()) {
if (_openttd_newgrf_version != p->Recv_uint32()) {
/* The version we get from the client differs, it must have the
* wrong version. The client must be wrong. */
diff --git a/src/rev.cpp.in b/src/rev.cpp.in
index 6eb90dc4a..3ce64b6de 100644
--- a/src/rev.cpp.in
+++ b/src/rev.cpp.in
@@ -10,9 +10,19 @@
/** @file rev.cpp Autogenerated file with the revision and such of OpenTTD. */
#include "stdafx.h"
+#include "core/bitmath_func.hpp"
#include "rev.h"
/**
+ * Is this version of OpenTTD a release version?
+ * @return True if it is a release version.
+ */
+bool IsReleasedVersion()
+{
+ return HasBit(_openttd_newgrf_version, 19);
+}
+
+/**
* The text version of OpenTTD's revision.
* This will be either "<major>.<minor>.<build>[-RC<rc>]",
* "r<revision number>[M][-<branch>]" or "norev000".
diff --git a/src/rev.h b/src/rev.h
index 621a41c4b..50b265419 100644
--- a/src/rev.h
+++ b/src/rev.h
@@ -17,4 +17,6 @@ extern const char _openttd_build_date[];
extern const byte _openttd_revision_modified;
extern const uint32 _openttd_newgrf_version;
+bool IsReleasedVersion();
+
#endif /* REV_H */