diff --git a/src/multiplay.c b/src/multiplay.c index b649dce2c..7989695a8 100644 --- a/src/multiplay.c +++ b/src/multiplay.c @@ -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); diff --git a/src/multiplay.h b/src/multiplay.h index f6faf372a..f80b62f06 100644 --- a/src/multiplay.h +++ b/src/multiplay.h @@ -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); diff --git a/src/multirecv.h b/src/multirecv.h index f5af8c2f1..0ecc57c86 100644 --- a/src/multirecv.h +++ b/src/multirecv.h @@ -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 (); diff --git a/src/multistruct.c b/src/multistruct.c index 6cd126d14..b2704905f 100644 --- a/src/multistruct.c +++ b/src/multistruct.c @@ -320,42 +320,47 @@ 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) - { - turnOffMultiMsg(TRUE); - destroyStruct(psStr); // remove the struct from remote players machine. - turnOffMultiMsg(FALSE); - - technologyGiveAway(psStr); - - return (TRUE); - } - return (TRUE); + NETuint32_t(&structID); + + // Struct to destory + psStruct = IdToStruct(structID,ANYPLAYER); + + if (psStruct) + { + turnOffMultiMsg(TRUE); + // Remove the struct from remote players machine + destroyStruct(psStruct); + turnOffMultiMsg(FALSE); + // NOTE: I do not think this should be here! + technologyGiveAway(psStruct); + } + + NETend(); + return TRUE; } - // //////////////////////////////////////////////////////////////////////////// //lassat is firing