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 Pugemon
parent f3f872c7a3
commit e9a5f18bc3
No known key found for this signature in database
GPG Key ID: 472FA343B3CC3287

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());
}