25 #ifndef __I6ENGINE_API_GAMEOBJECT_H__
26 #define __I6ENGINE_API_GAMEOBJECT_H__
40 #include "boost/function.hpp"
51 typedef utils::weakPtr<GameObject>
WeakGOPtr;
52 typedef utils::sharedPtr<Component, Component>
ComPtr;
79 GameObject(
const int64_t goid,
const core::IPKey & ownerNode, uint64_t uuid,
const std::string & tpl,
const boost::function<
ComPtr(
const int64_t,
const std::string &,
const attributeMap &,
const WeakGOPtr &)> & f);
100 ComPtr getGOC(uint32_t famID)
const;
109 ComPtr getGOC(uint32_t famID,
const std::string & identifier)
const;
129 ComPtr getGOCID(
const int64_t
id)
const;
134 std::vector<ComPtr> getGOCList()
const;
142 void setGOC(
const ComPtr & objNewGOC);
157 inline std::string
getType()
const {
return _type; }
162 void setType(
const std::string & type);
168 void deleteGOC(uint32_t famID);
175 void deleteGOC(uint32_t famID,
const std::string & identifier);
180 void sendCreateMessage()
const;
186 void synchronize(std::vector<GameMessage::Ptr> & messages,
bool all)
const;
191 void sendDeleteMessage()
const;
208 void initializeComponents();
224 void setFlags(
const std::vector<std::string> & flags) {
254 component_table_t _objComponents;
256 std::string _template;
261 std::map<std::string, GameMessage::Ptr> _messages;
270 boost::function<ComPtr(const int64_t, const std::string &, const attributeMap &, const WeakGOPtr &)> _componentFunc;
274 std::vector<std::string> _flags;
284 if (it == _objComponents.
end()) {
296 if (it == _objComponents.
end()) {
300 if (it->second->getIdentifier() != identifier) {
301 for (ComPtr & c : it->second->_subComps) {
302 if (c->getIdentifier() == identifier) {
316 for (
const std::pair<int64_t, ComPtr> & com : _objComponents) {
329 for (
const std::pair<int64_t, ComPtr> & com : _objComponents) {
332 for (ComPtr & c : co->_subComps) {
333 if (c->getIdentifier() == identifier) {
std::string getType() const
Returns the type of the GameObject.
GameObject()
Constructor for GameObject. Sets the _objGoid with an ID given by GuidServer. The GameObject register...
void setFlags(const std::vector< std::string > &flags)
stores the flags for which this GO is visible
std::list< std::pair< KeyType, ValueType > >::iterator find(const KeyType &key)
returns iterator to found entry for key, otherwise end()
#define ISIXE_MODULES_API
void setSelf(const WeakGOPtr &self)
boost::shared_ptr< Message > Ptr
void setSend(bool send)
stores whether this object has to be synchronized or not
std::map< std::string, std::string > attributeMap
utils::weakPtr< GameObject > WeakGOPtr
std::vector< std::string > getFlags() const
utils::sequence_map< int64_t, ComPtr > component_table_t
std::list< std::pair< int64_t, ComPtr > >::const_iterator const_iterator
#define ASSERT_THREAD_SAFETY_HEADER
A shared pointer counting references and adds objects being not referenced any more to an internal li...
core::IPKey getOwner() const
returns the owner of this gameObject
int64_t getID() const
Returns the GUID of the GameObject.
uint64_t getUUID() const
returns the uuid of this GO
std::list< std::pair< KeyType, ValueType > >::iterator end()
returns iterator to the end of the list
sharedPtr< T1, U > dynamic_pointer_cast(const sharedPtr< T2, U > &)
casts a sharedPtr of dynamic type T2 to dynamic type T1
utils::sharedPtr< T, api::Component > getGOC() const
utils::sharedPtr< Component, Component > ComPtr
Class representing a GameObject in the i6engine.
std::pair< int64_t, ComPtr > component_table_pair_t