-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClientListener.cpp
64 lines (46 loc) · 1.65 KB
/
ClientListener.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "ClientListener.h"
#include "PlayerLoader.h"
#include "PlayerLoaderCallback.h"
#include "sdk/smsdk_ext.h"
#include "NavMeshLoader.h"
namespace War3Source {
ClientListener::ClientListener() {
}
ClientListener::~ClientListener() {
}
void ClientListener::OnClientPutInServer(int clientIndex) {
IGamePlayer *gamePlayer = playerhelpers->GetGamePlayer(clientIndex);
if(!gamePlayer->IsConnected() || !gamePlayer->IsAuthorized()) {
return;
}
if(gamePlayer->IsFakeClient()) {
// meep
return;
}
IPlayerLoaderCallback *playerLoaderCallback = new PlayerLoaderCallback();
IPlayerLoader *playerLoader = new PlayerLoader(gamePlayer->GetAuthString(), playerLoaderCallback);
playerLoader->LoadPlayer();
}
void ClientListener::OnClientDisconnecting(int clientIndex) {
}
void ClientListener::OnClientAuthorized(int clientIndex, const char *authString) {
IGamePlayer *gamePlayer = playerhelpers->GetGamePlayer(clientIndex);
if(!gamePlayer->IsConnected() || !gamePlayer->IsInGame()) {
return;
}
if(gamePlayer->IsFakeClient()) {
// meep
return;
}
IPlayerLoaderCallback *playerLoaderCallback = new PlayerLoaderCallback();
IPlayerLoader *playerLoader = new PlayerLoader(gamePlayer->GetAuthString(), playerLoaderCallback);
playerLoader->LoadPlayer();
}
void ClientListener::OnServerActivated(int maxClients) {
const char *currentMap = gamehelpers->GetCurrentMap();
META_CONPRINTF("Activated: %d %s\n", maxClients, currentMap);
NavMeshLoader *loader = new NavMeshLoader(currentMap);
char error[1024];
INavMesh *mesh = loader->Load(error, sizeof(error));
}
}