* Move the send/recv-DroidEmbark functions over to the new net primitives API (patch #905 by myself)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3237 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2007-12-30 17:02:53 +00:00
parent 28f5f74aba
commit 498b6c4660
4 changed files with 38 additions and 30 deletions

View File

@ -196,43 +196,51 @@ BOOL recvDroidSecondaryAll(NETMSG *pMsg)
return TRUE;
}
BOOL sendDroidEmbark(DROID *psDroid)
BOOL sendDroidEmbark(const DROID* psDroid)
{
NETMSG m;
NetAdd(m,0,psDroid->id);
m.body[4] = (char) psDroid->player;
m.size = 5;
m.type = NET_DROIDEMBARK;
return NETbcast(&m,FALSE);
NETbeginEncode(NET_DROIDEMBARK, NET_ALL_PLAYERS);
{
uint8_t player = psDroid->player;
uint32_t droid = psDroid->id;
NETuint8_t(&player);
NETuint32_t(&droid);
}
return NETend();
}
BOOL recvDroidEmbark(NETMSG *pMsg)
BOOL recvDroidEmbark()
{
DROID *psDroid;
UDWORD id,player;
DROID* psDroid;
NetGet(pMsg,0,id);
player = pMsg->body[4];
if(!IdToDroid(id,player,&psDroid)) //find droid.
NETbeginDecode();
{
return FALSE;
uint8_t player;
uint32_t droid;
NETuint8_t(&player);
NETuint32_t(&droid);
if (!IdToDroid(droid, player, &psDroid))
{
NETend();
return FALSE;
}
}
NETend();
if (psDroid == NULL)
{
return TRUE;
}
if(psDroid)
{
// Take it out of the world without destroying it
droidRemove(psDroid, apsDroidLists);
// Take it out of the world without destroying it
droidRemove(psDroid, apsDroidLists);
// Init the order for when disembark
psDroid->order = DORDER_NONE;
setDroidTarget(psDroid, NULL);
psDroid->psTarStats = NULL;
}
// Init the order for when disembark
psDroid->order = DORDER_NONE;
setDroidTarget(psDroid, NULL);
psDroid->psTarStats = NULL;
return TRUE;
}

View File

@ -685,7 +685,7 @@ BOOL recvMessage(void)
recvDroidSecondaryAll(&msg);
break;
case NET_DROIDEMBARK:
recvDroidEmbark(&msg); //droid has embarked on a Transporter
recvDroidEmbark(); //droid has embarked on a Transporter
break;
case NET_DROIDDISEMBARK:
recvDroidDisEmbark(); //droid has disembarked from a Transporter

View File

@ -254,7 +254,7 @@ extern BOOL SendGroupOrderGroup(DROID_GROUP *psGroup, DROID_ORDER order,UDWORD x
extern BOOL sendDroidSecondary (DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE state);
extern BOOL sendDroidSecondaryAll(DROID *psDroid);
extern BOOL sendDroidEmbark (DROID *psDroid);
extern BOOL sendDroidEmbark (const DROID* psDroid);
extern BOOL sendDroidDisEmbark (const DROID* psDroid);
extern BOOL sendDestroyExtra (BASE_OBJECT *psKilled,BASE_OBJECT *psKiller);
extern BOOL sendHappyVtol (DROID *psDroid);

View File

@ -45,7 +45,7 @@ extern BOOL recvRequestDroid (NETMSG *pMsg);
extern BOOL recvTextMessage (NETMSG *pMsg);
extern BOOL recvDroidSecondary (NETMSG *pMsg);
extern BOOL recvDroidSecondaryAll (NETMSG *pMsg);
extern BOOL recvDroidEmbark (NETMSG *pMsg);
extern BOOL recvDroidEmbark (void);
extern BOOL recvDroidDisEmbark (void);
//extern BOOL recvCommandDroid (NETMSG *pMsg);
extern BOOL recvDroidCheck ();