diff --git a/lib/netplay/netplay.c b/lib/netplay/netplay.c index ae00d68fb..968cbee82 100644 --- a/lib/netplay/netplay.c +++ b/lib/netplay/netplay.c @@ -61,10 +61,7 @@ unsigned int masterserver_port = 0, gameserver_port = 0; #define MSG_PLAYER_LEFT 95 #define MSG_GAME_FLAGS 96 -//#define NET_DEBUG - static BOOL allow_joining = FALSE; - static void NETallowJoining(void); extern BOOL MultiPlayerJoin(UDWORD dpid); /* from src/multijoin.c ! */ extern BOOL MultiPlayerLeave(UDWORD dpid); /* from src/multijoin.c ! */ @@ -77,15 +74,7 @@ static GAMESTRUCT game; static void NETsetMessageSize(NETMSG* pMsg, unsigned int size) { - unsigned int tmp = 8 - (size % 8); - - if (tmp == 8) { - pMsg->size = size; - pMsg->paddedBytes = 0; - } else { - pMsg->size = size + tmp; - pMsg->paddedBytes = tmp; - } + pMsg->size = size; } // *********** Socket with buffer that read NETMSGs ****************** @@ -140,8 +129,6 @@ static BOOL NET_fillBuffer(NETBUFSOCKET* bs, SDLNet_SocketSet socket_set) return FALSE; } - - size = SDLNet_TCP_Recv(bs->socket, bufstart, bufsize); if (size > 0) { @@ -164,7 +151,6 @@ static BOOL NET_recvMessage(NETBUFSOCKET* bs, NETMSG* pMsg) const NETMSG* message = (NETMSG*)(bs->buffer + bs->buffer_start); const unsigned int headersize = sizeof(message->size) + sizeof(message->type) - + sizeof(message->paddedBytes) + sizeof(message->destination); if (headersize > bs->bytes) { @@ -684,7 +670,7 @@ BOOL NETsend(NETMSG *msg, UDWORD player, BOOL guarantee) if (player >= MAX_CONNECTED_PLAYERS) return FALSE; msg->destination = player; - size = msg->size + sizeof(msg->size) + sizeof(msg->type) + sizeof(msg->paddedBytes) + sizeof(msg->destination); + size = msg->size + sizeof(msg->size) + sizeof(msg->type) + sizeof(msg->destination); NETlogPacket(msg, FALSE); @@ -723,7 +709,7 @@ BOOL NETbcast(NETMSG *msg, BOOL guarantee) msg->destination = NET_ALL_PLAYERS; - size = msg->size + sizeof(msg->size) + sizeof(msg->type) + sizeof(msg->paddedBytes) + sizeof(msg->destination); + size = msg->size + sizeof(msg->size) + sizeof(msg->type) + sizeof(msg->destination); NETlogPacket(msg, FALSE); @@ -905,7 +891,7 @@ receive_message: return FALSE; } else { size = pMsg->size + sizeof(pMsg->size) + sizeof(pMsg->type) - + sizeof(pMsg->paddedBytes) + sizeof(pMsg->destination); + + sizeof(pMsg->destination); if (is_server == FALSE) { } else if (pMsg->destination == NET_ALL_PLAYERS) { unsigned int j; @@ -1013,7 +999,6 @@ UBYTE NETsendFile(BOOL newFile, const char *fileName, UDWORD player) memcpy(&(msg.body[msg.size]),&inBuff,bytesRead); msg.size += bytesRead; msg.type = FILEMSG; - msg.paddedBytes = 0; if(player==0) { NETbcast(&msg,TRUE); // send it. @@ -1115,7 +1100,8 @@ void NETregisterServer(int state) { // //////////////////////////////////////////////////////////////////////// // Host a game with a given name and player name. & 4 user game flags -static void NETallowJoining(void) { +static void NETallowJoining(void) +{ unsigned int i; UDWORD numgames = SDL_SwapBE32(1); // always 1 on normal server char buffer[5]; @@ -1444,7 +1430,6 @@ BOOL NETjoinGame(UDWORD gameNumber, const char* playername) } else { strcpy(NetPlay.games[gameNumber].desc.host, tmpgame->desc.host); } -//printf("JoinGame: Received info for host %s\n", NetPlay.games[gameNumber].desc.host); } bsocket = NET_createBufferedSocket(); diff --git a/lib/netplay/netplay.h b/lib/netplay/netplay.h index 28124362a..318a695a5 100644 --- a/lib/netplay/netplay.h +++ b/lib/netplay/netplay.h @@ -64,7 +64,6 @@ typedef struct { typedef struct { uint16_t size; // used size of body - uint8_t paddedBytes; // numberofbytes appended for encryption uint8_t type; // type of packet uint8_t destination; // player to send to, or NET_ALL_PLAYERS char body[MaxMsgSize]; @@ -101,11 +100,6 @@ typedef struct { uint32_t bLobbyLaunched; // true if app launched by a lobby uint32_t bSpectator; // true if just spectating - uint32_t bEncryptAllPackets; // set to true to encrypt all communications. - - // Legitimate uint32_t (i.e. a non-bool) - uint32_t cryptKey[4]; // 4*32 bit encryption key - // booleans uint32_t bCaptureInUse; // true if someone is speaking. uint32_t bAllowCaptureRecord; // true if speech can be recorded. diff --git a/src/game.c b/src/game.c index cc43d0120..72d786d18 100644 --- a/src/game.c +++ b/src/game.c @@ -3258,7 +3258,8 @@ static void endian_SaveGameV(SAVE_GAME* psSaveGame, UDWORD version) { UDWORD i,j; /* SAVE_GAME is GAME_SAVE_V33 */ /* GAME_SAVE_V33 includes GAME_SAVE_V31 */ - if(version >= VERSION_33) { + if(version >= VERSION_33) + { endian_udword(&psSaveGame->sGame.power); endian_uword(&psSaveGame->sGame.bytesPerSec); for(i = 0; i < MaxGames; i++) { @@ -3275,8 +3276,6 @@ static void endian_SaveGameV(SAVE_GAME* psSaveGame, UDWORD version) { endian_udword(&psSaveGame->sNetPlay.players[i].dpid); endian_udword(&psSaveGame->sNetPlay.playercount); endian_udword(&psSaveGame->sNetPlay.dpidPlayer); - for(i = 0; i < 4; i++) - endian_udword(&psSaveGame->sNetPlay.cryptKey[i]); endian_udword(&psSaveGame->savePlayer); for(i = 0; i < MAX_PLAYERS; i++) endian_udword(&psSaveGame->sPlayer2dpid[i]); @@ -4277,8 +4276,6 @@ BOOL writeGameFile(char *pFileName, SDWORD saveType) endian_udword(&psSaveGame->sNetPlay.players[i].dpid); endian_udword(&psSaveGame->sNetPlay.playercount); endian_udword(&psSaveGame->sNetPlay.dpidPlayer); - for(i = 0; i < 4; i++) - endian_udword(&psSaveGame->sNetPlay.cryptKey[i]); endian_udword(&psSaveGame->savePlayer); for(i = 0; i < MAX_PLAYERS; i++) endian_udword(&psSaveGame->sPlayer2dpid[i]); diff --git a/src/multiint.c b/src/multiint.c index c60e5c938..3aa703c80 100644 --- a/src/multiint.c +++ b/src/multiint.c @@ -2415,12 +2415,6 @@ BOOL startMultiOptions(BOOL bReenter) game.skDiff[i] = (DIFF_SLIDER_STOPS / 2); } - // set the encrypt key. - if(NetPlay.bHost) - { - game.encryptKey = 0; - } - if(!NetPlay.bComms) // firce skirmish if no comms. { game.type = SKIRMISH;