* Move the send/recv-DroidSecondary functions over to the new net primitives API (patch #905 by myself)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3240 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
8e1536d867
commit
204611ba6b
|
@ -118,38 +118,46 @@ BOOL recvHappyVtol(NETMSG *pMsg)
|
|||
// Secondary Orders.
|
||||
|
||||
// Send
|
||||
BOOL sendDroidSecondary(DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE state)
|
||||
BOOL sendDroidSecondary(const DROID* psDroid, SECONDARY_ORDER sec, SECONDARY_STATE state)
|
||||
{
|
||||
NETMSG m;
|
||||
NETbeginEncode(NET_SECONDARY, NET_ALL_PLAYERS);
|
||||
{
|
||||
uint8_t player = psDroid->player;
|
||||
uint32_t droid = psDroid->id;
|
||||
|
||||
NetAdd(m,0,psDroid->id);
|
||||
NetAdd(m,4,sec);
|
||||
NetAdd(m,8,state);
|
||||
m.body[12] = (char) psDroid->player;
|
||||
|
||||
m.size = 13;
|
||||
m.type = NET_SECONDARY;
|
||||
return NETbcast(&m,FALSE);
|
||||
NETuint8_t(&player);
|
||||
NETuint32_t(&droid);
|
||||
NETenum(&sec);
|
||||
NETenum(&state);
|
||||
}
|
||||
return NETend();
|
||||
}
|
||||
|
||||
// recv
|
||||
BOOL recvDroidSecondary(NETMSG *pMsg)
|
||||
BOOL recvDroidSecondary()
|
||||
{
|
||||
DROID* psDroid;
|
||||
SECONDARY_ORDER sec;
|
||||
SECONDARY_STATE state;
|
||||
UDWORD id,player;
|
||||
|
||||
NetGet(pMsg,0,id);
|
||||
NetGet(pMsg,4,sec);
|
||||
NetGet(pMsg,8,state);
|
||||
player = pMsg->body[12];
|
||||
NETbeginDecode();
|
||||
{
|
||||
uint8_t player;
|
||||
uint32_t droid;
|
||||
|
||||
NETuint8_t(&player);
|
||||
NETuint32_t(&droid);
|
||||
NETenum(&sec);
|
||||
NETenum(&state);
|
||||
|
||||
// If we can not find the droid should we not ask for it?
|
||||
if(!IdToDroid(id,player,&psDroid)) //find droid.
|
||||
if (!IdToDroid(droid, player, &psDroid))
|
||||
{
|
||||
NETend();
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
NETend();
|
||||
|
||||
// Set the droids secondary order
|
||||
turnOffMultiMsg(TRUE);
|
||||
|
@ -159,7 +167,6 @@ BOOL recvDroidSecondary(NETMSG *pMsg)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOL sendDroidSecondaryAll(DROID *psDroid)
|
||||
{
|
||||
NETMSG m;
|
||||
|
|
|
@ -679,7 +679,7 @@ BOOL recvMessage(void)
|
|||
recvDestroyStructure();
|
||||
break;
|
||||
case NET_SECONDARY: // set a droids secondary order level.
|
||||
recvDroidSecondary(&msg);
|
||||
recvDroidSecondary();
|
||||
break;
|
||||
case NET_SECONDARY_ALL: // set a droids secondary order level.
|
||||
recvDroidSecondaryAll(&msg);
|
||||
|
|
|
@ -252,7 +252,7 @@ extern BOOL SendCmdGroup (DROID_GROUP *psGroup, UWORD x, UWORD y, BASE_OBJECT *
|
|||
extern BOOL SendGroupOrderGroup(DROID_GROUP *psGroup, DROID_ORDER order,UDWORD x,UDWORD y,BASE_OBJECT *psObj);
|
||||
|
||||
|
||||
extern BOOL sendDroidSecondary (DROID *psDroid, SECONDARY_ORDER sec, SECONDARY_STATE state);
|
||||
extern BOOL sendDroidSecondary (const DROID* psDroid, SECONDARY_ORDER sec, SECONDARY_STATE state);
|
||||
extern BOOL sendDroidSecondaryAll(DROID *psDroid);
|
||||
extern BOOL sendDroidEmbark (const DROID* psDroid);
|
||||
extern BOOL sendDroidDisEmbark (const DROID* psDroid);
|
||||
|
|
|
@ -43,7 +43,7 @@ extern BOOL recvDemolishFinished ();
|
|||
extern BOOL recvPing ();
|
||||
extern BOOL recvRequestDroid (NETMSG *pMsg);
|
||||
extern BOOL recvTextMessage (NETMSG *pMsg);
|
||||
extern BOOL recvDroidSecondary (NETMSG *pMsg);
|
||||
extern BOOL recvDroidSecondary (void);
|
||||
extern BOOL recvDroidSecondaryAll (NETMSG *pMsg);
|
||||
extern BOOL recvDroidEmbark (void);
|
||||
extern BOOL recvDroidDisEmbark (void);
|
||||
|
|
Loading…
Reference in New Issue