From 38f409e68775df0832ad89df9926f020bbcf0874 Mon Sep 17 00:00:00 2001 From: Petr Mikheev Date: Thu, 20 Jul 2023 02:13:55 +0200 Subject: [PATCH] Fix #7446: Incorrect height after teleporting from one worldspace to another --- apps/openmw/mwscript/cellextensions.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwscript/cellextensions.cpp b/apps/openmw/mwscript/cellextensions.cpp index 147b9a5d82..9ffc3f7bec 100644 --- a/apps/openmw/mwscript/cellextensions.cpp +++ b/apps/openmw/mwscript/cellextensions.cpp @@ -91,11 +91,12 @@ namespace MWScript ESM::Position pos; MWBase::World* world = MWBase::Environment::get().getWorld(); - const MWWorld::Ptr playerPtr = world->getPlayerPtr(); + MWWorld::Ptr playerPtr = world->getPlayerPtr(); if (const ESM::RefId refId = world->findExteriorPosition(cell, pos); !refId.empty()) { MWWorld::ActionTeleport(refId, pos, false).execute(playerPtr); + playerPtr = world->getPlayerPtr(); // could be changed by ActionTeleport world->adjustPosition(playerPtr, false); return; } @@ -121,7 +122,7 @@ namespace MWScript ESM::Position pos; MWBase::World* world = MWBase::Environment::get().getWorld(); - const MWWorld::Ptr playerPtr = world->getPlayerPtr(); + MWWorld::Ptr playerPtr = world->getPlayerPtr(); osg::Vec2 posFromIndex = ESM::indexToPosition(ESM::ExteriorCellLocation(x, y, ESM::Cell::sDefaultWorldspaceId), true); @@ -132,6 +133,7 @@ namespace MWScript pos.rot[0] = pos.rot[1] = pos.rot[2] = 0; MWWorld::ActionTeleport(ESM::RefId::esm3ExteriorCell(x, y), pos, false).execute(playerPtr); + playerPtr = world->getPlayerPtr(); // could be changed by ActionTeleport world->adjustPosition(playerPtr, false); } };