Commit the final part of patch #897 (send/recvDestroyStructure)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3161 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
776babad75
commit
8f5fb1c714
|
@ -676,7 +676,7 @@ BOOL recvMessage(void)
|
|||
recvBuildFinished();
|
||||
break;
|
||||
case NET_STRUCTDEST: // structure destroy
|
||||
recvDestroyStructure(&msg);
|
||||
recvDestroyStructure();
|
||||
break;
|
||||
case NET_SECONDARY: // set a droids secondary order level.
|
||||
recvDroidSecondary(&msg);
|
||||
|
|
|
@ -235,7 +235,7 @@ extern BOOL multiplayerWinSequence(BOOL firstCall);
|
|||
|
||||
// Buildings . multistruct
|
||||
extern BOOL sendBuildStarted (STRUCTURE *psStruct, DROID *psDroid);
|
||||
extern BOOL SendDestroyStructure(const STRUCTURE* s);
|
||||
extern BOOL SendDestroyStructure(STRUCTURE *s);
|
||||
extern BOOL SendBuildFinished (STRUCTURE *psStruct);
|
||||
extern BOOL sendLasSat (UBYTE player, STRUCTURE *psStruct, BASE_OBJECT *psObj);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ extern BOOL recvDestroyDroid (NETMSG *pMsg);
|
|||
extern BOOL recvGroupOrder (NETMSG *pMsg);
|
||||
extern BOOL recvDroidMove (NETMSG *pMsg);
|
||||
extern BOOL receiveWholeDroid (NETMSG *pMsg);
|
||||
extern BOOL recvDestroyStructure (NETMSG *pMsg);
|
||||
extern BOOL recvDestroyStructure ();
|
||||
//extern BOOL RecvBuild (NETMSG *pMsg);
|
||||
extern BOOL recvBuildStarted ();
|
||||
extern BOOL recvBuildFinished ();
|
||||
|
|
|
@ -320,41 +320,46 @@ BOOL recvDemolishFinished()
|
|||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// Inform others that a structure has been destroyed
|
||||
BOOL SendDestroyStructure(const STRUCTURE* s)
|
||||
BOOL SendDestroyStructure(STRUCTURE *s)
|
||||
{
|
||||
NETMSG m;
|
||||
|
||||
DBCONPRINTF(ConsoleString,(ConsoleString,"SendDestroyStructure() called"));
|
||||
technologyGiveAway(s);
|
||||
NETbeginEncode(NET_STRUCTDEST, NET_ALL_PLAYERS);
|
||||
|
||||
NetAdd(m,0,s->id); // struct to destroy
|
||||
m.size =sizeof(UDWORD);
|
||||
m.type=NET_STRUCTDEST;
|
||||
return( NETbcast(&m,FALSE));
|
||||
// Struct to destroy
|
||||
NETuint32_t(&s->id);
|
||||
|
||||
return NETend();
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// acknowledge the destruction of a structure, from another player.
|
||||
BOOL recvDestroyStructure(NETMSG * m)
|
||||
BOOL recvDestroyStructure()
|
||||
{
|
||||
UDWORD s;
|
||||
STRUCTURE *psStr;
|
||||
uint32_t structID;
|
||||
STRUCTURE *psStruct;
|
||||
|
||||
NetGet(m,0,s); // struct to destory
|
||||
DBCONPRINTF(ConsoleString,(ConsoleString,"recvDestroyStructure() called"));
|
||||
NETbeginDecode();
|
||||
|
||||
psStr = IdToStruct(s,ANYPLAYER);
|
||||
if (psStr)
|
||||
NETuint32_t(&structID);
|
||||
|
||||
// Struct to destory
|
||||
psStruct = IdToStruct(structID,ANYPLAYER);
|
||||
|
||||
if (psStruct)
|
||||
{
|
||||
turnOffMultiMsg(TRUE);
|
||||
destroyStruct(psStr); // remove the struct from remote players machine.
|
||||
// Remove the struct from remote players machine
|
||||
destroyStruct(psStruct);
|
||||
turnOffMultiMsg(FALSE);
|
||||
|
||||
technologyGiveAway(psStr);
|
||||
|
||||
return (TRUE);
|
||||
// NOTE: I do not think this should be here!
|
||||
technologyGiveAway(psStruct);
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
NETend();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
//lassat is firing
|
||||
|
|
Loading…
Reference in New Issue