Skip to content

Commit

Permalink
tweak: added logging
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeBryssinck committed May 11, 2022
1 parent e977810 commit 31ffbf5
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Code/client/Services/Generic/ActorValueService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ void ActorValueService::OnHealthChange(const HealthChangeEvent& acEvent) noexcep

std::optional<uint32_t> serverIdRes = Utils::GetServerId(*hitteeIt);
if (!serverIdRes.has_value())
{
spdlog::error("{}: failed to find server id", __FUNCTION__);
return;
}

uint32_t serverId = serverIdRes.value();

Expand Down
15 changes: 15 additions & 0 deletions Code/client/Services/Generic/CharacterService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,10 @@ void CharacterService::OnLeaveBeastForm(const LeaveBeastFormEvent& acEvent) cons

std::optional<uint32_t> serverIdRes = Utils::GetServerId(*it);
if (!serverIdRes.has_value())
{
spdlog::error("{}: failed to find server id", __FUNCTION__);
return;
}

uint32_t serverId = serverIdRes.value();

Expand Down Expand Up @@ -833,7 +836,10 @@ void CharacterService::OnMountEvent(const MountEvent& acEvent) const noexcept

std::optional<uint32_t> riderServerIdRes = Utils::GetServerId(cRiderEntity);
if (!riderServerIdRes.has_value())
{
spdlog::error("{}: failed to find server id", __FUNCTION__);
return;
}

const auto mountIt = std::find_if(std::begin(view), std::end(view), [id = acEvent.MountID, view](auto entity) {
return view.get<FormIdComponent>(entity).Id == id;
Expand All @@ -849,7 +855,10 @@ void CharacterService::OnMountEvent(const MountEvent& acEvent) const noexcept

std::optional<uint32_t> mountServerIdRes = Utils::GetServerId(cMountEntity);
if (!mountServerIdRes.has_value())
{
spdlog::error("{}: failed to find server id", __FUNCTION__);
return;
}

if (m_world.try_get<RemoteComponent>(cMountEntity))
{
Expand Down Expand Up @@ -905,7 +914,10 @@ void CharacterService::OnNotifyMount(const NotifyMount& acMessage) const noexcep
{
std::optional<uint32_t> serverIdRes = Utils::GetServerId(entity);
if (!serverIdRes.has_value())
{
spdlog::error("{}: failed to find server id", __FUNCTION__);
continue;
}

uint32_t serverId = serverIdRes.value();

Expand Down Expand Up @@ -952,7 +964,10 @@ void CharacterService::OnInitPackageEvent(const InitPackageEvent& acEvent) const

std::optional<uint32_t> actorServerIdRes = Utils::GetServerId(cActorEntity);
if (!actorServerIdRes.has_value())
{
spdlog::error("{}: failed to find server id", __FUNCTION__);
return;
}

NewPackageRequest request;
request.ActorId = actorServerIdRes.value();
Expand Down
6 changes: 6 additions & 0 deletions Code/client/Services/Generic/InventoryService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ void InventoryService::OnInventoryChangeEvent(const InventoryChangeEvent& acEven

std::optional<uint32_t> serverIdRes = Utils::GetServerId(*iter);
if (!serverIdRes.has_value())
{
spdlog::error("{}: failed to find server id", __FUNCTION__);
return;
}

RequestInventoryChanges request;
request.ServerId = serverIdRes.value();
Expand Down Expand Up @@ -89,7 +92,10 @@ void InventoryService::OnEquipmentChangeEvent(const EquipmentChangeEvent& acEven

std::optional<uint32_t> serverIdRes = Utils::GetServerId(*iter);
if (!serverIdRes.has_value())
{
spdlog::error("{}: failed to find server id", __FUNCTION__);
return;
}

Actor* pActor = Cast<Actor>(TESForm::GetById(acEvent.ActorId));
if (!pActor)
Expand Down
13 changes: 11 additions & 2 deletions Code/client/Services/Generic/MagicService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ void MagicService::OnSpellCastEvent(const SpellCastEvent& acEvent) const noexcep
{
auto desiredTargetIdRes = Utils::GetServerId(*targetEntityIt);
if (desiredTargetIdRes.has_value())
{
request.DesiredTarget = desiredTargetIdRes.value();
}
else
spdlog::error("{}: failed to find server id", __FUNCTION__);
}
}

Expand Down Expand Up @@ -190,7 +190,10 @@ void MagicService::OnNotifySpellCast(const NotifySpellCast& acMessage) const noe
{
std::optional<uint32_t> serverIdRes = Utils::GetServerId(entity);
if (!serverIdRes.has_value())
{
spdlog::error("{}: failed to find server id", __FUNCTION__);
continue;
}

uint32_t serverId = serverIdRes.value();

Expand Down Expand Up @@ -314,7 +317,10 @@ void MagicService::OnAddTargetEvent(const AddTargetEvent& acEvent) noexcept

std::optional<uint32_t> serverIdRes = Utils::GetServerId(entity);
if (!serverIdRes.has_value())
{
spdlog::error("{}: failed to find server id", __FUNCTION__);
return;
}

request.TargetId = serverIdRes.value();
m_transport.Send(request);
Expand Down Expand Up @@ -419,7 +425,10 @@ void MagicService::ApplyQueuedEffects() noexcept

std::optional<uint32_t> serverIdRes = Utils::GetServerId(entity);
if (!serverIdRes.has_value())
{
spdlog::error("{}: failed to find server id", __FUNCTION__);
continue;
}

request.TargetId = serverIdRes.value();

Expand Down
3 changes: 0 additions & 3 deletions Code/client/Services/Generic/ObjectService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,7 @@ void ObjectService::OnActivate(const ActivateEvent& acEvent) noexcept

std::optional<uint32_t> serverIdRes = Utils::GetServerId(*pEntity);
if (!serverIdRes.has_value())
{
spdlog::error("Server id not found for form id {:X}", acEvent.pActivator->formID);
return;
}

request.ActivatorId = serverIdRes.value();

Expand Down

0 comments on commit 31ffbf5

Please sign in to comment.