From 80192714b780a09291e00cd41152abef9c249859 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Wed, 2 Oct 2024 09:07:42 +1000 Subject: [PATCH 1/2] Update StarSongbookInterface.cpp --- source/frontend/StarSongbookInterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/frontend/StarSongbookInterface.cpp b/source/frontend/StarSongbookInterface.cpp index 0c5fa4a..fa9a7c4 100644 --- a/source/frontend/StarSongbookInterface.cpp +++ b/source/frontend/StarSongbookInterface.cpp @@ -64,7 +64,7 @@ void SongbookInterface::refresh(bool reloadFiles) { m_files = Root::singleton().assets()->scanExtension(".abc").values(); eraseWhere(m_files, [](String& song) { if (!song.beginsWith(SongPathPrefix, String::CaseInsensitive)) { - Logger::warn("Song '{}' isn't in {}, ignoring", SongPathPrefix.size(), song); + Logger::warn("Song '{}' isn't in {}, ignoring", song, SongPathPrefix); return true; } return false; From 25f3edbae301eae0fd87162527e12cbb2630b022 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:45:27 +1000 Subject: [PATCH 2/2] shipworlds: store their own epoch time for consistent plant growth --- source/game/StarUniverseServer.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/game/StarUniverseServer.cpp b/source/game/StarUniverseServer.cpp index 6961ce4..fa728fb 100644 --- a/source/game/StarUniverseServer.cpp +++ b/source/game/StarUniverseServer.cpp @@ -673,7 +673,6 @@ void UniverseServer::updateShips() { Json jOldShipLevel = shipWorld->getProperty("ship.level"); unsigned newShipLevel = min(speciesShips.size() - 1, newShipUpgrades.shipLevel); - if (jOldShipLevel.isType(Json::Type::Int)) { auto oldShipLevel = jOldShipLevel.toUInt(); if (oldShipLevel < newShipLevel) { @@ -2036,10 +2035,21 @@ Maybe> UniverseServer::shipWorldPromise( shipWorld->setProperty("ship.maxFuel", currentUpgrades.maxFuel); shipWorld->setProperty("ship.crewSize", currentUpgrades.crewSize); shipWorld->setProperty("ship.fuelEfficiency", currentUpgrades.fuelEfficiency); + shipWorld->setProperty("ship.epoch", Time::timeSinceEpoch()); + } + + auto shipClock = make_shared(); + auto shipTime = shipWorld->getProperty("ship.epoch"); + if (!shipTime.canConvert(Json::Type::Float)) { + auto now = Time::timeSinceEpoch(); + shipWorld->setProperty("ship.epoch", now); + } else { + shipClock->setTime(Time::timeSinceEpoch() - shipTime.toDouble()); } shipWorld->setUniverseSettings(m_universeSettings); - shipWorld->setReferenceClock(universeClock); + shipWorld->setReferenceClock(shipClock); + shipClock->start(); if (auto systemWorld = clientContext->systemWorld()) shipWorld->setOrbitalSky(systemWorld->clientSkyParameters(clientContext->clientId()));