MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / loadPlayer

Method loadPlayer

source/game/StarPlayerStorage.cpp:197–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197PlayerPtr PlayerStorage::loadPlayer(Uuid const& uuid) {
198 auto playerCacheData = getPlayerData(uuid);
199 auto entityFactory = Root::singleton().entityFactory();
200 try {
201 auto player = convert<Player>(entityFactory->diskLoadEntity(EntityType::Player, playerCacheData));
202 if (player->uuid() != uuid)
203 throw PlayerException(strf("Uuid mismatch in loaded player with filename uuid '{}'", uuid.hex()));
204 return player;
205 } catch (std::exception const& e) {
206 Logger::error("Error loading player file, ignoring! {}", outputException(e, false));
207 RecursiveMutexLocker locker(m_mutex);
208 m_savedPlayersCache.remove(uuid);
209 return {};
210 }
211}
212
213void PlayerStorage::deletePlayer(Uuid const& uuid) {
214 RecursiveMutexLocker locker(m_mutex);

Callers 3

changeStateMethod · 0.80
selectCharacterMethod · 0.80
updateCharacterPlatesMethod · 0.80

Calls 9

singletonClass · 0.85
strfFunction · 0.85
errorFunction · 0.85
entityFactoryMethod · 0.80
diskLoadEntityMethod · 0.80
hexMethod · 0.80
outputExceptionFunction · 0.50
uuidMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected