-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathghost_server.patch
33 lines (30 loc) · 1.52 KB
/
ghost_server.patch
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
diff --git a/GhostServer/networkmanager.cpp b/GhostServer/networkmanager.cpp
index b47f794..c18da6f 100644
--- a/GhostServer/networkmanager.cpp
+++ b/GhostServer/networkmanager.cpp
@@ -144,7 +144,7 @@ bool NetworkManager::StartServer(const int port)
this->serverThread = std::thread(&NetworkManager::RunServer, this);
this->serverThread.detach();
- GHOST_LOG("Server started on " + this->serverIP.toString() + " (public IP: " + sf::IpAddress::getPublicAddress().toString() + ") on port " + std::to_string(this->serverPort));
+ GHOST_LOG("Server started on " + this->serverIP.toString() + " on port " + std::to_string(this->serverPort));
return true;
}
@@ -173,7 +173,7 @@ void NetworkManager::DisconnectPlayer(Client& c, const char *reason)
int id = 0;
int toErase = -1;
for (; id < this->clients.size(); ++id) {
- if (this->clients[id].IP != c.IP) {
+ if (this->clients[id].ID != c.ID) {
this->clients[id].tcpSocket->send(packet);
} else {
GHOST_LOG("Player " + this->clients[id].name + " has disconnected! Reason: " + reason);
@@ -212,10 +212,6 @@ void NetworkManager::StartCountdown(const std::string preCommands, const std::st
bool NetworkManager::ShouldBlockConnection(const sf::IpAddress& ip)
{
- if (std::find_if(this->clients.begin(), this->clients.end(), [&ip](const Client& c) { return ip == c.IP; }) != this->clients.end()) {
- return true;
- }
-
for (auto banned : this->bannedIps) {
if (ip == banned) return true;
}