<DIV>I am a little bit confused about how to link peers to each game player.</DIV>
<DIV> </DIV>
<DIV>I have an array of players containg all client player data and a single ENetPeer*. I have put the player number in the peer->data field.</DIV>
<DIV> </DIV>
<DIV>I am assuming that when I create each client peer on the server it somehow connects it to the server socket.</DIV>
<DIV> </DIV>
<DIV>Here is a more hands on example:</DIV>
<DIV> </DIV>
<DIV>while( enet_host_service( LocalHost, &event, 50) > 0)<BR>{</DIV>
<DIV> switch (event.type)<BR> {</DIV>
<DIV> case ENET_EVENT_TYPE_CONNECT:<BR> <BR> if(GameData.NumPlayers < DAT_options.MaxNetPlayers)<BR> {<BR> // * connect new player *<BR> MSG_Message("Client connected from %s", event.peer->address);</DIV>
<DIV> </DIV>
<DIV> GameData.NumPlayers++;</DIV>
<DIV> </DIV>
<DIV> // set player peer (reassign peer pointer)<BR> PlayerPeers[ GameData.NumPlayers-1] = event.peer;<BR> event.peer = NULL;</DIV>
<DIV> </DIV>
<DIV> // store player number in peer (so that we can tell where packets came from)<BR> NET_BindPlayerNumberToPeer( PlayerPeers[ GameData.NumPlayers-1], GameData.NumPlayers-1);</DIV>
<DIV> ......</DIV>
<DIV> </DIV>
<DIV>You see I need to store the player number in each peer so that I can determine which player the packet arrived from when calling enet_host_serivce on the server.</DIV>
<DIV> </DIV>
<DIV>The big question is:</DIV>
<DIV>Is this a viable way of doing this or should I be doing things another way (I wanted to avoid storing player data in each "peer", if possible I would simply like to store the player number)?</DIV>
<DIV> </DIV>
<DIV>James.</DIV>
<DIV> </DIV><p>
                <hr size=1><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="http://us.rd.yahoo.com/mail/uk/taglines/default/messenger/*http://uk.messenger.yahoo.com
">Yahoo! Messenger</a>
<font color="red">NEW</font> - crystal clear PC to PC
<a href="http://us.rd.yahoo.com/mail/uk/taglines/default/messenger/*http://uk.beta.messenger.yahoo.com
">calling worldwide with voicemail
</a></font>