* Make our lobby protocol code endian safe (response of a "list" command now always is preceded by a 32bit long, unsigned, little endian integer)

* Remove parameter `BOOL async` of NETfindGame since it wasn't used

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1628 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2007-05-13 17:31:12 +00:00
parent 1697d6a9e8
commit 7b025ea3e1
4 changed files with 10 additions and 9 deletions

View File

@ -1158,7 +1158,8 @@ void NETregisterServer(int state) {
static void NETallowJoining(void) {
unsigned int i;
UDWORD numgames=1; // always 1 on normal server
UDWORD numgames = 1; // always 1 on normal server
endian_udword(&numgames); // Make sure it is little endian, conforming with our protocol
char buffer[5];
if (allow_joining == FALSE) return;
@ -1336,9 +1337,8 @@ BOOL NEThaltJoining(void)
}
// ////////////////////////////////////////////////////////////////////////
// find games on open connection, option to do this asynchronously
// since it can sometimes take a while.
BOOL NETfindGame(BOOL async) // may (not) want to use async here...
// find games on open connection
BOOL NETfindGame()
{
static UDWORD gamecount = 0, gamesavailable;
IPaddress ip;
@ -1388,6 +1388,7 @@ BOOL NETfindGame(BOOL async) // may (not) want to use async here...
&& SDLNet_SocketReady(tcp_socket)
&& SDLNet_TCP_Recv(tcp_socket, buffer, sizeof(int))) {
gamesavailable=(UDWORD)buffer[0];
endian_udword(gamesavailable);
}
debug( LOG_NET, "receiving info of %d game(s)\n", gamesavailable );

View File

@ -141,7 +141,7 @@ extern SDWORD NETgetGameFlags(UDWORD flag); // return one of the four flags(dw
extern SDWORD NETgetGameFlagsUnjoined(UDWORD gameid, UDWORD flag); // return one of the four flags(dword) about the game.
extern BOOL NETsetGameFlags(UDWORD flag, SDWORD value); // set game flag(1-4) to value.
extern BOOL NEThaltJoining(void); // stop new players joining this game
extern BOOL NETfindGame(BOOL asynchronously); // find games being played(uses GAME_GUID);
extern BOOL NETfindGame(void); // find games being played(uses GAME_GUID);
extern BOOL NETjoinGame(UDWORD gameNumber, const char* playername); // join game given with playername
extern BOOL NEThostGame(const char* SessionName, const char* PlayerName,// host a game
SDWORD one, SDWORD two, SDWORD three, SDWORD four, UDWORD plyrs);

View File

@ -600,7 +600,7 @@ void runGameFind(void )
lastupdate = gameTime;
if(safeSearch)
{
NETfindGame(TRUE); // find games asynchronously
NETfindGame(); // find games synchronously
}
addGames(); //redraw list
}
@ -616,7 +616,7 @@ void runGameFind(void )
if(id == MULTIOP_REFRESH)
{
NETfindGame(TRUE); // find games asynchronously
NETfindGame(); // find games synchronously
addGames(); //redraw list.
}
@ -689,7 +689,7 @@ void startGameFind(void)
_("Refresh Games List"),IMAGE_REFRESH,IMAGE_REFRESH,FALSE); // Find Games button
}
NETfindGame(TRUE);
NETfindGame();
addGames(); // now add games.
}

View File

@ -476,7 +476,7 @@ BOOL LobbyLaunched(void)
// set the player info as soon as possible to avoid screwy scores appearing elsewhere.
NETplayerInfo();
NETfindGame(TRUE);
NETfindGame();
for (i = 0; i < MAX_PLAYERS && NetPlay.players[i].dpid != NetPlay.dpidPlayer; i++);