fix: optimization: PVS-Studio warning V830

Replaced 'std::optional::value()' with '*' operator to improve performance.

Using 'std::optional::value()' involves additional overhead compared to using the '*' or '->' operators. This change ensures more efficient access to the underlying value of the optional when you are certain that it contains a value.

Reported by: PVS-Studio
Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
Vyacheslav Ivanov 2024-08-02 02:22:07 +03:00 committed by MihailRis
parent 8c5e5559ec
commit 3fa7fac4df

View File

@ -455,7 +455,7 @@ void PlayerController::updateEntityInteraction(entityid_t eid, bool lclick, bool
if (!entityOpt.has_value()) {
return;
}
auto entity = entityOpt.value();
auto entity = *entityOpt;
if (lclick) {
scripting::on_attacked(entity, player.get(), player->getEntity());
}