Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

This reverts commit 3295727.
  • Loading branch information...
commit c9fa97ca809c43b4a411ea41b9e1ea2bba114c7c 1 parent e90f776
vexed authored July 16, 2012
67  lib/netplay/netplay.cpp
@@ -151,7 +151,6 @@ static struct IGDdatas data;
151 151
 
152 152
 // local ip address
153 153
 static char lanaddr[16];
154  
-
155 154
 /**
156 155
  * Used for connections with clients.
157 156
  */
@@ -176,8 +175,8 @@ unsigned NET_PlayerConnectionStatus[CONNECTIONSTATUS_NORMAL][MAX_PLAYERS];
176 175
  ************************************************************************************
177 176
 **/
178 177
 static char const *versionString = version_getVersionString();
179  
-static int NETCODE_VERSION_MAJOR = 100;
180  
-static int NETCODE_VERSION_MINOR = 1;
  178
+static int NETCODE_VERSION_MAJOR = 6;
  179
+static int NETCODE_VERSION_MINOR = 5;
181 180
 
182 181
 bool NETisCorrectVersion(uint32_t game_version_major, uint32_t game_version_minor)
183 182
 {
@@ -675,7 +674,7 @@ static bool NETsendGAMESTRUCT(Socket* sock, const GAMESTRUCT* ourgamestruct)
675 674
 	// memory content across the network.
676 675
 	char buf[sizeof(ourgamestruct->GAMESTRUCT_VERSION) + sizeof(ourgamestruct->name) + sizeof(ourgamestruct->desc.host) + (sizeof(int32_t) * 8) +
677 676
 		sizeof(ourgamestruct->secondaryHosts) + sizeof(ourgamestruct->extra) + sizeof(ourgamestruct->mapname) + sizeof(ourgamestruct->hostname) + sizeof(ourgamestruct->versionstring) +
678  
-		sizeof(ourgamestruct->modlist) + (sizeof(uint32_t) * 9) + sizeof(ourgamestruct->Clientnames) + sizeof(ourgamestruct->ClientIPs) ] = { 0 };
  677
+		sizeof(ourgamestruct->modlist) + (sizeof(uint32_t) * 9) ] = { 0 };
679 678
 	char *buffer = buf;
680 679
 	unsigned int i;
681 680
 	ssize_t result;
@@ -766,19 +765,13 @@ static bool NETsendGAMESTRUCT(Socket* sock, const GAMESTRUCT* ourgamestruct)
766 765
 	buffer += sizeof(uint32_t);
767 766
 
768 767
 	// Copy 32bit large big endian numbers
769  
-	*(uint32_t*)buffer = htonl(ourgamestruct->os);
  768
+	*(uint32_t*)buffer = htonl(ourgamestruct->future3);
770 769
 	buffer += sizeof(uint32_t);
771 770
 
772 771
 	// Copy 32bit large big endian numbers
773 772
 	*(uint32_t*)buffer = htonl(ourgamestruct->future4);
774 773
 	buffer += sizeof(uint32_t);
775 774
 
776  
-	// block copy strings
777  
-	strlcpy(buffer, gamestruct.Clientnames, sizeof(ourgamestruct->Clientnames));
778  
-	buffer += sizeof(ourgamestruct->Clientnames);
779  
-	strlcpy(buffer, gamestruct.ClientIPs, sizeof(ourgamestruct->ClientIPs));
780  
-	buffer += sizeof(ourgamestruct->ClientIPs);
781  
-
782 775
 	debug(LOG_NET, "sending GAMESTRUCT, size: %u", (unsigned int)sizeof(buf));
783 776
 
784 777
 	// Send over the GAMESTRUCT
@@ -795,8 +788,6 @@ static bool NETsendGAMESTRUCT(Socket* sock, const GAMESTRUCT* ourgamestruct)
795 788
 		return false;
796 789
 	}
797 790
 
