Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
Object Class Reference

Represents generic object in the game world. More...

#include <Object.hpp>

Inheritance diagram for Object:
Inheritance graph
Collaboration diagram for Object:
Collaboration graph

Public Member Functions

 Object (int id, std::string instanceId, std::string name, Coordinates coordinates, unsigned int rotation, reader::ObjectType objectType)
 
 Object (const GeneralObjectStruct &object, const ObjectLocation &location, reader::ObjectType objectType)
 
virtual ~Object ()=default
 
const int & getId ()
 Get the id of the object. More...
 
const std::string & getInstanceId ()
 Get the instance id of the object. More...
 
const std::string & getName ()
 Get the name of the object. More...
 
const CoordinatesgetLocation ()
 Get the location of the object. More...
 
const unsigned int & getRotation ()
 Get the rotation of the object. More...
 
const reader::ObjectTypegetObjectType ()
 Get the ObjectType of object. More...
 
virtual bool canInteract (Entity &entity)
 Check if the object can be interacted with by a entity. There might be several reason for not being able to interact with an object (inventory full, not enought xp etc. ) More...
 
virtual void interact (Entity &entity)
 Interact with the object. More...
 

Private Attributes

int idM
 Unique id for object type (For example, tree, rock, etc) More...
 
std::string instanceIdM
 Unique id for object instance (For example, tree 1, tree at 2 etc) More...
 
std::string nameM
 
Coordinates coordinatesM
 
unsigned int rotationM
 
reader::ObjectType objectTypeM
 

Detailed Description

Represents generic object in the game world.

Constructor & Destructor Documentation

◆ Object() [1/2]

Object::Object ( int  id,
std::string  instanceId,
std::string  name,
Coordinates  coordinates,
unsigned int  rotation,
reader::ObjectType  objectType 
)

◆ Object() [2/2]

Object::Object ( const GeneralObjectStruct object,
const ObjectLocation location,
reader::ObjectType  objectType 
)

◆ ~Object()

virtual Object::~Object ( )
virtualdefault

Member Function Documentation

◆ canInteract()

virtual bool Object::canInteract ( Entity entity)
inlinevirtual

Check if the object can be interacted with by a entity. There might be several reason for not being able to interact with an object (inventory full, not enought xp etc. )

Parameters
entitythat interacts with the object.
Returns
true if the object can be interacted with.

Reimplemented in ResourceObject, and LootObject.

◆ getId()

const int & Object::getId ( )

Get the id of the object.

Returns
const int&

◆ getInstanceId()

const std::string & Object::getInstanceId ( )

Get the instance id of the object.

Returns
const std::string&

◆ getLocation()

const Coordinates & Object::getLocation ( )

Get the location of the object.

Returns
const Coordinates&

◆ getName()

const std::string & Object::getName ( )

Get the name of the object.

Returns
const std::string&
Here is the caller graph for this function:

◆ getObjectType()

const reader::ObjectType & Object::getObjectType ( )

Get the ObjectType of object.

Returns
const reader::ObjectType&

◆ getRotation()

const unsigned int & Object::getRotation ( )

Get the rotation of the object.

Returns
const unsigned int&

◆ interact()

virtual void Object::interact ( Entity entity)
inlinevirtual

Interact with the object.

Parameters
entitythat interacts with the object.

Reimplemented in ResourceObject, and LootObject.

Member Data Documentation

◆ coordinatesM

Coordinates Object::coordinatesM
private

◆ idM

int Object::idM
private

Unique id for object type (For example, tree, rock, etc)

◆ instanceIdM

std::string Object::instanceIdM
private

Unique id for object instance (For example, tree 1, tree at 2 etc)

◆ nameM

std::string Object::nameM
private

◆ objectTypeM

reader::ObjectType Object::objectTypeM
private

◆ rotationM

unsigned int Object::rotationM
private

The documentation for this class was generated from the following files: