mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 02:19:41 +00:00
(svn r23817) -Fix [FS#4962]: desync due to different NewGRF version. So reduce the chance that it happens significantly with betas/RCs/nightlies by doing the same as is done for stable releases: check the NewGRF version of server vs client.
Previously this check was not done for nightlies/betas/RCs due to missing versioning information in the source tarballs, but they have that for a while now. So just force the NewGRF version check for all versions, and remove the broken --revision configure option
This commit is contained in:
parent
2c99805117
commit
4f62472fd9
@ -37,7 +37,6 @@ STAGE = !!STAGE!!
|
||||
MAKEDEPEND = !!MAKEDEPEND!!
|
||||
CFLAGS_MAKEDEP = !!CFLAGS_MAKEDEP!!
|
||||
SORT = !!SORT!!
|
||||
REVISION = !!REVISION!!
|
||||
AWK = !!AWK!!
|
||||
CONFIG_CACHE_COMPILER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_COMPILER!!
|
||||
CONFIG_CACHE_LINKER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_LINKER!!
|
||||
@ -94,15 +93,9 @@ $(LANG_OBJS_DIR)/table/strings.h: $(LANG_DIR)/english.txt $(LANG_OBJS_DIR)/$(STR
|
||||
VERSIONS := $(shell AWK="$(AWK)" "$(ROOT_DIR)/findversion.sh")
|
||||
MODIFIED := $(shell echo "$(VERSIONS)" | cut -f 3 -d' ')
|
||||
|
||||
ifdef REVISION
|
||||
# Use specified revision (which should be of the form "r000").
|
||||
REV := $(REVISION)
|
||||
REV_NR := $(shell echo $(REVISION) | sed "s@[^0-9]@@g")
|
||||
else
|
||||
# Use autodetected revisions
|
||||
REV := $(shell echo "$(VERSIONS)" | cut -f 1 -d' ')
|
||||
REV_NR := $(shell echo "$(VERSIONS)" | cut -f 2 -d' ')
|
||||
endif
|
||||
|
||||
# Make sure we have something in REV and REV_NR
|
||||
ifeq ($(REV),)
|
||||
|
25
config.lib
25
config.lib
@ -32,7 +32,6 @@ set_default() {
|
||||
os="DETECT"
|
||||
endian="AUTO"
|
||||
cpu_type="DETECT"
|
||||
revision=""
|
||||
config_log="config.log"
|
||||
prefix_dir="/usr/local"
|
||||
binary_dir="games"
|
||||
@ -107,7 +106,6 @@ set_default() {
|
||||
os
|
||||
endian
|
||||
cpu_type
|
||||
revision
|
||||
config_log
|
||||
prefix_dir
|
||||
binary_dir
|
||||
@ -199,8 +197,6 @@ detect_params() {
|
||||
--cpu-type) prev_p="cpu_type";;
|
||||
--cpu-type=*) cpu_type="$optarg";;
|
||||
|
||||
--revision=*) revision="$optarg";;
|
||||
|
||||
--cc-build) prevp_p="cc_build";;
|
||||
--cc-build=*) cc_build="$optarg";;
|
||||
--cc-host) prevp_p="cc_host";;
|
||||
@ -1010,31 +1006,15 @@ check_params() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$revision" ]; then
|
||||
log 1 "checking revision... $revision"
|
||||
log 1 "WARNING: we do not advise you to use this setting"
|
||||
log 1 "WARNING: in most cases it is not safe for network use"
|
||||
log 1 "WARNING: USE WITH CAUTION!"
|
||||
|
||||
sleep 5
|
||||
elif [ -f "$ROOT_DIR/version" ]; then
|
||||
revision="`cat $ROOT_DIR/version`"
|
||||
|
||||
log 1 "checking revision... $revision"
|
||||
elif [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help 2>/dev/null`" ]; then
|
||||
revision=""
|
||||
if [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help 2>/dev/null`" ]; then
|
||||
log 1 "checking revision... svn detection"
|
||||
elif [ -d "$ROOT_DIR/.git" ] && [ -n "`git help 2>/dev/null`" ]; then
|
||||
revision=""
|
||||
log 1 "checking revision... git detection"
|
||||
elif [ -d "$ROOT_DIR/.hg" ] && [ -n "`hg help 2>/dev/null`" ]; then
|
||||
revision=""
|
||||
log 1 "checking revision... hg detection"
|
||||
elif [ -f "$ROOT_DIR/.ottdrev" ]; then
|
||||
revision=""
|
||||
log 1 "checking revision... source tarball"
|
||||
else
|
||||
revision=""
|
||||
log 1 "checking revision... no detection"
|
||||
log 1 "WARNING: there is no means to determine the version."
|
||||
log 1 "WARNING: please use a subversion, mercurial, or git checkout of OpenTTD."
|
||||
@ -3245,7 +3225,6 @@ make_sed() {
|
||||
s@!!SRCS!!@$SRCS@g;
|
||||
s@!!OS!!@$os@g;
|
||||
s@!!CONFIGURE_FILES!!@$CONFIGURE_FILES@g;
|
||||
s@!!REVISION!!@$revision@g;
|
||||
s@!!AWK!!@$awk@g;
|
||||
s@!!DISTCC!!@$distcc@g;
|
||||
s@!!NFORENUM!!@$nforenum@g;
|
||||
@ -3468,8 +3447,6 @@ showhelp() {
|
||||
echo " MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/MINGW/OS2/"
|
||||
echo " DOS/WINCE/PSP/HAIKU"
|
||||
echo " --endian=ENDIAN set the endian of the HOST (AUTO/LE/BE)"
|
||||
echo " --revision=rXXXX overwrite the revision detection."
|
||||
echo " Use with care!"
|
||||
echo ""
|
||||
echo "Paths:"
|
||||
echo " --prefix-dir=dir specifies the prefix for all installed"
|
||||
|
@ -329,6 +329,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendJoin()
|
||||
|
||||
Packet *p = new Packet(PACKET_CLIENT_JOIN);
|
||||
p->Send_string(_openttd_revision);
|
||||
p->Send_uint32(_openttd_newgrf_version);
|
||||
p->Send_string(_settings_client.network.client_name); // Client name
|
||||
p->Send_uint8 (_network_join_as); // PlayAs
|
||||
p->Send_uint8 (NETLANG_ANY); // Language
|
||||
@ -374,13 +375,6 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendGetMap()
|
||||
my_client->status = STATUS_MAP_WAIT;
|
||||
|
||||
Packet *p = new Packet(PACKET_CLIENT_GETMAP);
|
||||
/* Send the OpenTTD version to the server, let it validate it too.
|
||||
* But only do it for stable releases because of those we are sure
|
||||
* that everybody has the same NewGRF version. For trunk and the
|
||||
* 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 (IsReleasedVersion()) p->Send_uint32(_openttd_newgrf_version);
|
||||
my_client->SendPacket(p);
|
||||
return NETWORK_RECV_STATUS_OKAY;
|
||||
}
|
||||
|
@ -856,9 +856,10 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_JOIN(Packet *p)
|
||||
char client_revision[NETWORK_REVISION_LENGTH];
|
||||
|
||||
p->Recv_string(client_revision, sizeof(client_revision));
|
||||
uint32 newgrf_version = p->Recv_uint32();
|
||||
|
||||
/* Check if the client has revision control enabled */
|
||||
if (!IsNetworkCompatibleVersion(client_revision)) {
|
||||
if (!IsNetworkCompatibleVersion(client_revision) || _openttd_newgrf_version != newgrf_version) {
|
||||
/* Different revisions!! */
|
||||
return this->SendError(NETWORK_ERROR_WRONG_REVISION);
|
||||
}
|
||||
@ -968,26 +969,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_COMPANY_PASSWOR
|
||||
NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_GETMAP(Packet *p)
|
||||
{
|
||||
NetworkClientSocket *new_cs;
|
||||
|
||||
/* Do an extra version match. We told the client our version already,
|
||||
* lets confirm that the client isn't lieing to us.
|
||||
* But only do it for stable releases because of those we are sure
|
||||
* that everybody has the same NewGRF version. For trunk and the
|
||||
* 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 (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. */
|
||||
return this->SendError(NETWORK_ERROR_NOT_EXPECTED);
|
||||
}
|
||||
} else if (p->size != 3) {
|
||||
/* We received a packet from a version that claims to be stable.
|
||||
* That shouldn't happen. The client must be wrong. */
|
||||
return this->SendError(NETWORK_ERROR_NOT_EXPECTED);
|
||||
}
|
||||
|
||||
/* The client was never joined.. so this is impossible, right?
|
||||
* Ignore the packet, give the client a warning, and close his connection */
|
||||
if (this->status < STATUS_AUTHORIZED || this->HasClientQuit()) {
|
||||
|
Loading…
Reference in New Issue
Block a user