From b620b9b2393a6414a05e65a6684b63dc46ee51f1 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Fri, 30 Aug 2024 17:27:40 +0400 Subject: [PATCH] Do not make redundant copies --- apps/openmw/mwlua/types/door.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwlua/types/door.cpp b/apps/openmw/mwlua/types/door.cpp index 6759a1b4d2..eedecadd46 100644 --- a/apps/openmw/mwlua/types/door.cpp +++ b/apps/openmw/mwlua/types/door.cpp @@ -47,18 +47,18 @@ namespace MWLua { "Closing", MWWorld::DoorState::Closing }, })); door["getDoorState"] = [](const Object& o) -> MWWorld::DoorState { - auto door = doorPtr(o); + const MWWorld::Ptr& door = doorPtr(o); return door.getClass().getDoorState(door); }; door["isOpen"] = [](const Object& o) { - auto door = doorPtr(o); + const MWWorld::Ptr& door = doorPtr(o); bool doorIsIdle = door.getClass().getDoorState(door) == MWWorld::DoorState::Idle; bool doorIsOpen = door.getRefData().getPosition().rot[2] != door.getCellRef().getPosition().rot[2]; return doorIsIdle && doorIsOpen; }; door["isClosed"] = [](const Object& o) { - auto door = doorPtr(o); + const MWWorld::Ptr& door = doorPtr(o); bool doorIsIdle = door.getClass().getDoorState(door) == MWWorld::DoorState::Idle; bool doorIsOpen = door.getRefData().getPosition().rot[2] != door.getCellRef().getPosition().rot[2]; @@ -70,7 +70,7 @@ namespace MWLua if (!allowChanges) throw std::runtime_error("Can only be used in global scripts or in local scripts on self."); - auto door = doorPtr(o); + const MWWorld::Ptr& door = doorPtr(o); auto world = MWBase::Environment::get().getWorld(); if (!openState.has_value())