mirror of https://github.com/OpenTTD/OpenTTD
(svn r22805) -Codechange: move use of magic number for version checking to more logical location
parent
786ae457f1
commit
f6b0561cd8
|
@ -381,7 +381,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendGetMap()
|
||||||
* branches we make tarballs of the OpenTTDs compiled from tarball
|
* branches we make tarballs of the OpenTTDs compiled from tarball
|
||||||
* will have the lower bits set to 0. As such they would become
|
* will have the lower bits set to 0. As such they would become
|
||||||
* incompatible, which we would like to prevent by this. */
|
* 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);
|
my_client->SendPacket(p);
|
||||||
return NETWORK_RECV_STATUS_OKAY;
|
return NETWORK_RECV_STATUS_OKAY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -975,7 +975,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_GETMAP(Packet *
|
||||||
* branches we make tarballs of the OpenTTDs compiled from tarball
|
* branches we make tarballs of the OpenTTDs compiled from tarball
|
||||||
* will have the lower bits set to 0. As such they would become
|
* will have the lower bits set to 0. As such they would become
|
||||||
* incompatible, which we would like to prevent by this. */
|
* incompatible, which we would like to prevent by this. */
|
||||||
if (HasBit(_openttd_newgrf_version, 19)) {
|
if (IsReleasedVersion()) {
|
||||||
if (_openttd_newgrf_version != p->Recv_uint32()) {
|
if (_openttd_newgrf_version != p->Recv_uint32()) {
|
||||||
/* The version we get from the client differs, it must have the
|
/* The version we get from the client differs, it must have the
|
||||||
* wrong version. The client must be wrong. */
|
* wrong version. The client must be wrong. */
|
||||||
|
|
|
@ -10,8 +10,18 @@
|
||||||
/** @file rev.cpp Autogenerated file with the revision and such of OpenTTD. */
|
/** @file rev.cpp Autogenerated file with the revision and such of OpenTTD. */
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
#include "core/bitmath_func.hpp"
|
||||||
#include "rev.h"
|
#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.
|
* The text version of OpenTTD's revision.
|
||||||
* This will be either "<major>.<minor>.<build>[-RC<rc>]",
|
* This will be either "<major>.<minor>.<build>[-RC<rc>]",
|
||||||
|
|
|
@ -17,4 +17,6 @@ extern const char _openttd_build_date[];
|
||||||
extern const byte _openttd_revision_modified;
|
extern const byte _openttd_revision_modified;
|
||||||
extern const uint32 _openttd_newgrf_version;
|
extern const uint32 _openttd_newgrf_version;
|
||||||
|
|
||||||
|
bool IsReleasedVersion();
|
||||||
|
|
||||||
#endif /* REV_H */
|
#endif /* REV_H */
|
||||||
|
|
Loading…
Reference in New Issue