Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Add last part of net patch (needs updated server code)."

This reverts commit 3295727.
  • Loading branch information...
commit c9fa97ca809c43b4a411ea41b9e1ea2bba114c7c 1 parent e90f776
@vexed vexed authored
Showing with 13 additions and 71 deletions.
  1. +12 −55 lib/netplay/netplay.cpp
  2. +1 −15 lib/netplay/netplay.h
  3. +0 −1  src/multiint.cpp
View
67 lib/netplay/netplay.cpp
@@ -151,7 +151,6 @@ static struct IGDdatas data;
// local ip address
static char lanaddr[16];
-
/**
* Used for connections with clients.
*/
@@ -176,8 +175,8 @@ unsigned NET_PlayerConnectionStatus[CONNECTIONSTATUS_NORMAL][MAX_PLAYERS];
************************************************************************************
**/
static char const *versionString = version_getVersionString();
-static int NETCODE_VERSION_MAJOR = 100;
-static int NETCODE_VERSION_MINOR = 1;
+static int NETCODE_VERSION_MAJOR = 6;
+static int NETCODE_VERSION_MINOR = 5;
bool NETisCorrectVersion(uint32_t game_version_major, uint32_t game_version_minor)
{
@@ -675,7 +674,7 @@ static bool NETsendGAMESTRUCT(Socket* sock, const GAMESTRUCT* ourgamestruct)
// memory content across the network.
char buf[sizeof(ourgamestruct->GAMESTRUCT_VERSION) + sizeof(ourgamestruct->name) + sizeof(ourgamestruct->desc.host) + (sizeof(int32_t) * 8) +
sizeof(ourgamestruct->secondaryHosts) + sizeof(ourgamestruct->extra) + sizeof(ourgamestruct->mapname) + sizeof(ourgamestruct->hostname) + sizeof(ourgamestruct->versionstring) +
- sizeof(ourgamestruct->modlist) + (sizeof(uint32_t) * 9) + sizeof(ourgamestruct->Clientnames) + sizeof(ourgamestruct->ClientIPs) ] = { 0 };
+ sizeof(ourgamestruct->modlist) + (sizeof(uint32_t) * 9) ] = { 0 };
char *buffer = buf;
unsigned int i;
ssize_t result;
@@ -766,19 +765,13 @@ static bool NETsendGAMESTRUCT(Socket* sock, const GAMESTRUCT* ourgamestruct)
buffer += sizeof(uint32_t);
// Copy 32bit large big endian numbers
- *(uint32_t*)buffer = htonl(ourgamestruct->os);
+ *(uint32_t*)buffer = htonl(ourgamestruct->future3);
buffer += sizeof(uint32_t);
// Copy 32bit large big endian numbers
*(uint32_t*)buffer = htonl(ourgamestruct->future4);
buffer += sizeof(uint32_t);
- // block copy strings
- strlcpy(buffer, gamestruct.Clientnames, sizeof(ourgamestruct->Clientnames));
- buffer += sizeof(ourgamestruct->Clientnames);
- strlcpy(buffer, gamestruct.ClientIPs, sizeof(ourgamestruct->ClientIPs));
- buffer += sizeof(ourgamestruct->ClientIPs);
-
debug(LOG_NET, "sending GAMESTRUCT, size: %u", (unsigned int)sizeof(buf));
// Send over the GAMESTRUCT
@@ -795,8 +788,6 @@ static bool NETsendGAMESTRUCT(Socket* sock, const GAMESTRUCT* ourgamestruct)
return false;
}
- debug(LOG_NET, "sent GAMESTRUCT size=%ld game is=%ld", sizeof(buf), sizeof(GAMESTRUCT));
-
return true;
}
@@ -813,7 +804,7 @@ static bool NETrecvGAMESTRUCT(GAMESTRUCT* ourgamestruct)
// circumvents struct padding, which could pose a problem).
char buf[sizeof(ourgamestruct->GAMESTRUCT_VERSION) + sizeof(ourgamestruct->name) + sizeof(ourgamestruct->desc.host) + (sizeof(int32_t) * 8) +
sizeof(ourgamestruct->secondaryHosts) + sizeof(ourgamestruct->extra) + sizeof(ourgamestruct->mapname) + sizeof(ourgamestruct->hostname) + sizeof(ourgamestruct->versionstring) +
- sizeof(ourgamestruct->modlist) + (sizeof(uint32_t) * 9) + sizeof(ourgamestruct->Clientnames) + sizeof(ourgamestruct->ClientIPs) ] = { 0 };
+ sizeof(ourgamestruct->modlist) + (sizeof(uint32_t) * 9) ] = { 0 };
char* buffer = buf;
unsigned int i;
ssize_t result = 0;
@@ -909,7 +900,7 @@ static bool NETrecvGAMESTRUCT(GAMESTRUCT* ourgamestruct)
buffer += sizeof(uint32_t);
ourgamestruct->limits = ntohl(*(uint32_t*)buffer);
buffer += sizeof(uint32_t);
- ourgamestruct->os = ntohl(*(uint32_t*)buffer);
+ ourgamestruct->future3 = ntohl(*(uint32_t*)buffer);
buffer += sizeof(uint32_t);
ourgamestruct->future4 = ntohl(*(uint32_t*)buffer);
buffer += sizeof(uint32_t);
@@ -2151,7 +2142,7 @@ static void NETregisterServer(int state)
}
// Get a game ID
- if (writeAll(rs_socket, "hellowz", sizeof("hellowz")) == SOCKET_ERROR
+ if (writeAll(rs_socket, "gaId", sizeof("gaId")) == SOCKET_ERROR
|| readAll(rs_socket, &gameId, sizeof(gameId), 10000) != sizeof(gameId))
{
free(NetPlay.MOTD);
@@ -2170,7 +2161,7 @@ static void NETregisterServer(int state)
debug(LOG_NET, "Using game ID: %u", (unsigned int)gamestruct.gameId);
// Register our game with the server
- if (writeAll(rs_socket, "addgame", sizeof("addgame")) == SOCKET_ERROR
+ if (writeAll(rs_socket, "addg", sizeof("addg")) == SOCKET_ERROR
// and now send what the server wants
|| !NETsendGAMESTRUCT(rs_socket, &gamestruct))
{
@@ -2190,29 +2181,7 @@ static void NETregisterServer(int state)
registered = state;
}
break;
- case WZ_SERVER_LAUNCH:
- {
- // Copy strings to struct and send them to server
- for (int i = 0; i < MAX_PLAYERS; ++i)
- {
- strlcpy(gamestruct.Clientnames + (i * StringSize), NetPlay.players[i].name, StringSize);
- strlcpy(gamestruct.ClientIPs + (i * IPSize), NetPlay.players[i].IPtextAddress, IPSize);
- }
- if (writeAll(rs_socket, "launch_", sizeof("launch_")) == SOCKET_ERROR
- // and now send what the server wants
- || !NETsendGAMESTRUCT(rs_socket, &gamestruct) )
- {
- debug(LOG_ERROR, "Failed to upload (final) gamestruct to server: %s", strSockError(getSockErr()));
- socketClose(rs_socket);
- rs_socket = NULL;
- return;
- }
- socketClose(rs_socket); //clean up, we are done talking to server
- rs_socket = NULL;
- debug(LOG_NET, "==> All data was sent to server");
- }
- break;
// Unregister the game (close the socket)
case WZ_SERVER_DISCONNECT:
{
@@ -2233,16 +2202,6 @@ static void NETregisterServer(int state)
}
// ////////////////////////////////////////////////////////////////////////
-// Final communications with the server. We are launching the game now
-void NETlaunched(void)
-{
- if (NetPlay.bComms)
- {
- NETregisterServer(WZ_SERVER_LAUNCH);
- }
-}
-
-// ////////////////////////////////////////////////////////////////////////
// Check player "slots" & update player count if needed.
void NETfixPlayerCount(void)
{
@@ -2676,7 +2635,7 @@ bool NEThostGame(const char* SessionName, const char* PlayerName,
sstrcpy(gamestruct.hostname, PlayerName);
sstrcpy(gamestruct.versionstring, versionString); // version (string)
sstrcpy(gamestruct.modlist, getModList()); // List of mods
- gamestruct.GAMESTRUCT_VERSION = 10; // version of this structure
+ gamestruct.GAMESTRUCT_VERSION = 3; // version of this structure
gamestruct.game_version_major = NETCODE_VERSION_MAJOR; // Netcode Major version
gamestruct.game_version_minor = NETCODE_VERSION_MINOR; // NetCode Minor version
// gamestruct.privateGame = 0; // if true, it is a private game
@@ -2684,10 +2643,8 @@ bool NEThostGame(const char* SessionName, const char* PlayerName,
gamestruct.Mods = 0; // number of concatenated mods?
gamestruct.gameId = 0;
gamestruct.limits = 0x0; // used for limits
- gamestruct.os = HOST_PLATFORM; // what OS we are on
+ gamestruct.future3 = 0xBAD03; // for future use
gamestruct.future4 = 0xBAD04; // for future use
- memset(&gamestruct.Clientnames, 0, sizeof(gamestruct.Clientnames)); // for server use
- memset(&gamestruct.ClientIPs, 0, sizeof(gamestruct.ClientIPs)); // for server use
selectedPlayer= NET_CreatePlayer(PlayerName);
realSelectedPlayer = selectedPlayer;
@@ -2794,9 +2751,9 @@ bool NETfindGame(void)
SocketSet_AddSocket(socket_set, tcp_socket);
- debug(LOG_NET, "Sending listing cmd");
+ debug(LOG_NET, "Sending list cmd");
- if (writeAll(tcp_socket, "listing", sizeof("listing")) != SOCKET_ERROR
+ if (writeAll(tcp_socket, "list", sizeof("list")) != SOCKET_ERROR
&& (result = readAll(tcp_socket, &gamesavailable, sizeof(gamesavailable), NET_TIMEOUT_DELAY)) == sizeof(gamesavailable))
{
gamesavailable = MIN(ntohl(gamesavailable), ARRAY_SIZE(NetPlay.games));
View
16 lib/netplay/netplay.h
@@ -30,16 +30,6 @@
#include "nettypes.h"
#include <physfs.h>
-// platform host is
-#if defined WZ_OS_WIN
-#define HOST_PLATFORM 1
-#elif defined WZ_OS_UNIX
-#define HOST_PLATFORM 2
-#elif defined WZ_OS_MAC
-#define HOST_PLATFORM 4
-#else
-#define HOST_PLATFORM 6
-#endif
// Lobby Connection errors
enum LOBBY_ERROR_TYPES
@@ -134,7 +124,6 @@ enum MESSAGE_TYPES
#define MaxMsgSize 16384 // max size of a message in bytes.
#define StringSize 64 // size of strings used.
#define MaxGames 11 // max number of concurrently playable games to allow.
-#define IPSize 40 // size of IPv6/IPv4
#define extra_string_size 159 // extra 199 char for future use
#define map_string_size 40
#define hostname_string_size 40
@@ -185,10 +174,8 @@ struct GAMESTRUCT
// Game ID, used on the lobby server to link games with multiple address families to eachother
uint32_t gameId;
uint32_t limits; // holds limits bitmask (NO_VTOL|NO_TANKS|NO_BORGS)
- uint32_t os; // OS platform
+ uint32_t future3; // for future use
uint32_t future4; // for future use
- char Clientnames[StringSize * MAX_PLAYERS]; // server only use, not used for clients at this time
- char ClientIPs[IPSize * MAX_PLAYERS]; // server only use, not used for clients at this time
};
// ////////////////////////////////////////////////////////////////////////
@@ -332,7 +319,6 @@ extern bool NEThostGame(const char* SessionName, const char* PlayerName,// host
SDWORD one, SDWORD two, SDWORD three, SDWORD four, UDWORD plyrs);
extern bool NETchangePlayerName(UDWORD player, char *newName);// change a players name.
void NETfixDuplicatePlayerNames(void); // Change a player's name automatically, if there are duplicates.
-extern void NETlaunched(void); // host started a game, and we are telling the lobby server.
#include "netlog.h"
View
1  src/multiint.cpp
@@ -3264,7 +3264,6 @@ void startMultiplayerGame(void)
createLimitSet();
debug(LOG_NET,"sending our options to all clients");
sendOptions();
- NETlaunched(); // tell server we are launching the game
NEThaltJoining(); // stop new players entering.
ingame.TimeEveryoneIsInGame = 0;
ingame.isAllPlayersDataOK = false;
Please sign in to comment.
Something went wrong with that request. Please try again.