File tree Expand file tree Collapse file tree 4 files changed +52
-16
lines changed
Expand file tree Collapse file tree 4 files changed +52
-16
lines changed Original file line number Diff line number Diff line change @@ -565,3 +565,29 @@ class NetFrameResendRequestCommandMsg : public NetCommandMsg
565565protected:
566566 UnsignedInt m_frameToResend;
567567};
568+
569+ // -----------------------------------------------------------------------------
570+ /* *
571+ * The NetLoadCompleteCommandMsg is a simple command message for load complete notifications
572+ */
573+ class NetLoadCompleteCommandMsg : public NetCommandMsg
574+ {
575+ MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE (NetLoadCompleteCommandMsg, " NetLoadCompleteCommandMsg" )
576+ public:
577+ NetLoadCompleteCommandMsg ();
578+
579+ size_t getPackedByteCount () const ;
580+ };
581+
582+ // -----------------------------------------------------------------------------
583+ /* *
584+ * The NetTimeOutGameStartCommandMsg is a simple command message for timeout game start notifications
585+ */
586+ class NetTimeOutGameStartCommandMsg : public NetCommandMsg
587+ {
588+ MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE (NetTimeOutGameStartCommandMsg, " NetTimeOutGameStartCommandMsg" )
589+ public:
590+ NetTimeOutGameStartCommandMsg ();
591+
592+ size_t getPackedByteCount () const ;
593+ };
Original file line number Diff line number Diff line change @@ -2275,12 +2275,11 @@ void ConnectionManager::updateLoadProgress( Int progress )
22752275
22762276void ConnectionManager::loadProgressComplete ()
22772277{
2278- NetCommandMsg *msg = newInstance (NetCommandMsg );
2278+ NetLoadCompleteCommandMsg *msg = newInstance (NetLoadCompleteCommandMsg );
22792279 msg->setPlayerID ( m_localSlot );
22802280 if (DoesCommandRequireACommandID (msg->getNetCommandType ()) == TRUE ) {
22812281 msg->setID (GenerateNextCommandID ());
22822282 }
2283- msg->setNetCommandType (NETCOMMANDTYPE_LOADCOMPLETE);
22842283 processLoadComplete (msg);
22852284 sendLocalCommand (msg, 0xff ^ (1 << m_localSlot));
22862285
@@ -2289,9 +2288,8 @@ void ConnectionManager::loadProgressComplete()
22892288
22902289void ConnectionManager::sendTimeOutGameStart ()
22912290{
2292- NetCommandMsg *msg = newInstance (NetCommandMsg );
2291+ NetTimeOutGameStartCommandMsg *msg = newInstance (NetTimeOutGameStartCommandMsg );
22932292 msg->setPlayerID ( m_localSlot );
2294- msg->setNetCommandType (NETCOMMANDTYPE_TIMEOUTSTART);
22952293 if (DoesCommandRequireACommandID (msg->getNetCommandType ()) == TRUE ) {
22962294 msg->setID (GenerateNextCommandID ());
22972295 }
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