From: <wel...@us...> - 2012-01-13 21:23:03
|
Revision: 8000 http://planeshift.svn.sourceforge.net/planeshift/?rev=8000&view=rev Author: weltall2 Date: 2012-01-13 21:22:57 +0000 (Fri, 13 Jan 2012) Log Message: ----------- Reworked a bit the update of registered dools so the traits are correctly registered Modified Paths: -------------- trunk/src/client/pscelclient.cpp trunk/src/client/psclientchar.cpp Modified: trunk/src/client/pscelclient.cpp =================================================================== --- trunk/src/client/pscelclient.cpp 2012-01-13 21:22:48 UTC (rev 7999) +++ trunk/src/client/pscelclient.cpp 2012-01-13 21:22:57 UTC (rev 8000) @@ -71,6 +71,7 @@ #include "gui/pawslootwindow.h" #include "paws/pawsmanager.h" +#include "paws/pawsobjectview.h" //============================================================================= @@ -1776,6 +1777,32 @@ charApp->ApplyTraits(this->traits); charApp->ApplyEquipment(this->equipment); + + // Update any doll views registered for changes + csArray<iPAWSSubscriber*> dolls = PawsManager::GetSingleton().ListSubscribers("sigActorUpdate"); + for (size_t i=0; i<dolls.GetSize(); i++) + { + if (dolls[i] == NULL) + continue; + + pawsObjectView* doll = dynamic_cast<pawsObjectView*>(dolls[i]); + + if (doll == NULL) + continue; + + if (doll->GetID() == GetEID().Unbox()) // This is a doll of the updated object + { + iMeshWrapper* dollObject = doll->GetObject(); + if (dollObject == NULL) + { + Error2("Cannot update registered doll view with ID %d because it has no object", doll->GetID()); + continue; + } + psCharAppearance* pp = doll->GetCharApp(); + pp->ApplyTraits(this->traits); + pp->ApplyEquipment(this->equipment); + } + } } psLinearMovement& GEMClientActor::Movement() Modified: trunk/src/client/psclientchar.cpp =================================================================== --- trunk/src/client/psclientchar.cpp 2012-01-13 21:22:48 UTC (rev 7999) +++ trunk/src/client/psclientchar.cpp 2012-01-13 21:22:57 UTC (rev 8000) @@ -302,27 +302,22 @@ { if (dolls[i] == NULL) continue; - pawsObjectView* doll = dynamic_cast<pawsObjectView*>(dolls[i]); if (doll == NULL) continue; - if (doll->GetID() == objectID.Unbox()) // This is a doll of the updated object { iMeshWrapper* dollObject = doll->GetObject(); - psCharAppearance p(psengine->GetObjectRegistry()); - p.Clone(actor->CharAppearance()); - p.SetMesh(dollObject); - p.ApplyTraits(mesg.string); - if (dollObject == NULL) { Error2("Cannot update registered doll view with ID %d because it has no object", doll->GetID()); continue; } - - //psengine->BuildAppearance( dollObject, mesg.string ); + psCharAppearance* p = doll->GetCharApp(); + p->Clone(actor->CharAppearance()); + p->SetMesh(dollObject); + p->ApplyTraits(mesg.string); } } } @@ -429,65 +424,45 @@ equip.mesh.ReplaceAll("$E",object->BeltGroup); equip.mesh.ReplaceAll("$C",object->CloakGroup); - if (equip.type == psEquipmentMessage::EQUIP) + // Update any doll views registered for changes + csArray<iPAWSSubscriber*> dolls = PawsManager::GetSingleton().ListSubscribers("sigActorUpdate"); + for (size_t i=0; i<dolls.GetSize(); i++) { - // Update the actor - object->CharAppearance()->Equip(slotname,equip.mesh,equip.part,equip.partMesh,equip.texture,equip.removedMesh); + if (dolls[i] == NULL) + continue; + pawsObjectView* doll = dynamic_cast<pawsObjectView*>(dolls[i]); - // Update any doll views registered for changes - csArray<iPAWSSubscriber*> dolls = PawsManager::GetSingleton().ListSubscribers("sigActorUpdate"); - for (size_t i=0; i<dolls.GetSize(); i++) + if (doll == NULL) + continue; + if (doll->GetID() == playerID) // This is a doll of the updated object { - if (dolls[i] == NULL) + iMeshWrapper* dollObject = doll->GetObject(); + if (dollObject == NULL) + { + Error2("Cannot update registered doll view with ID %d because it has no object", doll->GetID()); continue; - pawsObjectView* doll = dynamic_cast<pawsObjectView*>(dolls[i]); - - if (doll == NULL) - continue; - if (doll->GetID() == playerID) // This is a doll of the updated object + } + psCharAppearance* p = doll->GetCharApp(); + p->Clone(object->CharAppearance()); + p->SetMesh(dollObject); + if (equip.type == psEquipmentMessage::EQUIP) { - iMeshWrapper* dollObject = doll->GetObject(); - if (dollObject == NULL) - { - Error2("Cannot update registered doll view with ID %d because it has no object", doll->GetID()); - continue; - } - psCharAppearance* p = doll->GetCharApp(); - p->Clone(object->CharAppearance()); - p->SetMesh(dollObject); p->Equip(slotname,equip.mesh,equip.part,equip.partMesh,equip.texture,equip.removedMesh); } - } - } - else - { - // Update any doll views registered for changes - csArray<iPAWSSubscriber*> dolls = PawsManager::GetSingleton().ListSubscribers("sigActorUpdate"); - for (size_t i=0; i<dolls.GetSize(); i++) - { - if (dolls[i] == NULL) - continue; - pawsObjectView* doll = dynamic_cast<pawsObjectView*>(dolls[i]); - - if (doll == NULL) - continue; - - if (doll->GetID() == playerID) // This is a doll of the updated object + else { - iMeshWrapper* dollObject = doll->GetObject(); - if (dollObject == NULL) - { - Error2("Cannot update registered doll view with ID %d because it has no object", doll->GetID()); - continue; - } - - psCharAppearance* p = doll->GetCharApp(); - p->SetMesh(dollObject); - p->Clone(object->CharAppearance()); p->Dequip(slotname,equip.mesh,equip.part,equip.partMesh,equip.texture,equip.removedMesh); } } + } + // Update the actor + if (equip.type == psEquipmentMessage::EQUIP) + { + object->CharAppearance()->Equip(slotname,equip.mesh,equip.part,equip.partMesh,equip.texture,equip.removedMesh); + } + else + { object->CharAppearance()->Dequip(slotname,equip.mesh,equip.part,equip.partMesh,equip.texture,equip.removedMesh); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |