NAME
====
vg_nw_getvar() - return a network variable for player data
SYNOPSIS
========
void * vg_nw_getvar(const char * name, int plno)
DESCRIPTION
===========
After waiting for connections of all players (vg_nw_waitforconnects())
use vg_nw_getvar() for each player to set the struct pointers for the
player-data to the network-variables for this player.
name is the unique name given to vg_nw_setvar().
plno is the player-number of the player whose variable you want to get.
Example:
struct {
short * vtp;
} player_data[NW_MAXPLAYER];
int i;
// define a "short vtp[9]"
if (vg_nw_setvar(NWVAR_SHORT,9,"vtp") < 0) { goto error; }
// connect to network-server (master: start it)
[ ... ]
// wait for connects of all players
if (vg_nw_waitforconnects() < 0) { goto error; }
// get pointer to the network-variable vtp for all players
for (i=1; i <= vg_nw_maxplayer(); i++) {
player_data[i-1].vtp=(short *)vg_nw_getvar("vtp",i);
}
// set vtp for player 5 empty
memset(player_data[5-1].vtp,0,9);
Refer to Understanding network.
RETURN VALUE
============
It returns a pointer to the defined variable in the player-data of a player
or NULL if the variable was not defined.
SEE ALSO
========
Index
Understanding network
vg_nw_setplayer()
vg_nw_startserver()
vg_nw_connect()
vg_nw_waitforconnects()
vg_nw_setvar()
vg_nw_setcommon()
vg_nw_getcommon()
vg_nw_dumppacket()
vg_nw_sendinit()
vg_nw_recvinit()
vg_nw_myplayer()
vg_nw_maxplayer()
vg_nw_virtualplayer()
vg_nw_isalive()
vg_nw_recvkeys()
vg_nw_keypressed()
vg_nw_mousepressed()
vg_nw_mousex()
vg_nw_mousey()
vg_nw_senddata()
vg_nw_sendcommon()
vg_nw_setdead()
vg_nw_dumpsprite()
vg_nw_undumpsprite()
vg_nw_close()