OpenAstra
 
Loading...
Searching...
No Matches
capability.h
1#ifndef GAMECAPABILITY_H
2#define GAMECAPABILITY_H
3
4#include <memory>
5
6#include "gameobject.h"
7
8#include "../utils/json.hpp"
9#include "../utils/dynamicloader.hpp"
10
11class Capability
12 : public GameObject
13{
14public:
15 static constexpr char capabilityCategory[] = "capability";
16 using undumpFactory = Capability*(*)(ObjectId id);
17 using createFactory = Capability*(*)(std::shared_ptr<GameObject> future_parent, const nlohmann::json& template_data);
18 using deleteFactory = void(*)( Capability* ptr );
19
20 static std::shared_ptr<Capability> createFromTemplate(std::shared_ptr<GameObject> owner,
21 const std::string& capability,
22 const nlohmann::json& template_data );
23 static std::shared_ptr<GameObject> createFromDump(ObjectId id,
24 const std::string& type );
25
26 Capability( ObjectId id, const std::string& type );
27
28 virtual ~Capability();
29
30private:
31 std::shared_ptr<DynamicLoader> _plugin_handle;
32};
33
34#endif // GAMECAPABILITY_H
GameObject(const std::string &category, ObjectId id, const std::string &type)
Create a GameObject object.
Definition gameobject.cpp:38
const std::string & type() const
return the type (ship_xxx, station_xxx, planet_xxx...)
Definition gameobject.h:213
Definition gameid.hpp:9