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

Consider RecastMeshManager not empty when there is water

This commit is contained in:
elsid 2021-07-17 13:32:57 +02:00
parent 24b802b3d8
commit fdee9db20c
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40
2 changed files with 15 additions and 1 deletions

View file

@ -323,4 +323,18 @@ namespace
for (int y = -6; y < 6; ++y)
ASSERT_EQ(manager.hasTile(TilePosition(x, y)), -1 <= x && x <= 0 && -1 <= y && y <= 0);
}
TEST_F(DetourNavigatorTileCachedRecastMeshManagerTest, remove_object_should_not_remove_tile_with_water)
{
TileCachedRecastMeshManager manager(mSettings);
const osg::Vec2i cellPosition(0, 0);
const int cellSize = 8192;
const btBoxShape boxShape(btVector3(20, 20, 100));
ASSERT_TRUE(manager.addObject(ObjectId(&boxShape), boxShape, btTransform::getIdentity(), AreaType::AreaType_ground));
ASSERT_TRUE(manager.addWater(cellPosition, cellSize, osg::Vec3f()));
ASSERT_TRUE(manager.removeObject(ObjectId(&boxShape)));
for (int x = -6; x < 6; ++x)
for (int y = -6; y < 6; ++y)
ASSERT_TRUE(manager.hasTile(TilePosition(x, y)));
}
}

View file

@ -84,7 +84,7 @@ namespace DetourNavigator
bool RecastMeshManager::isEmpty() const
{
return mObjects.empty();
return mObjects.empty() && mWater.empty();
}
void RecastMeshManager::reportNavMeshChange(const Version& recastMeshVersion, const Version& navMeshVersion)