8#include <Atlas/Objects/Entity.h>
11using Atlas::Message::MapType;
13namespace Atlas {
namespace Objects {
namespace Entity {
15Allocator<AdminEntityData> AdminEntityData::allocator;
33 return copyInstance<AdminEntityData>(*
this);
38 if(ADMIN_ENTITY_NO == classNo)
return true;
42void AdminEntityData::fillDefaultObjectInstance(
AdminEntityData& data, std::map<std::string, uint32_t>& attr_data)
58const std::string USERNAME_ATTR =
"username";
59const std::string PASSWORD_ATTR =
"password";
60const std::string CHARACTERS_ATTR =
"characters";
64 if (allocator.attr_flags_Data.find(name) != allocator.attr_flags_Data.end()) {
72 auto I = allocator.attr_flags_Data.find(name);
73 if (I != allocator.attr_flags_Data.end()) {
82 if (name == USERNAME_ATTR) { attr =
getUsername();
return 0; }
83 if (name == PASSWORD_ATTR) { attr =
getPassword();
return 0; }
98 if (name == USERNAME_ATTR)
99 { m_attrFlags &= ~USERNAME_FLAG;
return;}
100 if (name == PASSWORD_ATTR)
101 { m_attrFlags &= ~PASSWORD_FLAG;
return;}
102 if (name == CHARACTERS_ATTR)
103 { m_attrFlags &= ~CHARACTERS_FLAG;
return;}
109 if(m_attrFlags & USERNAME_FLAG) {
116 if(m_attrFlags & PASSWORD_FLAG) {
123 if(m_attrFlags & CHARACTERS_FLAG) {
124 b.mapListItem(CHARACTERS_ATTR);
126 b.listStringItem(item);
143 if(m_attrFlags & USERNAME_FLAG)
145 if(m_attrFlags & PASSWORD_FLAG)
147 if(m_attrFlags & CHARACTERS_FLAG)
157 allocator.free(
this);
169 return copyInstance<AccountData>(*
this);
174 if(ACCOUNT_NO == classNo)
return true;
178void AccountData::fillDefaultObjectInstance(
AccountData& data, std::map<std::string, uint32_t>& attr_data)
192 attr_data[USERNAME_ATTR] = USERNAME_FLAG;
193 attr_data[PASSWORD_ATTR] = PASSWORD_FLAG;
194 attr_data[CHARACTERS_ATTR] = CHARACTERS_FLAG;
203 allocator.free(
this);
215 return copyInstance<PlayerData>(*
this);
220 if(PLAYER_NO == classNo)
return true;
224void PlayerData::fillDefaultObjectInstance(
PlayerData& data, std::map<std::string, uint32_t>& attr_data)
246 allocator.free(
this);
258 return copyInstance<AdminData>(*
this);
263 if(ADMIN_NO == classNo)
return true;
267void AdminData::fillDefaultObjectInstance(
AdminData& data, std::map<std::string, uint32_t>& attr_data)
289 allocator.free(
this);
301 return copyInstance<GameData>(*
this);
306 if(GAME_NO == classNo)
return true;
310void GameData::fillDefaultObjectInstance(
GameData& data, std::map<std::string, uint32_t>& attr_data)
332 allocator.free(
this);
344 return copyInstance<GameEntityData>(*
this);
349 if(GAME_ENTITY_NO == classNo)
return true;
353void GameEntityData::fillDefaultObjectInstance(
GameEntityData& data, std::map<std::string, uint32_t>& attr_data)
StringType && moveString()
bool getAttrFlag(const std::string &name, uint32_t &flag) const override
Find the flag for the attribute "name".
const std::string & getPassword() const
Retrieve the "password" attribute.
void sendUsername(Atlas::Bridge &) const
Send the "username" attribute to an Atlas::Bridge.
void free() override
Free an instance of this class, returning it to the memory pool.
void sendCharacters(Atlas::Bridge &) const
Send the "characters" attribute to an Atlas::Bridge.
void addToMessage(Atlas::Message::MapType &) const override
Write this object to an existing Element.
void setCharactersAsList(const Atlas::Message::ListType &val)
Set the "characters" attribute AsList.
void reset() override
Resets the object as it's returned to the pool.
int getAttrClass(const std::string &name) const override
Find the class which contains the attribute "name".
Atlas::Message::ListType getCharactersAsList() const
Retrieve the "characters" attribute AsList.
void removeAttr(const std::string &name) override
Remove the attribute "name". This will not work for static attributes.
std::string attr_password
Password for account usually.
std::string attr_username
Username for account usually.
int copyAttr(const std::string &name, Atlas::Message::Element &attr) const override
std::vector< std::string > attr_characters
List of characters account can control.
void setUsername(std::string val)
Set the "username" attribute.
bool instanceOf(int classNo) const override
Is this instance of some class?
void sendContents(Atlas::Bridge &b) const override
Send the contents of this object to a Bridge.
const std::string & getUsername() const
Retrieve the "username" attribute.
void setPassword(std::string val)
Set the "password" attribute.
void setAttr(std::string name, Atlas::Message::Element attr, const Atlas::Objects::Factories *factories=nullptr) override
Set the attribute "name" to the value given by"attr".
void sendPassword(Atlas::Bridge &) const
Send the "password" attribute to an Atlas::Bridge.
AccountData * copy() const override
Copy this object.
void free() override
Free an instance of this class, returning it to the memory pool.
void reset() override
Resets the object as it's returned to the pool.
AdminData * copy() const override
Copy this object.
bool instanceOf(int classNo) const override
Is this instance of some class?
All classes and objects used for administrative purposes.
void reset() override
Resets the object as it's returned to the pool.
void free() override
Free an instance of this class, returning it to the memory pool.
AdminEntityData * copy() const override
Copy this object.
bool instanceOf(int classNo) const override
Is this instance of some class?
bool instanceOf(int classNo) const override
Is this instance of some class?
GameData * copy() const override
Copy this object.
void reset() override
Resets the object as it's returned to the pool.
void free() override
Free an instance of this class, returning it to the memory pool.
All In Game classes and objects.
void reset() override
Resets the object as it's returned to the pool.
GameEntityData * copy() const override
Copy this object.
bool instanceOf(int classNo) const override
Is this instance of some class?
void free() override
Free an instance of this class, returning it to the memory pool.
void free() override
Free an instance of this class, returning it to the memory pool.
bool instanceOf(int classNo) const override
Is this instance of some class?
void reset() override
Resets the object as it's returned to the pool.
PlayerData * copy() const override
Copy this object.
void reset() override
Resets the object as it's returned to the pool.
void addToMessage(Atlas::Message::MapType &) const override
Write this object to an existing Element.
bool instanceOf(int classNo) const override
Is this instance of some class?
bool getAttrFlag(const std::string &name, uint32_t &flag) const override
Find the flag for the attribute "name".
int copyAttr(const std::string &name, Atlas::Message::Element &attr) const override
void setAttr(std::string name, Atlas::Message::Element attr, const Atlas::Objects::Factories *factories=nullptr) override
Set the attribute "name" to the value given by"attr".
void sendContents(Atlas::Bridge &b) const override
Send the contents of this object to a Bridge.
int getAttrClass(const std::string &name) const override
Find the class which contains the attribute "name".
std::vector< double > attr_pos
Position coordinates, usually world is 3D.
void removeAttr(const std::string &name) override
Remove the attribute "name". This will not work for static attributes.
double attr_stamp_contains
Last time any object that uses this as reference recursively has been modified.
std::vector< double > attr_velocity
Velocity object is moving, usually world is 3D.
std::string attr_objtype
What kind of object this is.
std::string attr_parent
The object this inherits attributes from.
double attr_stamp
Last time this object was modified.