Permalink
Browse files

Now sending less UpdateContainment messages.

  • Loading branch information...
1 parent 77dd915 commit 59c32cf64ab27829ff350bc9f45496d2835177d2 @rcythr rcythr committed Mar 18, 2013
Showing with 14 additions and 10 deletions.
  1. +13 −9 src/swganh_core/object/object.cc
  2. +1 −1 src/swganh_core/object/object.h
@@ -840,25 +840,29 @@ void Object::SendCreateByCrc(std::shared_ptr<swganh::observer::ObserverInterface
scene_object.byte_flag = 0;
observer->Notify(&scene_object);
- SendUpdateContainmentMessage(observer);
+ SendUpdateContainmentMessage(observer, false);
}
-void Object::SendUpdateContainmentMessage(std::shared_ptr<swganh::observer::ObserverInterface> observer)
+void Object::SendUpdateContainmentMessage(std::shared_ptr<swganh::observer::ObserverInterface> observer, bool send_on_no_parent)
{
if(observer == nullptr)
return;
uint64_t container_id = 0;
if (GetContainer())
+ {
container_id = GetContainer()->GetObjectId();
+ }
- //DLOG(info) << "CONTAINMENT " << GetObjectId() << " INTO " << container_id << " ARRANGEMENT " << arrangement_id_;
-
- UpdateContainmentMessage containment_message;
- containment_message.container_id = container_id;
- containment_message.object_id = GetObjectId();
- containment_message.containment_type = arrangement_id_;
- observer->Notify(&containment_message);
+ if(send_on_no_parent || container_id != 0)
+ {
+ //DLOG(info) << "CONTAINMENT " << GetObjectId() << " INTO " << container_id << " ARRANGEMENT " << arrangement_id_;
+ UpdateContainmentMessage containment_message;
+ containment_message.container_id = container_id;
+ containment_message.object_id = GetObjectId();
+ containment_message.containment_type = arrangement_id_;
+ observer->Notify(&containment_message);
+ }
}
void Object::SendDestroy(std::shared_ptr<swganh::observer::ObserverInterface> observer)
@@ -482,7 +482,7 @@ class Object :
/**
* @brief sends the update containment message for the given observer of this object
*/
- virtual void SendUpdateContainmentMessage(std::shared_ptr<swganh::observer::ObserverInterface> observer);
+ virtual void SendUpdateContainmentMessage(std::shared_ptr<swganh::observer::ObserverInterface> observer, bool send_on_no_parent=true);
/**
* @brief sends the destroy message for the given observer of this object
*/

0 comments on commit 59c32cf

Please sign in to comment.