@@ -83,6 +83,7 @@ static Bool s_inQM = FALSE;
8383#include " ../NGMPGame.h"
8484extern NGMPGame* TheNGMPGame;
8585#endif
86+ #include " ../OnlineServices_MatchmakingInterface.h"
8687
8788// PRIVATE DATA ///////////////////////////////////////////////////////////////////////////////////
8889// window ids ------------------------------------------------------------------------------
@@ -572,6 +573,7 @@ void PopulateQMLadderComboBox( void )
572573
573574static void populateQuickMatchMapSelectListbox ( QuickMatchPreferences& pref )
574575{
576+ // TODO_QUICKMATCH
575577 // std::list<AsciiString> maps = TheGameSpyConfig->getQMMaps();
576578 std::list<AsciiString> maps;
577579 maps.push_back (AsciiString (" Maps\\ Homeland Alliance\\ Homeland Alliance.map" ));
@@ -1645,6 +1647,19 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms
16451647
16461648 if ( controlID == buttonStopID )
16471649 {
1650+ #if defined(GENERALS_ONLINE)
1651+ buttonWiden->winEnable (FALSE );
1652+ buttonStart->winEnable (TRUE );
1653+ buttonStart->winHide (FALSE );
1654+ buttonStop->winHide (TRUE );
1655+ enableOptionsGadgets (TRUE );
1656+
1657+ Int index = GadgetListBoxAddEntryText (quickmatchTextWindow, TheGameText->fetch (" GUI:QMAborted" ), GameSpyColor[GSCOLOR_DEFAULT ], -1 , -1 );
1658+ GadgetListBoxSetItemData (quickmatchTextWindow, (void *)-1 , index);
1659+
1660+ NGMP_OnlineServices_MatchmakingInterface* pMatchmakingInterface = NGMP_OnlineServicesManager::GetInstance ()->GetMatchmakingInterface ();
1661+ pMatchmakingInterface->CancelMatchmaking ();
1662+ #else
16481663 PeerRequest req;
16491664 req.peerRequestType = PeerRequest::PEERREQUEST_STOPQUICKMATCH ;
16501665 TheGameSpyPeerMessageQueue->addRequest (req);
@@ -1653,6 +1668,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms
16531668 buttonStop->winHide ( TRUE );
16541669 enableOptionsGadgets (TRUE );
16551670 TheGameSpyInfo->addText (TheGameText->fetch (" GUI:QMAborted" ), GameSpyColor[GSCOLOR_DEFAULT ], quickmatchTextWindow);
1671+ #endif
16561672 }
16571673 else if ( controlID == buttonOptionsID )
16581674 {
@@ -1679,6 +1695,56 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms
16791695 }
16801696 else if ( controlID == buttonStartID )
16811697 {
1698+ #if defined(GENERALS_ONLINE)
1699+
1700+ // TODO_QUICKMATCH: Support map list
1701+ /*
1702+ Int numMaps = GadgetListBoxGetNumEntries(listboxMapSelect);
1703+ for ( Int i=0; i<numMaps; ++i )
1704+ {
1705+ req.qmMaps.push_back(GadgetListBoxGetItemData(listboxMapSelect, i, 0));
1706+ }
1707+ */
1708+
1709+ int numPlayersIndex = 0 ;
1710+ GadgetComboBoxGetSelectedPos (comboBoxNumPlayers, &numPlayersIndex);
1711+ if (numPlayersIndex < 0 )
1712+ {
1713+ numPlayersIndex = 0 ;
1714+ }
1715+
1716+ // buttons
1717+ buttonWiden->winEnable (FALSE );
1718+ buttonStart->winEnable (FALSE );
1719+ buttonStop->winHide (TRUE );
1720+
1721+ NGMP_OnlineServices_MatchmakingInterface* pMatchmakingInterface = NGMP_OnlineServicesManager::GetInstance ()->GetMatchmakingInterface ();
1722+ pMatchmakingInterface->StartMatchmaking (numPlayersIndex, [](bool bSuccess)
1723+ {
1724+ // TODO_QUICKMATCH: Chat has a sound effect in TheGameSpyInfo, re-eanble it
1725+ if (bSuccess)
1726+ {
1727+ Int index = GadgetListBoxAddEntryText (quickmatchTextWindow, UnicodeString (L" Started matchmaking... searching for players" ), GameSpyColor[GSCOLOR_DEFAULT ], -1 , -1 );
1728+ GadgetListBoxSetItemData (quickmatchTextWindow, (void *)-1 , index);
1729+
1730+ // buttons
1731+ buttonWiden->winEnable (FALSE );
1732+ buttonStart->winHide (TRUE );
1733+ buttonStop->winHide (FALSE );
1734+ }
1735+ else
1736+ {
1737+ Int index = GadgetListBoxAddEntryText (quickmatchTextWindow, UnicodeString (L" Failed to start matchmaking." ), GameSpyColor[GSCOLOR_DEFAULT ], -1 , -1 );
1738+ GadgetListBoxSetItemData (quickmatchTextWindow, (void *)-1 , index);
1739+
1740+ // buttons
1741+ buttonWiden->winEnable (FALSE );
1742+ buttonStart->winHide (FALSE );
1743+ buttonStart->winEnable (TRUE );
1744+ buttonStop->winHide (TRUE );
1745+ }
1746+ });
1747+ #else
16821748 PeerRequest req;
16831749 req.peerRequestType = PeerRequest::PEERREQUEST_STARTQUICKMATCH ;
16841750 req.qmMaps .clear ();
@@ -1853,6 +1919,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms
18531919 ladPref.addRecentLadder ( p );
18541920 ladPref.write ();
18551921 }
1922+ #endif
18561923 }
18571924 else if ( controlID == buttonBuddiesID )
18581925 {
0 commit comments