798  
-	debug(LOG_NET, "sent GAMESTRUCT size=%ld game is=%ld", sizeof(buf), sizeof(GAMESTRUCT));
799  
-
800 791
 	return true;
801 792
 }
802 793
 
@@ -813,7 +804,7 @@ static bool NETrecvGAMESTRUCT(GAMESTRUCT* ourgamestruct)
813 804
 	// circumvents struct padding, which could pose a problem).
814 805
 	char buf[sizeof(ourgamestruct->GAMESTRUCT_VERSION) + sizeof(ourgamestruct->name) + sizeof(ourgamestruct->desc.host) + (sizeof(int32_t) * 8) +
815 806
 		sizeof(ourgamestruct->secondaryHosts) + sizeof(ourgamestruct->extra) + sizeof(ourgamestruct->mapname) + sizeof(ourgamestruct->hostname) + sizeof(ourgamestruct->versionstring) +
816  
-		sizeof(ourgamestruct->modlist) + (sizeof(uint32_t) * 9) + sizeof(ourgamestruct->Clientnames) + sizeof(ourgamestruct->ClientIPs) ] = { 0 };
  807
+		sizeof(ourgamestruct->modlist) + (sizeof(uint32_t) * 9) ] = { 0 };
817 808
 	char* buffer = buf;
818 809
 	unsigned int i;
819 810
 	ssize_t result = 0;
@@ -909,7 +900,7 @@ static bool NETrecvGAMESTRUCT(GAMESTRUCT* ourgamestruct)
909 900
 	buffer += sizeof(uint32_t);
910 901
 	ourgamestruct->limits = ntohl(*(uint32_t*)buffer);
911 902
 	buffer += sizeof(uint32_t);
912  
-	ourgamestruct->os = ntohl(*(uint32_t*)buffer);
  903
+	ourgamestruct->future3 = ntohl(*(uint32_t*)buffer);
913 904
 	buffer += sizeof(uint32_t);
914 905
 	ourgamestruct->future4 = ntohl(*(uint32_t*)buffer);
915 906
 	buffer += sizeof(uint32_t);
@@ -2151,7 +2142,7 @@ static void NETregisterServer(int state)
2151 2142
 				}
2152 2143
 
2153 2144
 				// Get a game ID
