1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 03:39:14 +00:00
OpenMW/apps/openmw/mwlua/engineevents.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

63 lines
1.3 KiB
C++
Raw Normal View History

#ifndef MWLUA_ENGINEEVENTS_H
#define MWLUA_ENGINEEVENTS_H
#include <variant>
#include <components/esm3/cellref.hpp> // defines RefNum that is used as a unique id
#include "../mwworld/cellstore.hpp"
namespace MWLua
{
class GlobalScripts;
class EngineEvents
{
public:
2023-03-25 17:14:33 +00:00
explicit EngineEvents(GlobalScripts& globalScripts)
: mGlobalScripts(globalScripts)
{
}
struct OnNewGame
{
};
struct OnActive
{
ESM::RefNum mObject;
};
struct OnInactive
{
ESM::RefNum mObject;
};
struct OnActivate
{
ESM::RefNum mActor;
ESM::RefNum mObject;
};
struct OnConsume
{
ESM::RefNum mActor;
ESM::RefNum mConsumable;
};
struct OnNewExterior
{
MWWorld::CellStore& mCell;
};
using Event = std::variant<OnNewGame, OnActive, OnInactive, OnConsume, OnActivate, OnNewExterior>;
void clear() { mQueue.clear(); }
void addToQueue(Event e) { mQueue.push_back(std::move(e)); }
void callEngineHandlers();
private:
class Visitor;
2023-03-25 17:14:33 +00:00
GlobalScripts& mGlobalScripts;
std::vector<Event> mQueue;
};
}
#endif // MWLUA_ENGINEEVENTS_H