Update StarUniverseServer.cpp

This commit is contained in:
Kae 2024-03-27 17:09:20 +11:00
parent d53c3ae0e7
commit d76d217901

View File

@ -657,8 +657,9 @@ void UniverseServer::updateShips() {
if (auto shipWorld = getWorld(ClientShipWorldId(p.second->playerUuid()))) { if (auto shipWorld = getWorld(ClientShipWorldId(p.second->playerUuid()))) {
shipWorld->executeAction([&](WorldServerThread*, WorldServer* shipWorld) { shipWorld->executeAction([&](WorldServerThread*, WorldServer* shipWorld) {
String species; String species;
if (auto jSpecies = shipWorld->getProperty("ship.species").optString()) Json jSpecies = shipWorld->getProperty("ship.species");
species = *jSpecies; if (jSpecies.isType(Json::Type::String))
species = jSpecies.toString();
else else
shipWorld->setProperty("ship.species", species = p.second->playerSpecies()); shipWorld->setProperty("ship.species", species = p.second->playerSpecies());