2154  
-				if (writeAll(rs_socket, "hellowz", sizeof("hellowz")) == SOCKET_ERROR
  2145
+				if (writeAll(rs_socket, "gaId", sizeof("gaId")) == SOCKET_ERROR
2155 2146
 				 || readAll(rs_socket, &gameId, sizeof(gameId), 10000) != sizeof(gameId))
2156 2147
 				{
2157 2148
 					free(NetPlay.MOTD);
@@ -2170,7 +2161,7 @@ static void NETregisterServer(int state)
2170 2161
 				debug(LOG_NET, "Using game ID: %u", (unsigned int)gamestruct.gameId);
2171 2162
 
2172 2163
 				// Register our game with the server
2173  
-				if (writeAll(rs_socket, "addgame", sizeof("addgame")) == SOCKET_ERROR
  2164
+				if (writeAll(rs_socket, "addg", sizeof("addg")) == SOCKET_ERROR
2174 2165
 				 // and now send what the server wants
2175 2166
 				 || !NETsendGAMESTRUCT(rs_socket, &gamestruct))
2176 2167
 				{
@@ -2190,29 +2181,7 @@ static void NETregisterServer(int state)
2190 2181
 				registered = state;
2191 2182
 			}
2192 2183
 			break;
2193  
-			case WZ_SERVER_LAUNCH:
2194  
-			{
2195  
-					// Copy strings to struct and send them to server
2196  
-					for (int i = 0; i < MAX_PLAYERS; ++i)
2197  
-					{
2198  
-						strlcpy(gamestruct.Clientnames +  (i * StringSize), NetPlay.players[i].name, StringSize);
2199  
-						strlcpy(gamestruct.ClientIPs + (i * IPSize), NetPlay.players[i].IPtextAddress, IPSize);
2200  
-					}
2201 2184
 
2202  
-					if (writeAll(rs_socket, "launch_", sizeof("launch_")) == SOCKET_ERROR
2203  
-						// and now send what the server wants
2204  
-						|| !NETsendGAMESTRUCT(rs_socket, &gamestruct) )
2205  
-					{
2206  
-						debug(LOG_ERROR, "Failed to upload (final) gamestruct to server: %s", strSockError(getSockErr()));
2207  
-						socketClose(rs_socket);
2208  
-						rs_socket = NULL;
2209  
-						return;
2210  
-					}
2211  
-					socketClose(rs_socket);	//clean up, we are done talking to server
2212  
-					rs_socket = NULL;
2213  
-					debug(LOG_NET, "==> All data was sent to server");
2214  
-			}
2215  
-			break;
2216 2185
 			// Unregister the game (close the socket)
2217 2186
 			case WZ_SERVER_DISCONNECT:
2218 2187
 			{
@@ -2233,16 +2202,6 @@ static void NETregisterServer(int state)
2233 2202
 }
2234 2203
 
2235 2204
 // ////////////////////////////////////////////////////////////////////////
2236  
-// Final communications with the server. We are launching the game now
2237  
-void NETlaunched(void)
2238  
-{
2239  
-	if (NetPlay.bComms)
2240  
-	{
2241  
-		NETregisterServer(WZ_SERVER_LAUNCH);
2242  
-	}
2243  
-}
2244  
-
2245  
-// ////////////////////////////////////////////////////////////////////////
2246 2205
 //  Check player "slots" & update player count if needed.
2247 2206
 void NETfixPlayerCount(void)
2248 2207
 {
@@ -2676,7 +2635,7 @@ bool NEThostGame(const char* SessionName, const char* PlayerName,
2676 2635
 	sstrcpy(gamestruct.hostname, PlayerName);
2677 2636
 	sstrcpy(gamestruct.versionstring, versionString);		// version (string)
2678 2637
 	sstrcpy(gamestruct.modlist, getModList());				// List of mods
2679  
-	gamestruct.GAMESTRUCT_VERSION = 10;						// version of this structure
  2638
+	gamestruct.GAMESTRUCT_VERSION = 3;						// version of this structure
2680 2639
 	gamestruct.game_version_major = NETCODE_VERSION_MAJOR;	// Netcode Major version
2681 2640
 	gamestruct.game_version_minor = NETCODE_VERSION_MINOR;	// NetCode Minor version
2682 2641
 //	gamestruct.privateGame = 0;								// if true, it is a private game
@@ -2684,10 +2643,8 @@ bool NEThostGame(const char* SessionName, const char* PlayerName,
2684 2643
 	gamestruct.Mods = 0;										// number of concatenated mods?
2685 2644
 	gamestruct.gameId  = 0;
2686 2645
 	gamestruct.limits = 0x0;									// used for limits
2687  
-	gamestruct.os = HOST_PLATFORM;								// what OS we are on
  2646
+	gamestruct.future3 = 0xBAD03;								// for future use
2688 2647
 	gamestruct.future4 = 0xBAD04;								// for future use
2689  
-	memset(&gamestruct.Clientnames, 0, sizeof(gamestruct.Clientnames));	// for server use
2690  
-	memset(&gamestruct.ClientIPs, 0, sizeof(gamestruct.ClientIPs));		// for server use
2691 2648
 
2692 2649
 	selectedPlayer= NET_CreatePlayer(PlayerName);
2693 2650
 	realSelectedPlayer = selectedPlayer;
@@ -2794,9 +2751,9 @@ bool NETfindGame(void)
2794 2751
 
2795 2752
 	SocketSet_AddSocket(socket_set, tcp_socket);
2796 2753
 
2797  
-	debug(LOG_NET, "Sending listing cmd");
  2754
+	debug(LOG_NET, "Sending list cmd");
2798 2755
 
2799  
-	if (writeAll(tcp_socket, "listing", sizeof("listing")) != SOCKET_ERROR
  2756
+	if (writeAll(tcp_socket, "list", sizeof("list")) != SOCKET_ERROR
2800 2757
 	 && (result = readAll(tcp_socket, &gamesavailable, sizeof(gamesavailable), NET_TIMEOUT_DELAY)) == sizeof(gamesavailable))
2801 2758
 	{
2802 2759
 		gamesavailable = MIN(ntohl(gamesavailable), ARRAY_SIZE(NetPlay.games));
16  lib/netplay/netplay.h
@@ -30,16 +30,6 @@
30 30
 #include "nettypes.h"
31 31
 #include <physfs.h>
32 32
 
33  
-// platform host is
34  
-#if defined WZ_OS_WIN
35  
-#define HOST_PLATFORM 1
36  
-#elif defined WZ_OS_UNIX
37  
-#define HOST_PLATFORM 2
38  
-#elif defined WZ_OS_MAC
39  
-#define HOST_PLATFORM 4
40  
-#else
41  
-#define HOST_PLATFORM 6
42  
-#endif
43 33
 // Lobby Connection errors
44 34
 
45 35
 enum LOBBY_ERROR_TYPES
@@ -134,7 +124,6 @@ enum MESSAGE_TYPES
134 124
 #define MaxMsgSize		16384		// max size of a message in bytes.
135 125
 #define	StringSize		64			// size of strings used.
136 126
 #define MaxGames		11			// max number of concurrently playable games to allow.
137  
-#define IPSize			40			// size of IPv6/IPv4
138 127
 #define extra_string_size	159		// extra 199 char for future use
139 128
 #define map_string_size		40
140 129
 #define	hostname_string_size	40
@@ -185,10 +174,8 @@ struct GAMESTRUCT
185 174
 	// Game ID, used on the lobby server to link games with multiple address families to eachother
186 175
 	uint32_t	gameId;
187 176
 	uint32_t	limits;							// holds limits bitmask (NO_VTOL|NO_TANKS|NO_BORGS)
188  
-	uint32_t	os;								// OS platform
  177
+	uint32_t	future3;						// for future use
189 178
 	uint32_t	future4;						// for future use
190  
-	char		Clientnames[StringSize * MAX_PLAYERS];	// server only use, not used for clients at this time
191  
-	char		ClientIPs[IPSize * MAX_PLAYERS];		// server only use, not used for clients at this time
192 179
 };
193 180
 
194 181
 // ////////////////////////////////////////////////////////////////////////
@@ -332,7 +319,6 @@ extern bool	NEThostGame(const char* SessionName, const char* PlayerName,// host
332 319
 			    SDWORD one, SDWORD two, SDWORD three, SDWORD four, UDWORD plyrs);
333 320
 extern bool	NETchangePlayerName(UDWORD player, char *newName);// change a players name.
334 321
 void            NETfixDuplicatePlayerNames(void);  // Change a player's name automatically, if there are duplicates.
335  
-extern void NETlaunched(void);	// host started a game, and we are telling the lobby server.
336 322
 
337 323
 #include "netlog.h"
338 324
 
1  src/multiint.cpp
@@ -3264,7 +3264,6 @@ void startMultiplayerGame(void)
3264 3264
 		createLimitSet();
3265 3265
 		debug(LOG_NET,"sending our options to all clients");
3266 3266
 		sendOptions();
3267  
-		NETlaunched();								// tell server we are launching the game
3268 3267
 		NEThaltJoining();							// stop new players entering.
3269 3268
 		ingame.TimeEveryoneIsInGame = 0;
3270 3269
 		ingame.isAllPlayersDataOK = false;

0 notes on commit c9fa97c

Please sign in to comment.
Something went wrong with that request. Please try again.