Skip to content

Commit

Permalink
feat(Core/Scripting): added generic instance map script
Browse files Browse the repository at this point in the history
  • Loading branch information
Razor2142 committed Jan 22, 2025
1 parent 2490c9e commit 6e1368b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/server/game/Scripting/ScriptDefines/InstanceMapScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,19 @@ class InstanceMapScript : public ScriptObject, public MapScript<InstanceMap>
virtual InstanceScript* GetInstanceScript(InstanceMap* /*map*/) const { return nullptr; }
};

template<typename IS>
class InstanceMapGenericScript
: public InstanceMapScript
{
public:
InstanceMapGenericScript(const char* name, uint32 mapId) : InstanceMapScript(name, mapId) { }

InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
return new IS(map);
}
};

#define RegisterInstanceMapGenericScript(script, mapId) new InstanceMapGenericScript<script>(#script, mapId)

#endif

0 comments on commit 6e1368b

Please sign in to comment.