// //////////////////////////////////////////////////////////////////////////// // acknowledge the destruction of a structure, from another player. bool recvDestroyStructure(NETQUEUE queue) { uint32_t structID; STRUCTURE *psStruct; NETbeginDecode(queue, GAME_DEBUG_REMOVE_STRUCTURE); NETuint32_t(&structID); NETend(); if (!getDebugMappingStatus() && bMultiPlayer) { debug(LOG_WARNING, "Failed to remove structure for player %u.", NetPlay.players[queue.index].position); return false; } // Struct to destory psStruct = IdToStruct(structID, ANYPLAYER); if (psStruct) { turnOffMultiMsg(true); // Remove the struct from remote players machine destroyStruct(psStruct, gameTime - deltaGameTime + 1); // deltaGameTime is actually 0 here, since we're between updates. However, the value of gameTime - deltaGameTime + 1 will not change when we start the next tick. turnOffMultiMsg(false); // NOTE: I do not think this should be here! technologyGiveAway(psStruct); } return true; }
// //////////////////////////////////////////////////////////////////////////// // Inform others that a structure has been destroyed BOOL SendDestroyStructure(STRUCTURE *s) { technologyGiveAway(s); NETbeginEncode(NETgameQueue(selectedPlayer), GAME_STRUCTDEST); // Struct to destroy NETuint32_t(&s->id); return NETend(); }
// //////////////////////////////////////////////////////////////////////////// // Inform others that a structure has been destroyed BOOL SendDestroyStructure(STRUCTURE *s) { technologyGiveAway(s); NETbeginEncode(NET_STRUCTDEST, NET_ALL_PLAYERS); // Struct to destroy NETuint32_t(&s->id); return NETend(); }
// //////////////////////////////////////////////////////////////////////////// // Inform others that a structure has been destroyed BOOL SendDestroyStructure(STRUCTURE *s) { NETMSG m; technologyGiveAway(s); NetAdd(m,0,s->id); // struct to destroy m.size =sizeof(UDWORD); m.type=NET_STRUCTDEST; return( NETbcast(&m,FALSE)); }
// //////////////////////////////////////////////////////////////////////////// // acknowledge the destruction of a structure, from another player. BOOL recvDestroyStructure(NETMSG * m) { UDWORD s; STRUCTURE *psStr; NetGet(m,0,s); // struct to destory 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); }
// //////////////////////////////////////////////////////////////////////////// // acknowledge the destruction of a structure, from another player. BOOL recvDestroyStructure(NETQUEUE queue) { uint32_t structID; STRUCTURE *psStruct; NETbeginDecode(queue, GAME_STRUCTDEST); NETuint32_t(&structID); NETend(); // 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); } return true; }