Connections and disconnections between client and server are functioning

This commit is contained in:
Kayne Ruse
2013-05-24 15:39:42 +10:00
parent 0b2af1d80f
commit 1ab963099d
10 changed files with 63 additions and 15 deletions
+9 -1
View File
@@ -8,16 +8,24 @@ using namespace std;
//Public access members
//-------------------------
InGame::InGame(ConfigUtility* cUtil, SurfaceManager* sMgr, UDPNetworkUtility* nUtil) {
InGame::InGame(ConfigUtility* cUtil, SurfaceManager* sMgr, UDPNetworkUtility* nUtil, int* ID) {
#ifdef DEBUG
cout << "entering InGame" << endl;
#endif
configUtil = cUtil;
surfaceMgr = sMgr;
netUtil = nUtil;
playerID = ID;
cout << "playerID: " << *playerID << endl;
}
InGame::~InGame() {
PacketData p;
p.type = PacketList::DISCONNECT;
p.disconnect.playerID = *playerID;
*playerID = -1;
netUtil->Send(0, &p, sizeof(PacketData));
netUtil->Unbind(0);
#ifdef DEBUG
cout << "leaving InGame" << endl;
#endif