Skip to content

Commit 58f0a3f

Browse files
NGMPGame: Implement NGMPGame and NGMPGameSlot classes
1 parent bae4229 commit 58f0a3f

4 files changed

Lines changed: 179 additions & 1 deletion

File tree

GeneralsMD/Code/GameEngine/Source/GameNetwork/GeneralsOnline/NGMPGame.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
#include "GameLogic/VictoryConditions.h"
33
#include "Common/PlayerList.h"
44
#include "GameLogic/GameLogic.h"
5+
// Initialize slot pointers first to ensure they're valid
6+
cleanUpSlotPointers();
7+
8+
59
#include "GameNetwork/FileTransfer.h"
610
#include "GameClient/MapUtil.h"
711
#include "GameClient/GameText.h"
@@ -542,4 +546,4 @@ void NGMPGame::StartCountdown()
542546
{
543547
pWS->SendData_CountdownStarted();
544548
}
545-
}
549+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#include "GameNetwork/GeneralsOnline/NGMPGame.h"
2+
#include "GameLogic/VictoryConditions.h"
3+
#include "Common/PlayerList.h"
4+
#include "GameLogic/GameLogic.h"
5+
#include "GameNetwork/FileTransfer.h"
6+
#include "GameClient/MapUtil.h"
7+
#include "GameClient/GameText.h"
8+
#include "GameNetwork/GameSpyOverlay.h"
9+
#include "Common/RandomValue.h"
10+
#include "GameNetwork/GeneralsOnline/NGMP_interfaces.h"
11+
#include "GameNetwork/NetworkInterface.h"
12+
#include "Common/GlobalData.h"
13+
#include "GameClient/View.h"
14+
15+
NGMPGameSlot::NGMPGameSlot()
16+
{
17+
GameSlot();
18+
m_profileID = 0;
19+
m_wins = 0;
20+
m_losses = 0;
21+
m_rankPoints = 0;
22+
m_favoriteSide = 0;
23+
m_pingInt = 0;
24+
m_profileID = 0;
25+
m_pingStr.clear();
26+
}
27+
28+
// NGMPGame ----------------------------------------
29+
30+
NGMPGame::NGMPGame()
31+
{
32+
// Initialize slot pointers first to ensure they're valid
33+
cleanUpSlotPointers();
34+
35+
NGMP_OnlineServices_LobbyInterface* pLobbyInterface = NGMP_OnlineServicesManager::GetInterface<NGMP_OnlineServices_LobbyInterface>();
36+
if (pLobbyInterface == nullptr)
37+
{
38+
// Ensure m_inGame is set to false even if we return early
39+
m_inGame = false;
40+
return;
41+
}
42+
43+
setLocalIP(0);
44+
45+
m_ladderIP.clear();
46+
m_ladderPort = 0;
47+
48+
enterGame(); // this is done on join in the GS impl, and must be called before setMap
49+
50+
// NGMP: Store map
51+
setMap(pLobbyInterface->GetCurrentLobbyMapPath());
52+
53+
// init
54+
//init();
55+
56+
// NGMP: Populate slots
57+
UpdateSlotsFromCurrentLobby();
58+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#include "GameNetwork/GeneralsOnline/NGMPGame.h"
2+
#include "GameLogic/VictoryConditions.h"
3+
#include "Common/PlayerList.h"
4+
#include "GameLogic/GameLogic.h"
5+
#include "GameNetwork/FileTransfer.h"
6+
#include "GameClient/MapUtil.h"
7+
#include "GameClient/GameText.h"
8+
#include "GameNetwork/GameSpyOverlay.h"
9+
#include "Common/RandomValue.h"
10+
#include "GameNetwork/GeneralsOnline/NGMP_interfaces.h"
11+
#include "GameNetwork/NetworkInterface.h"
12+
#include "Common/GlobalData.h"
13+
#include "GameClient/View.h"
14+
15+
NGMPGameSlot::NGMPGameSlot()
16+
{
17+
GameSlot();
18+
m_profileID = 0;
19+
m_wins = 0;
20+
m_losses = 0;
21+
m_rankPoints = 0;
22+
m_favoriteSide = 0;
23+
m_pingInt = 0;
24+
m_profileID = 0;
25+
m_pingStr.clear();
26+
}
27+
28+
// NGMPGame ----------------------------------------
29+
30+
NGMPGame::NGMPGame()
31+
{
32+
// Initialize slot pointers first to ensure they're valid
33+
cleanUpSlotPointers();
34+
35+
NGMP_OnlineServices_LobbyInterface* pLobbyInterface = NGMP_OnlineServicesManager::GetInterface<NGMP_OnlineServices_LobbyInterface>();
36+
if (pLobbyInterface == nullptr)
37+
{
38+
// Ensure m_inGame is set to false even if we return early
39+
m_inGame = false;
40+
return;
41+
}
42+
43+
setLocalIP(0);
44+
45+
m_ladderIP.clear();
46+
m_ladderPort = 0;
47+
48+
enterGame(); // this is done on join in the GS impl, and must be called before setMap
49+
50+
// NGMP: Store map
51+
setMap(pLobbyInterface->GetCurrentLobbyMapPath());
52+
53+
// init
54+
//init();
55+
56+
// NGMP: Populate slots
57+
UpdateSlotsFromCurrentLobby();
58+
}

tmp/test_ngmp.cpp

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#include "GameNetwork/GeneralsOnline/NGMPGame.h"
2+
#include "GameLogic/VictoryConditions.h"
3+
#include "Common/PlayerList.h"
4+
#include "GameLogic/GameLogic.h"
5+
#include "GameNetwork/FileTransfer.h"
6+
#include "GameClient/MapUtil.h"
7+
#include "GameClient/GameText.h"
8+
#include "GameNetwork/GameSpyOverlay.h"
9+
#include "Common/RandomValue.h"
10+
#include "GameNetwork/GeneralsOnline/NGMP_interfaces.h"
11+
#include "GameNetwork/NetworkInterface.h"
12+
#include "Common/GlobalData.h"
13+
#include "GameClient/View.h"
14+
15+
NGMPGameSlot::NGMPGameSlot()
16+
{
17+
GameSlot();
18+
m_profileID = 0;
19+
m_wins = 0;
20+
m_losses = 0;
21+
m_rankPoints = 0;
22+
m_favoriteSide = 0;
23+
m_pingInt = 0;
24+
m_profileID = 0;
25+
m_pingStr.clear();
26+
}
27+
28+
// NGMPGame ----------------------------------------
29+
30+
NGMPGame::NGMPGame()
31+
{
32+
// Initialize slot pointers first to ensure they're valid
33+
cleanUpSlotPointers();
34+
35+
NGMP_OnlineServices_LobbyInterface* pLobbyInterface = NGMP_OnlineServicesManager::GetInterface<NGMP_OnlineServices_LobbyInterface>();
36+
if (pLobbyInterface == nullptr)
37+
{
38+
// Ensure m_inGame is set to false even if we return early
39+
m_inGame = false;
40+
return;
41+
}
42+
43+
setLocalIP(0);
44+
45+
m_ladderIP.clear();
46+
m_ladderPort = 0;
47+
48+
enterGame(); // this is done on join in the GS impl, and must be called before setMap
49+
50+
// NGMP: Store map
51+
setMap(pLobbyInterface->GetCurrentLobbyMapPath());
52+
53+
// init
54+
//init();
55+
56+
// NGMP: Populate slots
57+
UpdateSlotsFromCurrentLobby();
58+
}

0 commit comments

Comments
 (0)