Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/game/StarUniverseServer.cpp2
-rw-r--r--source/game/StarWorldServer.cpp5
-rw-r--r--source/game/StarWorldServer.hpp3
-rw-r--r--source/game/StarWorldServerThread.cpp4
-rw-r--r--source/game/StarWorldServerThread.hpp2
5 files changed, 9 insertions, 7 deletions
diff --git a/source/game/StarUniverseServer.cpp b/source/game/StarUniverseServer.cpp
index 2bc2c45..43e67c0 100644
--- a/source/game/StarUniverseServer.cpp
+++ b/source/game/StarUniverseServer.cpp
@@ -835,7 +835,7 @@ void UniverseServer::warpPlayers() {
// Checking the spawn target validity then adding the client is not
// perfect, it can still become invalid in between, if we fail at
// adding the client we need to warp them back.
- if (toWorld && toWorld->addClient(clientId, warpToWorld.target, !clientContext->remoteAddress())) {
+ if (toWorld && toWorld->addClient(clientId, warpToWorld.target, !clientContext->remoteAddress(), clientContext->canBecomeAdmin())) {
clientContext->setPlayerWorld(toWorld);
m_chatProcessor->joinChannel(clientId, printWorldId(warpToWorld.world));
diff --git a/source/game/StarWorldServer.cpp b/source/game/StarWorldServer.cpp
index bf7e030..dca6f10 100644
--- a/source/game/StarWorldServer.cpp
+++ b/source/game/StarWorldServer.cpp
@@ -209,7 +209,7 @@ bool WorldServer::spawnTargetValid(SpawnTarget const& spawnTarget) const {
return true;
}
-bool WorldServer::addClient(ConnectionId clientId, SpawnTarget const& spawnTarget, bool isLocal) {
+bool WorldServer::addClient(ConnectionId clientId, SpawnTarget const& spawnTarget, bool isLocal, bool isAdmin) {
if (m_clientInfo.contains(clientId))
return false;
@@ -245,6 +245,7 @@ bool WorldServer::addClient(ConnectionId clientId, SpawnTarget const& spawnTarge
auto& clientInfo = m_clientInfo.add(clientId, make_shared<ClientInfo>(clientId, tracker));
clientInfo->local = isLocal;
+ clientInfo->admin = isAdmin;
auto worldStartPacket = make_shared<WorldStartPacket>();
auto& templateData = worldStartPacket->templateData = m_worldTemplate->store();
@@ -2387,7 +2388,7 @@ bool WorldServer::isVisibleToPlayer(RectF const& region) const {
}
WorldServer::ClientInfo::ClientInfo(ConnectionId clientId, InterpolationTracker const trackerInit)
- : clientId(clientId), skyNetVersion(0), weatherNetVersion(0), pendingForward(false), started(false), interpolationTracker(trackerInit) {}
+ : clientId(clientId), skyNetVersion(0), weatherNetVersion(0), pendingForward(false), started(false), local(false), admin(false), interpolationTracker(trackerInit) {}
List<RectI> WorldServer::ClientInfo::monitoringRegions(EntityMapPtr const& entityMap) const {
return clientState.monitoringRegions([entityMap](EntityId entityId) -> Maybe<RectI> {
diff --git a/source/game/StarWorldServer.hpp b/source/game/StarWorldServer.hpp
index 21b9b48..9e319e5 100644
--- a/source/game/StarWorldServer.hpp
+++ b/source/game/StarWorldServer.hpp
@@ -87,7 +87,7 @@ public:
// Returns false if the client id already exists, or the spawn target is
// invalid.
- bool addClient(ConnectionId clientId, SpawnTarget const& spawnTarget, bool isLocal);
+ bool addClient(ConnectionId clientId, SpawnTarget const& spawnTarget, bool isLocal, bool isAdmin = false);
// Removes client, sends the WorldStopPacket, and returns any pending packets
// for that client
@@ -277,6 +277,7 @@ private:
bool pendingForward;
bool started;
bool local;
+ bool admin;
List<PacketPtr> outgoingPackets;
diff --git a/source/game/StarWorldServerThread.cpp b/source/game/StarWorldServerThread.cpp
index 5d126ab..1e1f51a 100644
--- a/source/game/StarWorldServerThread.cpp
+++ b/source/game/StarWorldServerThread.cpp
@@ -66,10 +66,10 @@ bool WorldServerThread::spawnTargetValid(SpawnTarget const& spawnTarget) {
}
}
-bool WorldServerThread::addClient(ConnectionId clientId, SpawnTarget const& spawnTarget, bool isLocal) {
+bool WorldServerThread::addClient(ConnectionId clientId, SpawnTarget const& spawnTarget, bool isLocal, bool isAdmin) {
try {
RecursiveMutexLocker locker(m_mutex);
- if (m_worldServer->addClient(clientId, spawnTarget, isLocal)) {
+ if (m_worldServer->addClient(clientId, spawnTarget, isLocal, isAdmin)) {
m_clients.add(clientId);
return true;
}
diff --git a/source/game/StarWorldServerThread.hpp b/source/game/StarWorldServerThread.hpp
index 265d0aa..ae1e666 100644
--- a/source/game/StarWorldServerThread.hpp
+++ b/source/game/StarWorldServerThread.hpp
@@ -38,7 +38,7 @@ public:
bool spawnTargetValid(SpawnTarget const& spawnTarget);
- bool addClient(ConnectionId clientId, SpawnTarget const& spawnTarget, bool isLocal);
+ bool addClient(ConnectionId clientId, SpawnTarget const& spawnTarget, bool isLocal, bool isAdmin = false);
// Returns final outgoing packets
List<PacketPtr> removeClient(ConnectionId clientId);