Merge remote-tracking branch 'origin/takeallhotkey' into takeallhotkey

This commit is contained in:
Jenya 2024-10-02 22:37:30 +03:00
commit 8f4b4d4f2e
2 changed files with 13 additions and 3 deletions

View File

@ -64,7 +64,7 @@ void SongbookInterface::refresh(bool reloadFiles) {
m_files = Root::singleton().assets()->scanExtension(".abc").values(); m_files = Root::singleton().assets()->scanExtension(".abc").values();
eraseWhere(m_files, [](String& song) { eraseWhere(m_files, [](String& song) {
if (!song.beginsWith(SongPathPrefix, String::CaseInsensitive)) { 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 true;
} }
return false; return false;

View File

@ -673,7 +673,6 @@ void UniverseServer::updateShips() {
Json jOldShipLevel = shipWorld->getProperty("ship.level"); Json jOldShipLevel = shipWorld->getProperty("ship.level");
unsigned newShipLevel = min<unsigned>(speciesShips.size() - 1, newShipUpgrades.shipLevel); unsigned newShipLevel = min<unsigned>(speciesShips.size() - 1, newShipUpgrades.shipLevel);
if (jOldShipLevel.isType(Json::Type::Int)) { if (jOldShipLevel.isType(Json::Type::Int)) {
auto oldShipLevel = jOldShipLevel.toUInt(); auto oldShipLevel = jOldShipLevel.toUInt();
if (oldShipLevel < newShipLevel) { if (oldShipLevel < newShipLevel) {
@ -2036,10 +2035,21 @@ Maybe<WorkerPoolPromise<WorldServerThreadPtr>> UniverseServer::shipWorldPromise(
shipWorld->setProperty("ship.maxFuel", currentUpgrades.maxFuel); shipWorld->setProperty("ship.maxFuel", currentUpgrades.maxFuel);
shipWorld->setProperty("ship.crewSize", currentUpgrades.crewSize); shipWorld->setProperty("ship.crewSize", currentUpgrades.crewSize);
shipWorld->setProperty("ship.fuelEfficiency", currentUpgrades.fuelEfficiency); shipWorld->setProperty("ship.fuelEfficiency", currentUpgrades.fuelEfficiency);
shipWorld->setProperty("ship.epoch", Time::timeSinceEpoch());
}
auto shipClock = make_shared<Clock>();
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->setUniverseSettings(m_universeSettings);
shipWorld->setReferenceClock(universeClock); shipWorld->setReferenceClock(shipClock);
shipClock->start();
if (auto systemWorld = clientContext->systemWorld()) if (auto systemWorld = clientContext->systemWorld())
shipWorld->setOrbitalSky(systemWorld->clientSkyParameters(clientContext->clientId())); shipWorld->setOrbitalSky(systemWorld->clientSkyParameters(clientContext->clientId()));