File tree Expand file tree Collapse file tree 4 files changed +53
-16
lines changed
GeneralsMD/Code/GameEngine Expand file tree Collapse file tree 4 files changed +53
-16
lines changed Original file line number Diff line number Diff line change @@ -568,4 +568,31 @@ class NetFrameResendRequestCommandMsg : public NetCommandMsg
568568protected:
569569 UnsignedInt m_frameToResend;
570570};
571+
572+ // -----------------------------------------------------------------------------
573+ /* *
574+ * The NetLoadCompleteCommandMsg is a simple command message for load complete notifications
575+ */
576+ class NetLoadCompleteCommandMsg : public NetCommandMsg
577+ {
578+ MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE (NetLoadCompleteCommandMsg, " NetLoadCompleteCommandMsg" )
579+ public:
580+ NetLoadCompleteCommandMsg ();
581+
582+ size_t getPackedByteCount () const ;
583+ };
584+
585+ // -----------------------------------------------------------------------------
586+ /* *
587+ * The NetTimeOutGameStartCommandMsg is a simple command message for timeout game start notifications
588+ */
589+ class NetTimeOutGameStartCommandMsg : public NetCommandMsg
590+ {
591+ MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE (NetTimeOutGameStartCommandMsg, " NetTimeOutGameStartCommandMsg" )
592+ public:
593+ NetTimeOutGameStartCommandMsg ();
594+
595+ size_t getPackedByteCount () const ;
596+ };
597+
571598#endif
Original file line number Diff line number Diff line change @@ -2222,12 +2222,11 @@ void ConnectionManager::updateLoadProgress( Int progress )
22222222
22232223void ConnectionManager::loadProgressComplete ()
22242224{
2225- NetCommandMsg *msg = newInstance (NetCommandMsg );
2225+ NetLoadCompleteCommandMsg *msg = newInstance (NetLoadCompleteCommandMsg );
22262226 msg->setPlayerID ( m_localSlot );
22272227 if (DoesCommandRequireACommandID (msg->getNetCommandType ()) == TRUE ) {
22282228 msg->setID (GenerateNextCommandID ());
22292229 }
2230- msg->setNetCommandType (NETCOMMANDTYPE_LOADCOMPLETE);
22312230 processLoadComplete (msg);
22322231 sendLocalCommand (msg, 0xff ^ (1 << m_localSlot));
22332232
@@ -2236,9 +2235,8 @@ void ConnectionManager::loadProgressComplete()
22362235
22372236void ConnectionManager::sendTimeOutGameStart ()
22382237{
2239- NetCommandMsg *msg = newInstance (NetCommandMsg );
2238+ NetTimeOutGameStartCommandMsg *msg = newInstance (NetTimeOutGameStartCommandMsg );
22402239 msg->setPlayerID ( m_localSlot );
2241- msg->setNetCommandType (NETCOMMANDTYPE_TIMEOUTSTART);
22422240 if (DoesCommandRequireACommandID (msg->getNetCommandType ()) == TRUE ) {
22432241 msg->setID (GenerateNextCommandID ());
22442242 }
Original file line number Diff line number Diff line change @@ -1254,3 +1254,25 @@ size_t NetFrameResendRequestCommandMsg::getPackedByteCount() const {
12541254 return sizeof (NetPacketFrameResendRequestCommand);
12551255}
12561256
1257+ // -------------------------
1258+ // NetLoadCompleteCommandMsg
1259+ // -------------------------
1260+ NetLoadCompleteCommandMsg::NetLoadCompleteCommandMsg () : NetCommandMsg() {
1261+ m_commandType = NETCOMMANDTYPE_LOADCOMPLETE;
1262+ }
1263+
1264+ size_t NetLoadCompleteCommandMsg::getPackedByteCount () const {
1265+ return sizeof (NetPacketLoadCompleteMessage);
1266+ }
1267+
1268+ // -------------------------
1269+ // NetTimeOutGameStartCommandMsg
1270+ // -------------------------
1271+ NetTimeOutGameStartCommandMsg::NetTimeOutGameStartCommandMsg () : NetCommandMsg() {
1272+ m_commandType = NETCOMMANDTYPE_TIMEOUTSTART;
1273+ }
1274+
1275+ size_t NetTimeOutGameStartCommandMsg::getPackedByteCount () const {
1276+ return sizeof (NetPacketTimeOutGameStartMessage);
1277+ }
1278+
Original file line number Diff line number Diff line change @@ -278,18 +278,8 @@ UnsignedInt NetPacket::GetBufferSizeNeededForCommand(NetCommandMsg *msg) {
278278 if (msg == NULL ) {
279279 return TRUE ; // There was nothing to add, so it was successful.
280280 }
281- // Handle special cases that don't have corresponding command message classes
282- switch (msg->getNetCommandType ())
283- {
284- case NETCOMMANDTYPE_LOADCOMPLETE:
285- return sizeof (NetPacketLoadCompleteMessage);
286- case NETCOMMANDTYPE_TIMEOUTSTART:
287- return sizeof (NetPacketTimeOutGameStartMessage);
288- default :
289- return msg->getPackedByteCount ();
290- }
291-
292- return 0 ;
281+ // Use the virtual function for all command message types
282+ return msg->getPackedByteCount ();
293283}
294284
295285
You can’t perform that action at this time.
0 commit comments