|
|
| Player (const std::string &name, const std::string &race, const nlohmann::json &player_dataitems) |
| |
|
| Player (ObjectId id) |
| |
|
void | addShip (ObjectId ship_id) |
| |
|
void | setHomestead (ObjectId homestead_id) |
| |
| virtual void | _finalizeUndump () final |
| | Gives the object an opportunity to perform some cleanup/inizialization after the entire object has been deserialized from disk.
|
| |
| nlohmann::json | toJson () |
| | serialize the current object to JSON object
|
| |
| bool | writeToJsonFile () |
| | Write to the storage folder a file (see _create_filename() below) containing the object in JSON format.
|
| |
| DataItem & | addDataItem (const std::string &dataItem) |
| | Add a dataItem, and return a reference to it.
|
| |
| bool | hasDataItem (const std::string &dataItem) const |
| | Check if a specific data item exist.
|
| |
| DataItem & | accessDataItem (const std::string &dataItem) |
| | get a reference to the dataItem
|
| |
| const DataItem & | accessDataItem (const std::string &dataItem) const |
| | get a const reference to the dataItem
|
| |
| void | dataItemsFromTemplate (const nlohmann::json &template_data) |
| | Initialize a list of dataitems from a JSON template.
|
| |
| const std::string & | category () const |
| | return the object category (starsystemobject, module, command...)
|
| |
| const std::string & | type () const |
| | return the type (ship_xxx, station_xxx, planet_xxx...)
|
| |
| ObjectId | id () const |
| | return the object unique ID
|
| |
| void | reparent (std::shared_ptr< GameObject > new_parent) |
| | reparent from the current parent, to a new one
|
| |
|
void | lock () |
| |
|
void | unlock () |
| |
| std::shared_ptr< GameObject > | getParent () const |
| | return pointer to this object parent
|
| |
| template<typename T> |
| std::shared_ptr< T > | getParent () const |
| | return pointer to this object parent
|
| |
| std::shared_ptr< GameObject > | getSibling (ObjectId id) |
| | get sibling with given ID
|
| |
| template<typename T> |
| std::shared_ptr< T > | getSibling (ObjectId id) |
| | get sibling with given ID
|
| |
| std::shared_ptr< GameObject > | getChild (ObjectId id) |
| | return the child to match the id
|
| |
| template<typename T> |
| std::shared_ptr< T > | getChild (ObjectId id) |
| | return the child to match the id
|
| |
| bool | hasChild (ObjectId id) |
| | check if current object has a child with this id
|
| |
| std::map< ObjectId, std::shared_ptr< GameObject > > & | childrenMap () |
| | get a direct reference to the children map
|
| |
|
virtual void | tick (double, double) |
| |
|
|
static std::shared_ptr< GameObject > | createFromDump (ObjectId id, const std::string &type) |
| |
|
static std::shared_ptr< Player > | createFromTemplate (const std::string &name, const std::string &race) |
| |
| static bool | initialize (const std::string &storage_path) |
| | initialize the disk serialization process
|
| |
| static void | registerSubtype (const std::string &category, undumpFactory undumpCb) |
| | Static function that needs to be called for each derived class to create types autmatically while undumping from JSON.
|
| |
| template<typename T> |
| static std::shared_ptr< T > | createFromJsonFile (const std::string &category, ObjectId id) |
| | create a GameObject object from a JSON file
|
| |