Removes GAMESTRUCT and SESSIONDESC, brakes savegames!

master
Rene Jochum 2011-04-25 21:11:28 +02:00
parent 754e6c15c7
commit 062b864cb8
2 changed files with 0 additions and 106 deletions

View File

@ -134,54 +134,9 @@ enum MESSAGE_TYPES
#define modlist_string_size 255 // For a concatenated list of mods
#define password_string_size 64 // longer passwords slow down the join code
#define SESSION_JOINDISABLED 1
#define MAX_CONNECTED_PLAYERS MAX_PLAYERS
#define MAX_TMP_SOCKETS 16
struct SESSIONDESC //Available game storage... JUST FOR REFERENCE!
{
int32_t dwSize;
int32_t dwFlags;
char host[40]; // host's ip address (can fit a full IPv4 and IPv6 address + terminating NUL)
int32_t dwMaxPlayers;
int32_t dwCurrentPlayers;
int32_t dwUserFlags[4];
};
/**
* @note when changing this structure, NETsendGAMESTRUCT, NETrecvGAMESTRUCT and
* the lobby server should be changed accordingly.
*/
struct GAMESTRUCT
{
/* Version of this structure and thus the binary lobby protocol.
* @NOTE: <em>MUST</em> be the first item of this struct.
*/
uint32_t GAMESTRUCT_VERSION;
char name[StringSize];
SESSIONDESC desc;
// END of old GAMESTRUCT format
// NOTE: do NOT save the following items in game.c--it will break savegames.
char secondaryHosts[2][40];
char extra[extra_string_size]; // extra string (future use)
char mapname[map_string_size]; // map server is hosting
char hostname[hostname_string_size]; // ...
char versionstring[StringSize]; //
char modlist[modlist_string_size]; // ???
uint32_t game_version_major; //
uint32_t game_version_minor; //
uint32_t privateGame; // if true, it is a private game
uint32_t pureGame; // NO mods allowed if true
uint32_t Mods; // number of concatenated mods?
// Game ID, used on the lobby server to link games with multiple address families to eachother
uint32_t gameId;
uint32_t future2; // for future use
uint32_t future3; // for future use
uint32_t future4; // for future use
};
// ////////////////////////////////////////////////////////////////////////
// Message information. ie. the packets sent between machines.
@ -264,7 +219,6 @@ struct PLAYER
// all the luvly Netplay info....
struct NETPLAY
{
GAMESTRUCT games[MaxGames]; ///< The collection of games
PLAYER players[MAX_PLAYERS]; ///< The array of players.
uint32_t maxPlayers; ///< Maximum number of players.
uint32_t playercount; ///< Number of players in game.

View File

@ -392,44 +392,6 @@ static bool deserializeMultiplayerGame(PHYSFS_file* fileHandle, MULTIPLAYERGAME*
return true;
}
static bool serializeSessionDesc(PHYSFS_file* fileHandle, const SESSIONDESC* serializeDesc)
{
return (PHYSFS_writeSBE32(fileHandle, serializeDesc->dwSize)
&& PHYSFS_writeSBE32(fileHandle, serializeDesc->dwFlags)
&& PHYSFS_write(fileHandle, serializeDesc->host, 1, 16) == 16
&& PHYSFS_writeSBE32(fileHandle, serializeDesc->dwMaxPlayers)
&& PHYSFS_writeSBE32(fileHandle, serializeDesc->dwCurrentPlayers)
&& PHYSFS_writeSBE32(fileHandle, serializeDesc->dwUserFlags[0])
&& PHYSFS_writeSBE32(fileHandle, serializeDesc->dwUserFlags[1])
&& PHYSFS_writeSBE32(fileHandle, serializeDesc->dwUserFlags[2])
&& PHYSFS_writeSBE32(fileHandle, serializeDesc->dwUserFlags[3]));
}
static bool deserializeSessionDesc(PHYSFS_file* fileHandle, SESSIONDESC* serializeDesc)
{
return (PHYSFS_readSBE32(fileHandle, &serializeDesc->dwSize)
&& PHYSFS_readSBE32(fileHandle, &serializeDesc->dwFlags)
&& PHYSFS_read(fileHandle, serializeDesc->host, 1, 16) == 16
&& PHYSFS_readSBE32(fileHandle, &serializeDesc->dwMaxPlayers)
&& PHYSFS_readSBE32(fileHandle, &serializeDesc->dwCurrentPlayers)
&& PHYSFS_readSBE32(fileHandle, &serializeDesc->dwUserFlags[0])
&& PHYSFS_readSBE32(fileHandle, &serializeDesc->dwUserFlags[1])
&& PHYSFS_readSBE32(fileHandle, &serializeDesc->dwUserFlags[2])
&& PHYSFS_readSBE32(fileHandle, &serializeDesc->dwUserFlags[3]));
}
static bool serializeGameStruct(PHYSFS_file* fileHandle, const GAMESTRUCT* serializeGame)
{
return (PHYSFS_write(fileHandle, serializeGame->name, StringSize, 1) == 1
&& serializeSessionDesc(fileHandle, &serializeGame->desc));
}
static bool deserializeGameStruct(PHYSFS_file* fileHandle, GAMESTRUCT* serializeGame)
{
return (PHYSFS_read(fileHandle, serializeGame->name, StringSize, 1) == 1
&& deserializeSessionDesc(fileHandle, &serializeGame->desc));
}
static bool serializePlayer(PHYSFS_file* fileHandle, const PLAYER* serializePlayer, int player)
{
return (PHYSFS_writeUBE32(fileHandle, serializePlayer->position)
@ -475,12 +437,6 @@ static bool serializeNetPlay(PHYSFS_file* fileHandle, const NETPLAY* serializeNe
{
unsigned int i;
for (i = 0; i < MaxGames; ++i)
{
if (!serializeGameStruct(fileHandle, &serializeNetPlay->games[i]))
return false;
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
if (!serializePlayer(fileHandle, &serializeNetPlay->players[i], i))
@ -502,12 +458,6 @@ static bool deserializeNetPlay(PHYSFS_file* fileHandle, NETPLAY* serializeNetPla
uint32_t dummy, scavs = game.scavengers;
bool retv;
for (i = 0; i < MaxGames; ++i)
{
if (!deserializeGameStruct(fileHandle, &serializeNetPlay->games[i]))
return false;
}
for (i = 0; i < MAX_PLAYERS; ++i)
{
if (!deserializePlayer(fileHandle, &serializeNetPlay->players[i], i))
@ -3129,16 +3079,6 @@ static void endian_SaveGameV(SAVE_GAME* psSaveGame, UDWORD version)
if(version >= VERSION_33)
{
endian_udword(&psSaveGame->sGame.power);
for(i = 0; i < MaxGames; i++) {
endian_sdword(&psSaveGame->sNetPlay.games[i].desc.dwSize);
endian_sdword(&psSaveGame->sNetPlay.games[i].desc.dwFlags);
endian_sdword(&psSaveGame->sNetPlay.games[i].desc.dwMaxPlayers);
endian_sdword(&psSaveGame->sNetPlay.games[i].desc.dwCurrentPlayers);
endian_sdword(&psSaveGame->sNetPlay.games[i].desc.dwUserFlags[0]);
endian_sdword(&psSaveGame->sNetPlay.games[i].desc.dwUserFlags[1]);
endian_sdword(&psSaveGame->sNetPlay.games[i].desc.dwUserFlags[2]);
endian_sdword(&psSaveGame->sNetPlay.games[i].desc.dwUserFlags[3]);
}
endian_udword(&psSaveGame->sNetPlay.playercount);
endian_udword(&psSaveGame->savePlayer);
for(i = 0; i < MAX_PLAYERS; i++)