1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-26 02:41:34 +00:00

Support absence of player and other actors in physics system

This commit is contained in:
elsid 2023-02-08 02:28:59 +01:00
parent 76dfb1b1b4
commit 36b33cc1a5
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625

View file

@ -822,6 +822,7 @@ namespace MWPhysics
// copy new ptr position in temporary vector. player is handled separately as its movement might change active // copy new ptr position in temporary vector. player is handled separately as its movement might change active
// cell. // cell.
mActorsPositions.clear(); mActorsPositions.clear();
if (!mActors.empty())
mActorsPositions.reserve(mActors.size() - 1); mActorsPositions.reserve(mActors.size() - 1);
for (const auto& [ptr, physicActor] : mActors) for (const auto& [ptr, physicActor] : mActors)
{ {
@ -833,6 +834,7 @@ namespace MWPhysics
for (const auto& [ptr, pos] : mActorsPositions) for (const auto& [ptr, pos] : mActorsPositions)
world->moveObject(ptr, pos, false, false); world->moveObject(ptr, pos, false, false);
if (player != nullptr)
world->moveObject(player->getPtr(), player->getSimulationPosition(), false, false); world->moveObject(player->getPtr(), player->getSimulationPosition(), false, false);
} }