Skip to content

An OpenMW mod that lets you play the whole Elder Scrolls III: Morrowind as a top-down isometric game — with full online co-op or MMO modes.

C++
879 B
Raw Blame
#ifndef GAME_MWMECHANICS_TYPEDAIPACKAGE_H
#define GAME_MWMECHANICS_TYPEDAIPACKAGE_H

#include "aipackage.hpp"

namespace MWMechanics
{
    template <class T>
    struct TypedAiPackage : public AiPackage
    {
        TypedAiPackage()
            : AiPackage(T::getTypeId(), T::makeDefaultOptions())
        {
        }

        TypedAiPackage(bool repeat)
            : AiPackage(T::getTypeId(), T::makeDefaultOptions().withRepeat(repeat))
        {
        }

        TypedAiPackage(const Options& options)
            : AiPackage(T::getTypeId(), options)
        {
        }

        template <class Derived>
        TypedAiPackage(Derived*)
            : AiPackage(Derived::getTypeId(), Derived::makeDefaultOptions())
        {
        }

        std::unique_ptr<AiPackage> clone() const override { return std::make_unique<T>(*static_cast<const T*>(this)); }
    };
}

#endif