Use version_getVersionString() for net version.

Since any change that affects game state breaks synchronisation,  and most changes
break  synch,  and it's not  convenient for  most commits  to bump  the version in
netplay.cpp, it's probably a good idea to announce the exact version when hosting.
master
Cyp 2011-12-08 12:36:24 +01:00
parent 5461ef45bd
commit 0aeda2baa2
3 changed files with 12 additions and 7 deletions

View File

@ -50,6 +50,7 @@
#include "src/multiint.h"
#include "src/multiplay.h"
#include "src/warzoneconfig.h"
#include "src/version.h"
#ifdef WZ_OS_LINUX
#include <execinfo.h> // Nonfatal runtime backtraces.
@ -146,15 +147,14 @@ char iptoconnect[PATH_MAX] = "\0"; // holds IP/hostname from command line
unsigned NET_PlayerConnectionStatus[CONNECTIONSTATUS_NORMAL][MAX_PLAYERS];
// ////////////////////////////////////////////////////////////////////////////
#define VersionStringSize 80
/************************************************************************************
** NOTE (!) Change the VersionString when net code changes!!
** NOTE (!) Change the versionString when net code changes!!
** ie ("trunk", "2.1.3", "3.0", ...)
************************************************************************************
**/
char VersionString[VersionStringSize] = "master, netcode 5.0";
static char const *versionString = "version_getVersionString()";
static int NETCODE_VERSION_MAJOR = 5;
static int NETCODE_VERSION_MINOR = 0;
static int NETCODE_VERSION_MINOR = 1;
// The Lobby Client - declared external in netplay.h
Lobby::Client lobbyclient;
@ -2050,9 +2050,15 @@ bool NEThostGame(const char* SessionName, const char* PlayerName,
modlist = getModList();
std::string fullVersionString = versionString;
if (fullVersionString == "version_getVersionString()")
{
fullVersionString = version_getVersionString();
}
// Register the game on the masterserver
if (lobbyclient.addGame(&motd, (uint32_t)gameserver_port, (uint32_t)NetPlay.maxPlayers,
SessionName, VersionString, NETCODE_VERSION_MAJOR, NETCODE_VERSION_MINOR,
SessionName, fullVersionString.c_str(), NETCODE_VERSION_MAJOR, NETCODE_VERSION_MINOR,
NetPlay.GamePassworded, modlist, game.map, PlayerName) != Lobby::LOBBY_NO_ERROR)
{
Lobby::LOBBY_ERROR* error = lobbyclient.getError();

View File

@ -75,7 +75,7 @@ echo "${A}Bumping version strings to ${FULLVERSTR} and netcode version to ${DATE
sed -i 's/\(AC_INIT(\[Warzone 2100\],\[\)'"${BASE}"'\(\],\[http:\/\/wz2100.net\/\],\[warzone2100\])\)/\1'"${FULLVERSTR}"'\2/;
s/\(\[ enable_debug=${enableval} \], \[ enable_debug=\)yes\( \])\)/\1no\2/
' "${GITROOT}"configure.ac
sed -i 's/\(char VersionString\[VersionStringSize\] = "\).*\(";\)/\1'"${FULLVERSTR}"'\2/;
sed -i 's/\(static char const \*versionString = "\).*\(";\)/\1'"${FULLVERSTR}"'\2/;
s/\(static int NETCODE_VERSION_MINOR = \)[0-9]*\(;\)/\1'"${DATENUM}"'\2/
' "${GITROOT}"lib/netplay/netplay.c*
sed -i 's/\(VALUE "FileVersion", "\)'"${BASE}"'\("\)/\1'"${FULLVERSTR}"'\2/;

View File

@ -132,7 +132,6 @@ static const unsigned gnImage[] = {IMAGE_GN_0, IMAGE_GN_1, IMAGE_GN_2, IMAGE_GN_
// vars
extern char MultiCustomMapsPath[PATH_MAX];
extern char MultiPlayersPath[PATH_MAX];
extern char VersionString[80]; // from netplay.c
extern bool bSendingMap; // used to indicate we are sending a map
bool bHosted = false; //we have set up a game