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

summaryrefslogtreecommitdiff
path: root/source/game/StarWorldServer.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-03 19:32:23 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-03 19:32:23 +1000
commitf73cb3ce03c35770605ce83a49906cc4825c00a6 (patch)
tree5f2d405596418e003da830cf05033b6b5110132b /source/game/StarWorldServer.cpp
parent0d266bebe12f01e0035619ef927430e0c1afaf98 (diff)
improve WorldServer debug logging
is now consistent with WorldServerThread's use of the world id, which is generally more appropriate
Diffstat (limited to 'source/game/StarWorldServer.cpp')
-rw-r--r--source/game/StarWorldServer.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/source/game/StarWorldServer.cpp b/source/game/StarWorldServer.cpp
index dffe057..ebd853a 100644
--- a/source/game/StarWorldServer.cpp
+++ b/source/game/StarWorldServer.cpp
@@ -40,6 +40,7 @@ WorldServer::WorldServer(WorldTemplatePtr const& worldTemplate, IODevicePtr stor
m_respawnInWorld = false;
m_tileProtectionEnabled = true;
m_universeSettings = make_shared<UniverseSettings>();
+ m_worldId = worldTemplate->worldName();
init(true);
writeMetadata();
@@ -52,6 +53,7 @@ WorldServer::WorldServer(IODevicePtr const& storage) {
m_worldStorage = make_shared<WorldStorage>(storage, make_shared<WorldGenerator>(this));
m_tileProtectionEnabled = true;
m_universeSettings = make_shared<UniverseSettings>();
+ m_worldId = "Nowhere";
readMetadata();
init(false);
@@ -61,6 +63,7 @@ WorldServer::WorldServer(WorldChunks const& chunks) {
m_worldStorage = make_shared<WorldStorage>(chunks, make_shared<WorldGenerator>(this));
m_tileProtectionEnabled = true;
m_universeSettings = make_shared<UniverseSettings>();
+ m_worldId = "Nowhere";
readMetadata();
init(false);
@@ -72,6 +75,14 @@ WorldServer::~WorldServer() {
m_worldStorage->unloadAll(true);
}
+void WorldServer::setWorldId(String worldId) {
+ m_worldId = move(worldId);
+}
+
+String const& WorldServer::worldId() const {
+ return m_worldId;
+}
+
void WorldServer::setUniverseSettings(UniverseSettingsPtr universeSettings) {
m_universeSettings = move(universeSettings);
}
@@ -616,12 +627,10 @@ void WorldServer::update() {
for (auto& pair : m_clientInfo)
pair.second->pendingForward = false;
- LogMap::set(strf("server_{}_entities", m_worldTemplate->worldSeed()), m_entityMap->size());
- LogMap::set(strf("server_{}_sectors", m_worldTemplate->worldSeed()), strf("{}", m_tileArray->loadedSectorCount()));
- LogMap::set(strf("server_{}_world_time", m_worldTemplate->worldSeed()), epochTime());
- LogMap::set(strf("server_{}_active_liquid", m_worldTemplate->worldSeed()), m_liquidEngine->activeCells());
- LogMap::set(strf("server_{}_day_time", m_worldTemplate->worldSeed()), timeOfDay() / dayLength());
- LogMap::set(strf("server_{}_lua_mem", m_worldTemplate->worldSeed()), m_luaRoot->luaMemoryUsage());
+ LogMap::set(strf("server_{}_entities", m_worldId), strf("{} in {} sectors", m_entityMap->size(), m_tileArray->loadedSectorCount()));
+ LogMap::set(strf("server_{}_time", m_worldId), strf("age = {:4.2f}, day = {:4.2f}/{:4.2f}s", epochTime(), timeOfDay(), dayLength()));
+ LogMap::set(strf("server_{}_active_liquid", m_worldId), m_liquidEngine->activeCells());
+ LogMap::set(strf("server_{}_lua_mem", m_worldId), m_luaRoot->luaMemoryUsage());
}
WorldGeometry WorldServer::geometry() const {