diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-04-24 16:28:09 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-04-24 16:28:09 +1000 |
commit | f58702683fda7d9b6c26548b1cf7e2382f958893 (patch) | |
tree | 6b1041a480f7dc4d86a0f30fe04fbcb263963649 /source/game/StarWorldClient.cpp | |
parent | d0f8aec244a0d71f67863f94cab4c5f84d93de22 (diff) |
log EntityMessageResponse error instead of throwing
Diffstat (limited to 'source/game/StarWorldClient.cpp')
-rw-r--r-- | source/game/StarWorldClient.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/source/game/StarWorldClient.cpp b/source/game/StarWorldClient.cpp index 5f7e028..be5a56b 100644 --- a/source/game/StarWorldClient.cpp +++ b/source/game/StarWorldClient.cpp @@ -994,14 +994,14 @@ void WorldClient::handleIncomingPackets(List<PacketPtr> const& packets) { } else if (auto entityMessageResponsePacket = as<EntityMessageResponsePacket>(packet)) { if (!m_entityMessageResponses.contains(entityMessageResponsePacket->uuid)) - throw WorldClientException("EntityMessageResponse received for unknown context!"); - - auto response = m_entityMessageResponses.take(entityMessageResponsePacket->uuid); - if (entityMessageResponsePacket->response.isRight()) - response.fulfill(entityMessageResponsePacket->response.right()); - else - response.fail(entityMessageResponsePacket->response.left()); - + Logger::warn("EntityMessageResponse received for unknown context [{}]!", entityMessageResponsePacket->uuid.hex()); + else { + auto response = m_entityMessageResponses.take(entityMessageResponsePacket->uuid); + if (entityMessageResponsePacket->response.isRight()) + response.fulfill(entityMessageResponsePacket->response.right()); + else + response.fail(entityMessageResponsePacket->response.left()); + } } else if (auto updateWorldProperties = as<UpdateWorldPropertiesPacket>(packet)) { // Kae: Properties set to null (nil from Lua) should be erased instead of lingering around for (auto& pair : updateWorldProperties->updatedProperties) { @@ -1031,12 +1031,12 @@ void WorldClient::handleIncomingPackets(List<PacketPtr> const& packets) { m_outgoingPackets.append(make_shared<EntityInteractResultPacket>(interactResult.take(), entityInteract->requestId, entityInteract->interactRequest.sourceId)); } else if (auto interactResult = as<EntityInteractResultPacket>(packet)) { - auto response = m_entityInteractionResponses.take(interactResult->requestId); - if (interactResult->action) - response.fulfill(interactResult->action); - else - response.fail("no interaction result"); - + if (auto response = m_entityInteractionResponses.maybeTake(interactResult->requestId)) { + if (interactResult->action) + response->fulfill(interactResult->action); + else + response->fail("no interaction result"); + } } else if (auto setPlayerStart = as<SetPlayerStartPacket>(packet)) { m_playerStart = setPlayerStart->playerStart; m_respawnInWorld = setPlayerStart->respawnInWorld; |