mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Replace boost::variant by std::variant
This commit is contained in:
parent
43057dbb68
commit
a46714df67
@ -16,7 +16,7 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
struct ScriptCreatingVisitor : public boost::static_visitor<ESM::GlobalScript>
|
||||
struct ScriptCreatingVisitor
|
||||
{
|
||||
ESM::GlobalScript operator()(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
@ -46,7 +46,7 @@ namespace
|
||||
}
|
||||
};
|
||||
|
||||
struct PtrGettingVisitor : public boost::static_visitor<const MWWorld::Ptr*>
|
||||
struct PtrGettingVisitor
|
||||
{
|
||||
const MWWorld::Ptr* operator()(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
@ -59,7 +59,7 @@ namespace
|
||||
}
|
||||
};
|
||||
|
||||
struct PtrResolvingVisitor : public boost::static_visitor<MWWorld::Ptr>
|
||||
struct PtrResolvingVisitor
|
||||
{
|
||||
MWWorld::Ptr operator()(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
@ -76,7 +76,7 @@ namespace
|
||||
}
|
||||
};
|
||||
|
||||
class MatchPtrVisitor : public boost::static_visitor<bool>
|
||||
class MatchPtrVisitor
|
||||
{
|
||||
const MWWorld::Ptr& mPtr;
|
||||
public:
|
||||
@ -93,7 +93,7 @@ namespace
|
||||
}
|
||||
};
|
||||
|
||||
struct IdGettingVisitor : public boost::static_visitor<std::string>
|
||||
struct IdGettingVisitor
|
||||
{
|
||||
std::string operator()(const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
@ -115,19 +115,19 @@ namespace MWScript
|
||||
|
||||
const MWWorld::Ptr* GlobalScriptDesc::getPtrIfPresent() const
|
||||
{
|
||||
return boost::apply_visitor(PtrGettingVisitor(), mTarget);
|
||||
return std::visit(PtrGettingVisitor(), mTarget);
|
||||
}
|
||||
|
||||
MWWorld::Ptr GlobalScriptDesc::getPtr()
|
||||
{
|
||||
MWWorld::Ptr ptr = boost::apply_visitor(PtrResolvingVisitor(), mTarget);
|
||||
MWWorld::Ptr ptr = std::visit(PtrResolvingVisitor {}, mTarget);
|
||||
mTarget = ptr;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
std::string GlobalScriptDesc::getId() const
|
||||
{
|
||||
return boost::apply_visitor(IdGettingVisitor(), mTarget);
|
||||
return std::visit(IdGettingVisitor {}, mTarget);
|
||||
}
|
||||
|
||||
|
||||
@ -239,7 +239,7 @@ namespace MWScript
|
||||
{
|
||||
for (const auto& iter : mScripts)
|
||||
{
|
||||
ESM::GlobalScript script = boost::apply_visitor (ScriptCreatingVisitor(), iter.second->mTarget);
|
||||
ESM::GlobalScript script = std::visit (ScriptCreatingVisitor {}, iter.second->mTarget);
|
||||
|
||||
script.mId = iter.first;
|
||||
|
||||
@ -338,7 +338,7 @@ namespace MWScript
|
||||
MatchPtrVisitor visitor(base);
|
||||
for (const auto& script : mScripts)
|
||||
{
|
||||
if (boost::apply_visitor (visitor, script.second->mTarget))
|
||||
if (std::visit (visitor, script.second->mTarget))
|
||||
script.second->mTarget = updated;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,11 @@
|
||||
#ifndef GAME_SCRIPT_GLOBALSCRIPTS_H
|
||||
#define GAME_SCRIPT_GLOBALSCRIPTS_H
|
||||
|
||||
#include <boost/variant/variant.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@ -37,7 +36,7 @@ namespace MWScript
|
||||
{
|
||||
bool mRunning;
|
||||
Locals mLocals;
|
||||
boost::variant<MWWorld::Ptr, std::pair<ESM::RefNum, std::string> > mTarget; // Used to start targeted script
|
||||
std::variant<MWWorld::Ptr, std::pair<ESM::RefNum, std::string>> mTarget; // Used to start targeted script
|
||||
|
||||
GlobalScriptDesc();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user