* Move the send/recv-DroidDisEmbark functions over to the new net primitives API (patch #905 by myself)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3236 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
7a0be7c719
commit
28f5f74aba
|
@ -237,63 +237,69 @@ BOOL recvDroidEmbark(NETMSG *pMsg)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL sendDroidDisEmbark(DROID *psDroid)
|
||||
BOOL sendDroidDisEmbark(const DROID* psDroid)
|
||||
{
|
||||
NETMSG m;
|
||||
|
||||
NetAdd(m,0,psDroid->id);
|
||||
NetAdd(m,4,psDroid->pos.x);
|
||||
NetAdd(m,6,psDroid->pos.y);
|
||||
m.body[8] = (char) psDroid->player;
|
||||
|
||||
m.size = 9;
|
||||
m.type = NET_DROIDDISEMBARK;
|
||||
|
||||
return NETbcast(&m,FALSE);
|
||||
NETbeginEncode(NET_DROIDDISEMBARK, NET_ALL_PLAYERS);
|
||||
{
|
||||
uint8_t player = psDroid->player;
|
||||
uint32_t droid = psDroid->id;
|
||||
Vector3uw pos = psDroid->pos;
|
||||
|
||||
NETuint8_t(&player);
|
||||
NETuint32_t(&droid);
|
||||
NETVector3uw(&pos);
|
||||
}
|
||||
return NETend();
|
||||
}
|
||||
|
||||
BOOL recvDroidDisEmbark(NETMSG *pMsg)
|
||||
BOOL recvDroidDisEmbark()
|
||||
{
|
||||
DROID *psDroid;
|
||||
UDWORD id, player;
|
||||
UWORD x, y;
|
||||
DROID* psDroid;
|
||||
|
||||
NetGet(pMsg,0,id);
|
||||
NetGet(pMsg,4,x);
|
||||
NetGet(pMsg,6,y);
|
||||
player = pMsg->body[8];
|
||||
|
||||
if(!IdToDroid(id,player,&psDroid)) //find droid.
|
||||
NETbeginDecode();
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
uint8_t player;
|
||||
uint32_t droid;
|
||||
Vector3uw pos;
|
||||
|
||||
if(psDroid)
|
||||
{
|
||||
// Add it back into the world at the x/y
|
||||
psDroid->pos.x = x;
|
||||
psDroid->pos.y = y;
|
||||
NETuint8_t(&player);
|
||||
NETuint32_t(&droid);
|
||||
NETVector3uw(&pos);
|
||||
|
||||
if (!worldOnMap(x, y))
|
||||
NETend();
|
||||
|
||||
if (!IdToDroid(droid, player, &psDroid))
|
||||
{
|
||||
debug(LOG_ERROR, "recvDroidDisEmbark: droid not disembarked on map");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
updateDroidOrientation(psDroid);
|
||||
if (psDroid == NULL)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Initialise the movement data
|
||||
initDroidMovement(psDroid);
|
||||
|
||||
// Reset droid orders
|
||||
orderDroid(psDroid, DORDER_STOP);
|
||||
gridAddObject((BASE_OBJECT *)psDroid);
|
||||
psDroid->cluster = 0;
|
||||
|
||||
addDroid(psDroid, apsDroidLists);
|
||||
// Add it back into the world at the x/y
|
||||
psDroid->pos = pos;
|
||||
}
|
||||
|
||||
if (!worldOnMap(psDroid->pos.x, psDroid->pos.y))
|
||||
{
|
||||
debug(LOG_ERROR, "recvDroidDisEmbark: droid not disembarked on map");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
updateDroidOrientation(psDroid);
|
||||
|
||||
// Initialise the movement data
|
||||
initDroidMovement(psDroid);
|
||||
|
||||
// Reset droid orders
|
||||
orderDroid(psDroid, DORDER_STOP);
|
||||
gridAddObject((BASE_OBJECT *)psDroid);
|
||||
psDroid->cluster = 0;
|
||||
|
||||
addDroid(psDroid, apsDroidLists);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -688,7 +688,7 @@ BOOL recvMessage(void)
|
|||
recvDroidEmbark(&msg); //droid has embarked on a Transporter
|
||||
break;
|
||||
case NET_DROIDDISEMBARK:
|
||||
recvDroidDisEmbark(&msg); //droid has disembarked from a Transporter
|
||||
recvDroidDisEmbark(); //droid has disembarked from a Transporter
|
||||
break;
|
||||
case NET_REQUESTDROID: // player requires a droid that they dont have.
|
||||
recvRequestDroid(&msg);
|
||||
|
|
|
@ -255,7 +255,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 sendDroidDisEmbark (DROID *psDroid);
|
||||
extern BOOL sendDroidDisEmbark (const DROID* psDroid);
|
||||
extern BOOL sendDestroyExtra (BASE_OBJECT *psKilled,BASE_OBJECT *psKiller);
|
||||
extern BOOL sendHappyVtol (DROID *psDroid);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ extern BOOL recvTextMessage (NETMSG *pMsg);
|
|||
extern BOOL recvDroidSecondary (NETMSG *pMsg);
|
||||
extern BOOL recvDroidSecondaryAll (NETMSG *pMsg);
|
||||
extern BOOL recvDroidEmbark (NETMSG *pMsg);
|
||||
extern BOOL recvDroidDisEmbark (NETMSG *pMsg);
|
||||
extern BOOL recvDroidDisEmbark (void);
|
||||
//extern BOOL recvCommandDroid (NETMSG *pMsg);
|
||||
extern BOOL recvDroidCheck ();
|
||||
extern BOOL recvStructureCheck ();
|
||||
|
|
Loading…
Reference in New Issue