Merge branch 'span' into 'master'

Replace Misc::Span by std::span

See merge request OpenMW/openmw!2324
crashfix_debugdraw
psi29a 2 years ago
commit 1f5277349c

@ -8,10 +8,10 @@
#include <set> #include <set>
#include <string_view> #include <string_view>
#include <deque> #include <deque>
#include <span>
#include <components/esm3/cellid.hpp> #include <components/esm3/cellid.hpp>
#include <components/misc/rng.hpp> #include <components/misc/rng.hpp>
#include <components/misc/span.hpp>
#include <osg/Timer> #include <osg/Timer>
@ -661,7 +661,7 @@ namespace MWBase
virtual bool hasCollisionWithDoor(const MWWorld::ConstPtr& door, const osg::Vec3f& position, const osg::Vec3f& destination) const = 0; virtual bool hasCollisionWithDoor(const MWWorld::ConstPtr& door, const osg::Vec3f& position, const osg::Vec3f& destination) const = 0;
virtual bool isAreaOccupiedByOtherActor(const osg::Vec3f& position, const float radius, virtual bool isAreaOccupiedByOtherActor(const osg::Vec3f& position, const float radius,
const Misc::Span<const MWWorld::ConstPtr>& ignore, std::vector<MWWorld::Ptr>* occupyingActors = nullptr) const = 0; std::span<const MWWorld::ConstPtr> ignore, std::vector<MWWorld::Ptr>* occupyingActors = nullptr) const = 0;
virtual void reportStats(unsigned int frameNumber, osg::Stats& stats) const = 0; virtual void reportStats(unsigned int frameNumber, osg::Stats& stats) const = 0;

@ -903,7 +903,7 @@ namespace MWPhysics
} }
bool PhysicsSystem::isAreaOccupiedByOtherActor(const osg::Vec3f& position, const float radius, bool PhysicsSystem::isAreaOccupiedByOtherActor(const osg::Vec3f& position, const float radius,
const Misc::Span<const MWWorld::ConstPtr>& ignore, std::vector<MWWorld::Ptr>* occupyingActors) const std::span<const MWWorld::ConstPtr> ignore, std::vector<MWWorld::Ptr>* occupyingActors) const
{ {
std::vector<const btCollisionObject*> ignoredObjects; std::vector<const btCollisionObject*> ignoredObjects;
ignoredObjects.reserve(ignore.size()); ignoredObjects.reserve(ignore.size());

@ -10,13 +10,13 @@
#include <variant> #include <variant>
#include <optional> #include <optional>
#include <functional> #include <functional>
#include <span>
#include <osg/Quat> #include <osg/Quat>
#include <osg/BoundingBox> #include <osg/BoundingBox>
#include <osg/ref_ptr> #include <osg/ref_ptr>
#include <osg/Timer> #include <osg/Timer>
#include <components/misc/span.hpp>
#include <components/detournavigator/collisionshapetype.hpp> #include <components/detournavigator/collisionshapetype.hpp>
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
@ -280,7 +280,7 @@ namespace MWPhysics
} }
bool isAreaOccupiedByOtherActor(const osg::Vec3f& position, const float radius, bool isAreaOccupiedByOtherActor(const osg::Vec3f& position, const float radius,
const Misc::Span<const MWWorld::ConstPtr>& ignore, std::vector<MWWorld::Ptr>* occupyingActors) const; std::span<const MWWorld::ConstPtr> ignore, std::vector<MWWorld::Ptr>* occupyingActors) const;
void reportStats(unsigned int frameNumber, osg::Stats& stats) const; void reportStats(unsigned int frameNumber, osg::Stats& stats) const;
void reportCollision(const btVector3& position, const btVector3& normal); void reportCollision(const btVector3& position, const btVector3& normal);

@ -3979,7 +3979,7 @@ namespace MWWorld
} }
bool World::isAreaOccupiedByOtherActor(const osg::Vec3f& position, const float radius, bool World::isAreaOccupiedByOtherActor(const osg::Vec3f& position, const float radius,
const Misc::Span<const MWWorld::ConstPtr>& ignore, std::vector<MWWorld::Ptr>* occupyingActors) const std::span<const MWWorld::ConstPtr> ignore, std::vector<MWWorld::Ptr>* occupyingActors) const
{ {
return mPhysics->isAreaOccupiedByOtherActor(position, radius, ignore, occupyingActors); return mPhysics->isAreaOccupiedByOtherActor(position, radius, ignore, occupyingActors);
} }

@ -749,7 +749,7 @@ namespace MWWorld
bool hasCollisionWithDoor(const MWWorld::ConstPtr& door, const osg::Vec3f& position, const osg::Vec3f& destination) const override; bool hasCollisionWithDoor(const MWWorld::ConstPtr& door, const osg::Vec3f& position, const osg::Vec3f& destination) const override;
bool isAreaOccupiedByOtherActor(const osg::Vec3f& position, const float radius, bool isAreaOccupiedByOtherActor(const osg::Vec3f& position, const float radius,
const Misc::Span<const MWWorld::ConstPtr>& ignore, std::vector<MWWorld::Ptr>* occupyingActors) const override; std::span<const MWWorld::ConstPtr> ignore, std::vector<MWWorld::Ptr>* occupyingActors) const override;
void reportStats(unsigned int frameNumber, osg::Stats& stats) const override; void reportStats(unsigned int frameNumber, osg::Stats& stats) const override;

@ -1,36 +0,0 @@
#ifndef OPENMW_COMPONENTS_MISC_SPAN_H
#define OPENMW_COMPONENTS_MISC_SPAN_H
#include <cstddef>
namespace Misc
{
template <class T>
class Span
{
public:
constexpr Span() = default;
constexpr Span(T* pointer, std::size_t size)
: mPointer(pointer)
, mSize(size)
{}
template <class Range>
constexpr Span(Range& range)
: Span(range.data(), range.size())
{}
constexpr T* begin() const { return mPointer; }
constexpr T* end() const { return mPointer + mSize; }
constexpr std::size_t size() const { return mSize; }
private:
T* mPointer = nullptr;
std::size_t mSize = 0;
};
}
#endif
Loading…
Cancel
Save