@@ -728,9 +728,8 @@ scene::IBillboardSceneNode* GenericCAO::getSpriteSceneNode()
728
728
729
729
void GenericCAO::setChildrenVisible (bool toset)
730
730
{
731
- for (std::vector<u16>::iterator ci = m_children.begin ();
732
- ci != m_children.end (); ci++) {
733
- GenericCAO *obj = m_env->getGenericCAO (*ci);
731
+ for (std::vector<u16>::size_type i = 0 ; i < m_children.size (); i++) {
732
+ GenericCAO *obj = m_env->getGenericCAO (m_children[i]);
734
733
if (obj) {
735
734
obj->setVisible (toset);
736
735
}
@@ -760,11 +759,10 @@ void GenericCAO::removeFromScene(bool permanent)
760
759
// Should be true when removing the object permanently and false when refreshing (eg: updating visuals)
761
760
if ((m_env != NULL ) && (permanent))
762
761
{
763
- for (std::vector<u16>::iterator ci = m_children.begin ();
764
- ci != m_children.end (); ci++)
765
- {
766
- if (m_env->attachement_parent_ids [*ci] == getId ()) {
767
- m_env->attachement_parent_ids [*ci] = 0 ;
762
+ for (std::vector<u16>::size_type i = 0 ; i < m_children.size (); i++) {
763
+ u16 ci = m_children[i];
764
+ if (m_env->attachement_parent_ids [ci] == getId ()) {
765
+ m_env->attachement_parent_ids [ci] = 0 ;
768
766
}
769
767
}
770
768
@@ -1127,11 +1125,9 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
1127
1125
addToScene (m_smgr, m_gamedef->tsrc (), m_irr);
1128
1126
1129
1127
// Attachments, part 2: Now that the parent has been refreshed, put its attachments back
1130
- for (std::vector<u16>::iterator ci = m_children.begin ();
1131
- ci != m_children.end (); ci++)
1132
- {
1128
+ for (std::vector<u16>::size_type i = 0 ; i < m_children.size (); i++) {
1133
1129
// Get the object of the child
1134
- ClientActiveObject *obj = m_env->getActiveObject (*ci );
1130
+ ClientActiveObject *obj = m_env->getActiveObject (m_children[i] );
1135
1131
if (obj)
1136
1132
obj->setAttachments ();
1137
1133
}
@@ -1670,6 +1666,11 @@ void GenericCAO::processMessage(const std::string &data)
1670
1666
updateBonePosition ();
1671
1667
} else if (cmd == GENERIC_CMD_ATTACH_TO) {
1672
1668
u16 parentID = readS16 (is);
1669
+ u16 oldparent = m_env->attachement_parent_ids [getId ()];
1670
+ if (oldparent) {
Has a conversation. Original line has a conversation.
1671
+ m_children.erase (std::remove (m_children.begin (), m_children.end (),
1672
+ getId ()), m_children.end ());
1673
+ }
1673
1674
m_env->attachement_parent_ids [getId ()] = parentID;
1674
1675
GenericCAO *parentobj = m_env->getGenericCAO (parentID);
1675
1676