frontport r8650
"To prevent some confusion rename 'game' structure in netplay.c to gamestruct. 'game' is used as MULTIPLAYERGAME structure everywhere else, and it used GAMESTRUCT in netplay.c" git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8731 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
1a1896e3bc
commit
098a1ea117
|
@ -211,7 +211,7 @@ NETPLAY NetPlay;
|
||||||
|
|
||||||
static BOOL allow_joining = false;
|
static BOOL allow_joining = false;
|
||||||
static bool server_not_there = false;
|
static bool server_not_there = false;
|
||||||
static GAMESTRUCT game;
|
static GAMESTRUCT gamestruct;
|
||||||
|
|
||||||
// update flags
|
// update flags
|
||||||
bool netPlayersUpdated;
|
bool netPlayersUpdated;
|
||||||
|
@ -1205,7 +1205,7 @@ void NETCheckVersion(uint32_t player)
|
||||||
void NETGameLocked( bool flag)
|
void NETGameLocked( bool flag)
|
||||||
{
|
{
|
||||||
NetPlay.GamePassworded = flag;
|
NetPlay.GamePassworded = flag;
|
||||||
game.privateGame = flag;
|
gamestruct.privateGame = flag;
|
||||||
debug(LOG_NET, "Passworded game is %s", NetPlay.GamePassworded ? "TRUE" : "FALSE" );
|
debug(LOG_NET, "Passworded game is %s", NetPlay.GamePassworded ? "TRUE" : "FALSE" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1475,7 +1475,7 @@ static void NET_DestroyPlayer(unsigned int index)
|
||||||
{
|
{
|
||||||
NetPlay.players[index].allocated = false;
|
NetPlay.players[index].allocated = false;
|
||||||
NetPlay.playercount--;
|
NetPlay.playercount--;
|
||||||
game.desc.dwCurrentPlayers = NetPlay.playercount;
|
gamestruct.desc.dwCurrentPlayers = NetPlay.playercount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1596,102 +1596,102 @@ BOOL NETsetGameFlags(UDWORD flag, SDWORD value)
|
||||||
*
|
*
|
||||||
* @see GAMESTRUCT,NETrecvGAMESTRUCT
|
* @see GAMESTRUCT,NETrecvGAMESTRUCT
|
||||||
*/
|
*/
|
||||||
static void NETsendGAMESTRUCT(Socket* sock, const GAMESTRUCT* game)
|
static void NETsendGAMESTRUCT(Socket* sock, const GAMESTRUCT* ourgamestruct)
|
||||||
{
|
{
|
||||||
// A buffer that's guaranteed to have the correct size (i.e. it
|
// A buffer that's guaranteed to have the correct size (i.e. it
|
||||||
// circumvents struct padding, which could pose a problem). Initialise
|
// circumvents struct padding, which could pose a problem). Initialise
|
||||||
// to zero so that we can be sure we're not sending any (undefined)
|
// to zero so that we can be sure we're not sending any (undefined)
|
||||||
// memory content across the network.
|
// memory content across the network.
|
||||||
char buf[sizeof(game->GAMESTRUCT_VERSION) + sizeof(game->name) + sizeof(game->desc.host) + (sizeof(int32_t) * 8) +
|
char buf[sizeof(ourgamestruct->GAMESTRUCT_VERSION) + sizeof(ourgamestruct->name) + sizeof(ourgamestruct->desc.host) + (sizeof(int32_t) * 8) +
|
||||||
sizeof(game->secondaryHosts) + sizeof(game->extra) + sizeof(game->versionstring) +
|
sizeof(ourgamestruct->secondaryHosts) + sizeof(ourgamestruct->extra) + sizeof(ourgamestruct->versionstring) +
|
||||||
sizeof(game->modlist) + (sizeof(uint32_t) * 9) ] = { 0 };
|
sizeof(ourgamestruct->modlist) + (sizeof(uint32_t) * 9) ] = { 0 };
|
||||||
char *buffer = buf;
|
char *buffer = buf;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
// Now dump the data into the buffer
|
// Now dump the data into the buffer
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
*(uint32_t*)buffer = htonl(game->GAMESTRUCT_VERSION);
|
*(uint32_t*)buffer = htonl(ourgamestruct->GAMESTRUCT_VERSION);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
|
|
||||||
// Copy a string
|
// Copy a string
|
||||||
strlcpy(buffer, game->name, sizeof(game->name));
|
strlcpy(buffer, ourgamestruct->name, sizeof(ourgamestruct->name));
|
||||||
buffer += sizeof(game->name);
|
buffer += sizeof(ourgamestruct->name);
|
||||||
|
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
*(int32_t*)buffer = htonl(game->desc.dwSize);
|
*(int32_t*)buffer = htonl(ourgamestruct->desc.dwSize);
|
||||||
buffer += sizeof(int32_t);
|
buffer += sizeof(int32_t);
|
||||||
*(int32_t*)buffer = htonl(game->desc.dwFlags);
|
*(int32_t*)buffer = htonl(ourgamestruct->desc.dwFlags);
|
||||||
buffer += sizeof(int32_t);
|
buffer += sizeof(int32_t);
|
||||||
|
|
||||||
// Copy yet another string
|
// Copy yet another string
|
||||||
strlcpy(buffer, game->desc.host, sizeof(game->desc.host));
|
strlcpy(buffer, ourgamestruct->desc.host, sizeof(ourgamestruct->desc.host));
|
||||||
buffer += sizeof(game->desc.host);
|
buffer += sizeof(ourgamestruct->desc.host);
|
||||||
|
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
*(int32_t*)buffer = htonl(game->desc.dwMaxPlayers);
|
*(int32_t*)buffer = htonl(ourgamestruct->desc.dwMaxPlayers);
|
||||||
buffer += sizeof(int32_t);
|
buffer += sizeof(int32_t);
|
||||||
*(int32_t*)buffer = htonl(game->desc.dwCurrentPlayers);
|
*(int32_t*)buffer = htonl(ourgamestruct->desc.dwCurrentPlayers);
|
||||||
buffer += sizeof(int32_t);
|
buffer += sizeof(int32_t);
|
||||||
for (i = 0; i < ARRAY_SIZE(game->desc.dwUserFlags); ++i)
|
for (i = 0; i < ARRAY_SIZE(ourgamestruct->desc.dwUserFlags); ++i)
|
||||||
{
|
{
|
||||||
*(int32_t*)buffer = htonl(game->desc.dwUserFlags[i]);
|
*(int32_t*)buffer = htonl(ourgamestruct->desc.dwUserFlags[i]);
|
||||||
buffer += sizeof(int32_t);
|
buffer += sizeof(int32_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy a string
|
// Copy a string
|
||||||
for (i = 0; i <ARRAY_SIZE(game->secondaryHosts); ++i)
|
for (i = 0; i <ARRAY_SIZE(ourgamestruct->secondaryHosts); ++i)
|
||||||
{
|
{
|
||||||
strlcpy(buffer, game->secondaryHosts[i], sizeof(game->secondaryHosts[i]));
|
strlcpy(buffer, ourgamestruct->secondaryHosts[i], sizeof(ourgamestruct->secondaryHosts[i]));
|
||||||
buffer += sizeof(game->secondaryHosts[i]);
|
buffer += sizeof(ourgamestruct->secondaryHosts[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy a string
|
// Copy a string
|
||||||
strlcpy(buffer, game->extra, sizeof(game->extra));
|
strlcpy(buffer, ourgamestruct->extra, sizeof(ourgamestruct->extra));
|
||||||
buffer += sizeof(game->extra);
|
buffer += sizeof(ourgamestruct->extra);
|
||||||
|
|
||||||
// Copy a string
|
// Copy a string
|
||||||
strlcpy(buffer, game->versionstring, sizeof(game->versionstring));
|
strlcpy(buffer, ourgamestruct->versionstring, sizeof(ourgamestruct->versionstring));
|
||||||
buffer += sizeof(game->versionstring);
|
buffer += sizeof(ourgamestruct->versionstring);
|
||||||
|
|
||||||
// Copy a string
|
// Copy a string
|
||||||
strlcpy(buffer, game->modlist, sizeof(game->modlist));
|
strlcpy(buffer, ourgamestruct->modlist, sizeof(ourgamestruct->modlist));
|
||||||
buffer += sizeof(game->modlist);
|
buffer += sizeof(ourgamestruct->modlist);
|
||||||
|
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
*(uint32_t*)buffer = htonl(game->game_version_major);
|
*(uint32_t*)buffer = htonl(ourgamestruct->game_version_major);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
|
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
*(uint32_t*)buffer = htonl(game->game_version_minor);
|
*(uint32_t*)buffer = htonl(ourgamestruct->game_version_minor);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
|
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
*(uint32_t*)buffer = htonl(game->privateGame);
|
*(uint32_t*)buffer = htonl(ourgamestruct->privateGame);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
|
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
*(uint32_t*)buffer = htonl(game->pureGame);
|
*(uint32_t*)buffer = htonl(ourgamestruct->pureGame);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
|
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
*(uint32_t*)buffer = htonl(game->Mods);
|
*(uint32_t*)buffer = htonl(ourgamestruct->Mods);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
|
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
*(uint32_t*)buffer = htonl(game->gameId);
|
*(uint32_t*)buffer = htonl(ourgamestruct->gameId);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
|
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
*(uint32_t*)buffer = htonl(game->future2);
|
*(uint32_t*)buffer = htonl(ourgamestruct->future2);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
|
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
*(uint32_t*)buffer = htonl(game->future3);
|
*(uint32_t*)buffer = htonl(ourgamestruct->future3);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
|
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
*(uint32_t*)buffer = htonl(game->future4);
|
*(uint32_t*)buffer = htonl(ourgamestruct->future4);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1712,13 +1712,13 @@ static void NETsendGAMESTRUCT(Socket* sock, const GAMESTRUCT* game)
|
||||||
*
|
*
|
||||||
* @see GAMESTRUCT,NETsendGAMESTRUCT
|
* @see GAMESTRUCT,NETsendGAMESTRUCT
|
||||||
*/
|
*/
|
||||||
static bool NETrecvGAMESTRUCT(GAMESTRUCT* game)
|
static bool NETrecvGAMESTRUCT(GAMESTRUCT* ourgamestruct)
|
||||||
{
|
{
|
||||||
// A buffer that's guaranteed to have the correct size (i.e. it
|
// A buffer that's guaranteed to have the correct size (i.e. it
|
||||||
// circumvents struct padding, which could pose a problem).
|
// circumvents struct padding, which could pose a problem).
|
||||||
char buf[sizeof(game->GAMESTRUCT_VERSION) + sizeof(game->name) + sizeof(game->desc.host) + (sizeof(int32_t) * 8) +
|
char buf[sizeof(ourgamestruct->GAMESTRUCT_VERSION) + sizeof(ourgamestruct->name) + sizeof(ourgamestruct->desc.host) + (sizeof(int32_t) * 8) +
|
||||||
sizeof(game->secondaryHosts) + sizeof(game->extra) + sizeof(game->versionstring) +
|
sizeof(ourgamestruct->secondaryHosts) + sizeof(ourgamestruct->extra) + sizeof(ourgamestruct->versionstring) +
|
||||||
sizeof(game->modlist) + (sizeof(uint32_t) * 9) ] = { 0 };
|
sizeof(ourgamestruct->modlist) + (sizeof(uint32_t) * 9) ] = { 0 };
|
||||||
char* buffer = buf;
|
char* buffer = buf;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
@ -1758,70 +1758,70 @@ static bool NETrecvGAMESTRUCT(GAMESTRUCT* game)
|
||||||
|
|
||||||
// Now dump the data into the game struct
|
// Now dump the data into the game struct
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
game->GAMESTRUCT_VERSION = ntohl(*(uint32_t*)buffer);
|
ourgamestruct->GAMESTRUCT_VERSION = ntohl(*(uint32_t*)buffer);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
// Copy a string
|
// Copy a string
|
||||||
sstrcpy(game->name, buffer);
|
sstrcpy(ourgamestruct->name, buffer);
|
||||||
buffer += sizeof(game->name);
|
buffer += sizeof(ourgamestruct->name);
|
||||||
|
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
game->desc.dwSize = ntohl(*(int32_t*)buffer);
|
ourgamestruct->desc.dwSize = ntohl(*(int32_t*)buffer);
|
||||||
buffer += sizeof(int32_t);
|
buffer += sizeof(int32_t);
|
||||||
game->desc.dwFlags = ntohl(*(int32_t*)buffer);
|
ourgamestruct->desc.dwFlags = ntohl(*(int32_t*)buffer);
|
||||||
buffer += sizeof(int32_t);
|
buffer += sizeof(int32_t);
|
||||||
|
|
||||||
// Copy yet another string
|
// Copy yet another string
|
||||||
sstrcpy(game->desc.host, buffer);
|
sstrcpy(ourgamestruct->desc.host, buffer);
|
||||||
buffer += sizeof(game->desc.host);
|
buffer += sizeof(ourgamestruct->desc.host);
|
||||||
|
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
game->desc.dwMaxPlayers = ntohl(*(int32_t*)buffer);
|
ourgamestruct->desc.dwMaxPlayers = ntohl(*(int32_t*)buffer);
|
||||||
buffer += sizeof(int32_t);
|
buffer += sizeof(int32_t);
|
||||||
game->desc.dwCurrentPlayers = ntohl(*(int32_t*)buffer);
|
ourgamestruct->desc.dwCurrentPlayers = ntohl(*(int32_t*)buffer);
|
||||||
buffer += sizeof(int32_t);
|
buffer += sizeof(int32_t);
|
||||||
for (i = 0; i < ARRAY_SIZE(game->desc.dwUserFlags); ++i)
|
for (i = 0; i < ARRAY_SIZE(ourgamestruct->desc.dwUserFlags); ++i)
|
||||||
{
|
{
|
||||||
game->desc.dwUserFlags[i] = ntohl(*(int32_t*)buffer);
|
ourgamestruct->desc.dwUserFlags[i] = ntohl(*(int32_t*)buffer);
|
||||||
buffer += sizeof(int32_t);
|
buffer += sizeof(int32_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy a string
|
// Copy a string
|
||||||
for (i = 0; i < ARRAY_SIZE(game->secondaryHosts); ++i)
|
for (i = 0; i < ARRAY_SIZE(ourgamestruct->secondaryHosts); ++i)
|
||||||
{
|
{
|
||||||
sstrcpy(game->secondaryHosts[i], buffer);
|
sstrcpy(ourgamestruct->secondaryHosts[i], buffer);
|
||||||
buffer += sizeof(game->secondaryHosts[i]);
|
buffer += sizeof(ourgamestruct->secondaryHosts[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy a string
|
// Copy a string
|
||||||
sstrcpy(game->extra, buffer);
|
sstrcpy(ourgamestruct->extra, buffer);
|
||||||
buffer += sizeof(game->extra);
|
buffer += sizeof(ourgamestruct->extra);
|
||||||
|
|
||||||
// Copy a string
|
// Copy a string
|
||||||
sstrcpy(game->versionstring, buffer);
|
sstrcpy(ourgamestruct->versionstring, buffer);
|
||||||
buffer += sizeof(game->versionstring);
|
buffer += sizeof(ourgamestruct->versionstring);
|
||||||
|
|
||||||
// Copy a string
|
// Copy a string
|
||||||
sstrcpy(game->modlist, buffer);
|
sstrcpy(ourgamestruct->modlist, buffer);
|
||||||
buffer += sizeof(game->modlist);
|
buffer += sizeof(ourgamestruct->modlist);
|
||||||
|
|
||||||
// Copy 32bit large big endian numbers
|
// Copy 32bit large big endian numbers
|
||||||
game->game_version_major = ntohl(*(uint32_t*)buffer);
|
ourgamestruct->game_version_major = ntohl(*(uint32_t*)buffer);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
game->game_version_minor = ntohl(*(uint32_t*)buffer);
|
ourgamestruct->game_version_minor = ntohl(*(uint32_t*)buffer);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
game->privateGame = ntohl(*(uint32_t*)buffer);
|
ourgamestruct->privateGame = ntohl(*(uint32_t*)buffer);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
game->pureGame = ntohl(*(uint32_t*)buffer);
|
ourgamestruct->pureGame = ntohl(*(uint32_t*)buffer);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
game->Mods = ntohl(*(uint32_t*)buffer);
|
ourgamestruct->Mods = ntohl(*(uint32_t*)buffer);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
game->gameId = ntohl(*(uint32_t*)buffer);
|
ourgamestruct->gameId = ntohl(*(uint32_t*)buffer);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
game->future2 = ntohl(*(uint32_t*)buffer);
|
ourgamestruct->future2 = ntohl(*(uint32_t*)buffer);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
game->future3 = ntohl(*(uint32_t*)buffer);
|
ourgamestruct->future3 = ntohl(*(uint32_t*)buffer);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
game->future4 = ntohl(*(uint32_t*)buffer);
|
ourgamestruct->future4 = ntohl(*(uint32_t*)buffer);
|
||||||
buffer += sizeof(uint32_t);
|
buffer += sizeof(uint32_t);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -2979,8 +2979,8 @@ static void NETregisterServer(int state)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
game.gameId = ntohl(gameId);
|
gamestruct.gameId = ntohl(gameId);
|
||||||
debug(LOG_NET, "Using game ID: %u", (unsigned int)game.gameId);
|
debug(LOG_NET, "Using game ID: %u", (unsigned int)gamestruct.gameId);
|
||||||
|
|
||||||
// Register our game with the server for all available address families
|
// Register our game with the server for all available address families
|
||||||
for (i = 0; i < ARRAY_SIZE(rs_socket); ++i)
|
for (i = 0; i < ARRAY_SIZE(rs_socket); ++i)
|
||||||
|
@ -2990,7 +2990,7 @@ static void NETregisterServer(int state)
|
||||||
|
|
||||||
writeAll(rs_socket[i], "addg", sizeof("addg"));
|
writeAll(rs_socket[i], "addg", sizeof("addg"));
|
||||||
// and now send what the server wants
|
// and now send what the server wants
|
||||||
NETsendGAMESTRUCT(rs_socket[i], &game);
|
NETsendGAMESTRUCT(rs_socket[i], &gamestruct);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the return codes
|
// Get the return codes
|
||||||
|
@ -3112,9 +3112,9 @@ static void NETallowJoining(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// get the correct player count after kicks / leaves
|
// get the correct player count after kicks / leaves
|
||||||
game.desc.dwCurrentPlayers = NetPlay.playercount;
|
gamestruct.desc.dwCurrentPlayers = NetPlay.playercount;
|
||||||
debug(LOG_NET, "Sending update to server to reflect new player count %d", NetPlay.playercount);
|
debug(LOG_NET, "Sending update to server to reflect new player count %d", NetPlay.playercount);
|
||||||
NETsendGAMESTRUCT(tmp_socket[i], &game);
|
NETsendGAMESTRUCT(tmp_socket[i], &gamestruct);
|
||||||
}
|
}
|
||||||
|
|
||||||
delSocket(tmp_socket_set, tmp_socket[i]);
|
delSocket(tmp_socket_set, tmp_socket[i]);
|
||||||
|
@ -3124,7 +3124,7 @@ static void NETallowJoining(void)
|
||||||
else if (strcmp(buffer, "join") == 0)
|
else if (strcmp(buffer, "join") == 0)
|
||||||
{
|
{
|
||||||
debug(LOG_NET, "cmd: join. Sending GAMESTRUCT");
|
debug(LOG_NET, "cmd: join. Sending GAMESTRUCT");
|
||||||
NETsendGAMESTRUCT(tmp_socket[i], &game);
|
NETsendGAMESTRUCT(tmp_socket[i], &gamestruct);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3186,7 +3186,7 @@ static void NETallowJoining(void)
|
||||||
(unsigned int)index, connected_bsocket[index]->socket);
|
(unsigned int)index, connected_bsocket[index]->socket);
|
||||||
|
|
||||||
// Increment player count
|
// Increment player count
|
||||||
game.desc.dwCurrentPlayers++;
|
gamestruct.desc.dwCurrentPlayers++;
|
||||||
|
|
||||||
NETbeginEncode(NET_ACCEPTED, index);
|
NETbeginEncode(NET_ACCEPTED, index);
|
||||||
NETuint8_t(&index);
|
NETuint8_t(&index);
|
||||||
|
@ -3291,32 +3291,32 @@ BOOL NEThostGame(const char* SessionName, const char* PlayerName,
|
||||||
|
|
||||||
NetPlay.isHost = true;
|
NetPlay.isHost = true;
|
||||||
|
|
||||||
sstrcpy(game.name, SessionName);
|
sstrcpy(gamestruct.name, SessionName);
|
||||||
memset(&game.desc, 0, sizeof(game.desc));
|
memset(&gamestruct.desc, 0, sizeof(gamestruct.desc));
|
||||||
game.desc.dwSize = sizeof(game.desc);
|
gamestruct.desc.dwSize = sizeof(gamestruct.desc);
|
||||||
//game.desc.guidApplication = GAME_GUID;
|
//gamestruct.desc.guidApplication = GAME_GUID;
|
||||||
memset(game.desc.host, 0, sizeof(game.desc.host));
|
memset(gamestruct.desc.host, 0, sizeof(gamestruct.desc.host));
|
||||||
game.desc.dwCurrentPlayers = 1;
|
gamestruct.desc.dwCurrentPlayers = 1;
|
||||||
game.desc.dwMaxPlayers = plyrs;
|
gamestruct.desc.dwMaxPlayers = plyrs;
|
||||||
game.desc.dwFlags = 0;
|
gamestruct.desc.dwFlags = 0;
|
||||||
game.desc.dwUserFlags[0] = one;
|
gamestruct.desc.dwUserFlags[0] = one;
|
||||||
game.desc.dwUserFlags[1] = two;
|
gamestruct.desc.dwUserFlags[1] = two;
|
||||||
game.desc.dwUserFlags[2] = three;
|
gamestruct.desc.dwUserFlags[2] = three;
|
||||||
game.desc.dwUserFlags[3] = four;
|
gamestruct.desc.dwUserFlags[3] = four;
|
||||||
memset(game.secondaryHosts, 0, sizeof(game.secondaryHosts));
|
memset(gamestruct.secondaryHosts, 0, sizeof(gamestruct.secondaryHosts));
|
||||||
sstrcpy(game.extra, "Extra"); // extra string (future use)
|
sstrcpy(gamestruct.extra, "Extra"); // extra string (future use)
|
||||||
sstrcpy(game.versionstring, VersionString); // version (string)
|
sstrcpy(gamestruct.versionstring, VersionString); // version (string)
|
||||||
sstrcpy(game.modlist, "Mod list"); // List of mods
|
sstrcpy(gamestruct.modlist, "Mod list"); // List of mods
|
||||||
game.GAMESTRUCT_VERSION = 3; // version of this structure
|
gamestruct.GAMESTRUCT_VERSION = 3; // version of this structure
|
||||||
game.game_version_major = NETCODE_VERSION_MAJOR; // Netcode Major version
|
gamestruct.game_version_major = NETCODE_VERSION_MAJOR; // Netcode Major version
|
||||||
game.game_version_minor = NETCODE_VERSION_MINOR; // NetCode Minor version
|
gamestruct.game_version_minor = NETCODE_VERSION_MINOR; // NetCode Minor version
|
||||||
// game.privateGame = 0; // if true, it is a private game
|
// gamestruct.privateGame = 0; // if true, it is a private game
|
||||||
game.pureGame = 0; // NO mods allowed if true
|
gamestruct.pureGame = 0; // NO mods allowed if true
|
||||||
game.Mods = 0; // number of concatenated mods?
|
gamestruct.Mods = 0; // number of concatenated mods?
|
||||||
game.gameId = 0;
|
gamestruct.gameId = 0;
|
||||||
game.future2 = 0xBAD02; // for future use
|
gamestruct.future2 = 0xBAD02; // for future use
|
||||||
game.future3 = 0xBAD03; // for future use
|
gamestruct.future3 = 0xBAD03; // for future use
|
||||||
game.future4 = 0xBAD04; // for future use
|
gamestruct.future4 = 0xBAD04; // for future use
|
||||||
|
|
||||||
selectedPlayer= NET_CreatePlayer(PlayerName);
|
selectedPlayer= NET_CreatePlayer(PlayerName);
|
||||||
NetPlay.isHost = true;
|
NetPlay.isHost = true;
|
||||||
|
|
Loading…
Reference in New Issue