summaryrefslogtreecommitdiff
path: root/src/content_cao.cpp
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-06-20 03:20:06 +0200
committerest31 <MTest31@outlook.com>2015-06-20 03:37:30 +0200
commitdd91b3d6fbc3a0b4b18b36b14864d703213dd622 (patch)
tree0c73f02ef3357f9557694d489a42df424fab51fc /src/content_cao.cpp
parent40226e52747156cbdc5128a416480b226e498fff (diff)
downloadminetest-dd91b3d6fbc3a0b4b18b36b14864d703213dd622.tar.gz
minetest-dd91b3d6fbc3a0b4b18b36b14864d703213dd622.tar.bz2
minetest-dd91b3d6fbc3a0b4b18b36b14864d703213dd622.zip
Generic CAO cleanups and renames for clarification
* Use enum for GENERIC_CMD_* * Rename m_attachements to attachement_parent_ids (public member and clearer name) * Rename GENERIC_CMD_SET_ATTACHMENT to GENERIC_CMD_ATTACH_TO * USHRT_MAX + 1 buffer sizes to prevent overflows as @kahrl suggested * Remove unneccessary m_id from GenericCAO (shadowing protected superclass member for no reason) as @kahrl suggested
Diffstat (limited to 'src/content_cao.cpp')
-rw-r--r--src/content_cao.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/content_cao.cpp b/src/content_cao.cpp
index 4f1336d28..d82af9e57 100644
--- a/src/content_cao.cpp
+++ b/src/content_cao.cpp
@@ -543,7 +543,6 @@ GenericCAO::GenericCAO(IGameDef *gamedef, ClientEnvironment *env):
//
m_is_player(false),
m_is_local_player(false),
- m_id(0),
//
m_smgr(NULL),
m_irr(NULL),
@@ -747,7 +746,7 @@ ClientActiveObject* GenericCAO::getParent()
{
ClientActiveObject *obj = NULL;
- u16 attached_id = m_env->m_attachements[getId()];
+ u16 attached_id = m_env->attachement_parent_ids[getId()];
if ((attached_id != 0) &&
(attached_id != getId())) {
@@ -764,12 +763,12 @@ void GenericCAO::removeFromScene(bool permanent)
for(std::vector<u16>::iterator ci = m_children.begin();
ci != m_children.end(); ci++)
{
- if (m_env->m_attachements[*ci] == getId()) {
- m_env->m_attachements[*ci] = 0;
+ if (m_env->attachement_parent_ids[*ci] == getId()) {
+ m_env->attachement_parent_ids[*ci] = 0;
}
}
- m_env->m_attachements[getId()] = 0;
+ m_env->attachement_parent_ids[getId()] = 0;
LocalPlayer* player = m_env->getLocalPlayer();
if (this == player->parent) {
@@ -1111,7 +1110,7 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
for(std::vector<u16>::iterator ci = m_children.begin();
ci != m_children.end();)
{
- if (m_env->m_attachements[*ci] != getId()) {
+ if (m_env->attachement_parent_ids[*ci] != getId()) {
ci = m_children.erase(ci);
continue;
}
@@ -1669,9 +1668,9 @@ void GenericCAO::processMessage(const std::string &data)
m_bone_position[bone] = core::vector2d<v3f>(position, rotation);
updateBonePosition();
- } else if (cmd == GENERIC_CMD_SET_ATTACHMENT) {
+ } else if (cmd == GENERIC_CMD_ATTACH_TO) {
u16 parentID = readS16(is);
- m_env->m_attachements[getId()] = parentID;
+ m_env->attachement_parent_ids[getId()] = parentID;
GenericCAO *parentobj = m_env->getGenericCAO(parentID);
if (parentobj) {