peerListingGamesCallback

GameSpy SDK

peerListingGamesCallback

Callback for peerStartListingGames.

typedef void (*peerListingGamesCallback)(
PEER peer,
PEERBool success,
const gsi_char * name,
SBServer server,
PEERBool staging,
int msg,
int progress,
void * param );
RoutineRequired HeaderDistribution
peerListingGamesCallback<peer.h>SDKZIP

Parameters

peer
[in] Initialized peer object
success
[in] PEERTrue if successful, PEERFalse if failure
name
[in] The name of the game
server
[in] The valid SBServer object a game is associated with
staging
[in] PEERTrue if staging,
msg
[in] A message code
progress
[in] A progress of the initial listing
param
[in] Pointer to user data. This is optional and will be passed unmodified to the callback function.

Remarks

The peerListingGamesCallback function is called with info on games being listed. It is used to maintain a list of running games and staging rooms. The server object is a unique way of identifying each game. It can also be used with the calls in the "SBServer Object Functions" section of sb_serverbrowsing.h to find out more info about the server.
If "staging" is true, the game hasn't started yet, it's still in the staging room. Use peerJoinStagingRoom() to join the staging room. Or, if staging is false, use the server object to get the game's IP and port to join with.
The "password" key will be set to 1 for games that are passworded. This can be checked with ServerGetIntValue(server, "password", 0).
The type of message this is.
PEER_CLEAR:
Clear the list. This has the same effect as if this was called with PEER_REMOVE for every server listed.
PEER_ADD:
This is a new server. Add it to the list.
PEER_UPDATE:
This server is already on the list, and its been updated.
PEER_REMOVE:
Remove this server from the list. The server object for this server should not be used again after this callback returns.
PEER_COMPLETE:
The initial listing of servers has completed, and dynamic changes will now be received.

When first starting to list games, an intial list of current games is received, then updated as new game are started and old games are updated or removed. While the initial listing is happening, this lets the program know what percentage of the initial list has been added so far. It will start at 0 with the PEER_CLEAR message, then rise up to 100 with the PEER_COMPLETE message. When it reaches 100, it will stay there until the listing is stopped.

Unicode Mappings

RoutineGSI_UNICODE Not DefinedGSI_UNICODE Defined
peerListingGamesCallbackpeerListingGamesCallbackApeerListingGamesCallbackW

peerListingGamesCallbackW and peerListingGamesCallbackA are UNICODE and ANSI mapped versions of peerListingGamesCallback. The arguments of peerListingGamesCallbackA are ANSI strings; those of peerListingGamesCallbackW are wide-character strings.

Section Reference: Gamespy Peer SDK