From: <lpa...@us...> - 2013-09-13 16:03:41
|
Revision: 8791 http://sourceforge.net/p/planeshift/code/8791 Author: lpancallo Date: 2013-09-13 16:03:37 +0000 (Fri, 13 Sep 2013) Log Message: ----------- Autoformatting. Modified Paths: -------------- trunk/src/client/pscelclient.cpp trunk/src/client/pscelclient.h trunk/src/common/net/messages.cpp trunk/src/common/net/messages.h trunk/src/server/scripting.cpp trunk/src/server/scripting.h Modified: trunk/src/client/pscelclient.cpp =================================================================== --- trunk/src/client/pscelclient.cpp 2013-09-13 16:00:34 UTC (rev 8790) +++ trunk/src/client/pscelclient.cpp 2013-09-13 16:03:37 UTC (rev 8791) @@ -669,14 +669,15 @@ Error2("Received HandleMecsActivate message script: %s!", msg.mechanismScript.GetData()); - csRef<iMeshWrapper> objectWrapper = psengine->GetEngine()->FindMeshObject (msg.meshName); + csRef<iMeshWrapper> objectWrapper = psengine->GetEngine()->FindMeshObject(msg.meshName); // object found, move the object - if (objectWrapper) { + if(objectWrapper) + { Error2("Found mesh! %s", objectWrapper->QueryObject()->GetName()); - csReversibleTransform& tr = objectWrapper->GetMovable()->GetTransform(); - csVector3 v (-2, 0, 0); - tr.Translate (v); + csReversibleTransform &tr = objectWrapper->GetMovable()->GetTransform(); + csVector3 v(-2, 0, 0); + tr.Translate(v); objectWrapper->GetMovable()->UpdateMove(); } } @@ -1711,11 +1712,11 @@ iSector* cur_sector; linmove->GetLastPosition(cur_pos,cur_yrot,cur_sector); - if (DoLogDebug(LOG_DRDATA)) + if(DoLogDebug(LOG_DRDATA)) { Debug(LOG_DRDATA, GetEID().Unbox(), "%s, %s, %s, %s, %f, %f, %f, %f, %s, %f, %f, %f, %f, %f, %f, %f", "PSCLIENT", "OLD", ShowID(GetEID()),"?", cur_pos.x, cur_pos.y, cur_pos.z, cur_yrot, - cur_sector->QueryObject()->GetName(), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ); + cur_sector->QueryObject()->GetName(), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); Debug(LOG_DRDATA, GetEID().Unbox(), "%s, %s, %s, %s, %f, %f, %f, %f, %s, %f, %f, %f, %f, %f, %f, %f", "PSCLIENT", "SET", ShowID(GetEID()),drmsg.on_ground?"TRUE":"FALSE", drmsg.pos.x, drmsg.pos.y, drmsg.pos.z, drmsg.yrot, @@ -1782,7 +1783,7 @@ linmove->SetPosition(pos, rot, sector); } -void GEMClientActor::SetVelocity(const csVector3& vel) +void GEMClientActor::SetVelocity(const csVector3 &vel) { linmove->SetVelocity(vel); } @@ -1844,7 +1845,7 @@ bool GEMClientActor::IsOwnedBy(GEMClientActor* actor) { - if (actor && actor->GetOwnerEID() == GetOwnerEID() && GetOwnerEID() != 0) + if(actor && actor->GetOwnerEID() == GetOwnerEID() && GetOwnerEID() != 0) { return true; } @@ -2175,7 +2176,7 @@ if(scale >= 0) { csRef<iMovable> movable = mesh->GetMovable(); - csReversibleTransform & trans = movable->GetTransform(); + csReversibleTransform &trans = movable->GetTransform(); csRef<iSpriteCal3DFactoryState> sprite = scfQueryInterface<iSpriteCal3DFactoryState> (mesh->GetFactory()->GetMeshObjectFactory()); // Normalize the mesh scale to the base scale of the mesh. Modified: trunk/src/client/pscelclient.h =================================================================== --- trunk/src/client/pscelclient.h 2013-09-13 16:00:34 UTC (rev 8790) +++ trunk/src/client/pscelclient.h 2013-09-13 16:03:37 UTC (rev 8791) @@ -74,13 +74,13 @@ class UnresolvedPos { public: - GEMClientObject * entity; ///< our object .. + GEMClientObject* entity; ///< our object .. csVector3 pos; ///< .. and its position that could not be set csVector3 rot; csString sector; - UnresolvedPos(GEMClientObject * entity, const csVector3 & pos, const csVector3 & rot, const csString & sector) + UnresolvedPos(GEMClientObject* entity, const csVector3 &pos, const csVector3 &rot, const csString §or) { this->entity = entity; this->pos = pos; @@ -143,17 +143,17 @@ void LoadEffectItems(); csRedBlackTreeMap<csString, csRef<InstanceObject>,csFixedSizeAllocator<sizeof(CS::Container::RedBlackTreeNode< - csRedBlackTreePayload<csString,csRef<InstanceObject> > >)>, CS::Container::RedBlackTreeOrderingStrictWeak > instanceObjects; + csRedBlackTreePayload<csString,csRef<InstanceObject> > >)>, CS::Container::RedBlackTreeOrderingStrictWeak > instanceObjects; csRedBlackTreeMap<csString, csRef<iMeshFactoryWrapper>,csFixedSizeAllocator<sizeof(CS::Container::RedBlackTreeNode< - csRedBlackTreePayload<csString,csRef<iMeshFactoryWrapper> > >)>, CS::Container::RedBlackTreeOrderingStrictWeak > nullFactories; + csRedBlackTreePayload<csString,csRef<iMeshFactoryWrapper> > >)>, CS::Container::RedBlackTreeOrderingStrictWeak > nullFactories; public: psCelClient(); virtual ~psCelClient(); - bool Initialize (iObjectRegistry* object_reg, MsgHandler* msghandler); + bool Initialize(iObjectRegistry* object_reg, MsgHandler* msghandler); void RequestServerWorld(); bool IsReady(); @@ -166,23 +166,38 @@ void RemoveObject(GEMClientObject* entity); - psClientDR* GetClientDR() { return clientdr; } - const csPDelArray<GEMClientObject>& GetEntities () const { return entities; } + psClientDR* GetClientDR() + { + return clientdr; + } + const csPDelArray<GEMClientObject> &GetEntities() const + { + return entities; + } bool IsMeshSubjectToAction(const char* sector,const char* mesh); - GEMClientActor * GetActorByName(const char * name, bool trueName = true) const; + GEMClientActor* GetActorByName(const char* name, bool trueName = true) const; virtual void HandleMessage(MsgEntry* me); void SetupWorldColliders(); - psEntityLabels * GetEntityLabels() { return entityLabels; } - psShadowManager * GetShadowManager() { return shadowManager; } + psEntityLabels* GetEntityLabels() + { + return entityLabels; + } + psShadowManager* GetShadowManager() + { + return shadowManager; + } - GEMClientActor* GetMainPlayer() { return local_player; } + GEMClientActor* GetMainPlayer() + { + return local_player; + } /** Check if the item has an effect attached to it and process it if so. */ - void HandleItemEffect( const char* factName, csRef<iMeshWrapper> mw, bool onGround = true, const char* slot = 0, - csHash<int, csString> *effectids = 0, csHash<int, csString> *lightids = 0 ); + void HandleItemEffect(const char* factName, csRef<iMeshWrapper> mw, bool onGround = true, const char* slot = 0, + csHash<int, csString>* effectids = 0, csHash<int, csString>* lightids = 0); /** Called when new world maps were loaded CelClient looks for GEM Objects which have sectors with unknown name and checks if this name is known now */ @@ -190,22 +205,34 @@ /** Called when a region of the world is deleted from the client (because we don't need it loaded now) CelClient removes all GEMClientObjects that are in this region */ - void OnRegionsDeleted(csArray<iCollection *>& regions); + void OnRegionsDeleted(csArray<iCollection*> ®ions); - psWorld* GetWorld() const { return gameWorld; } + psWorld* GetWorld() const + { + return gameWorld; + } /** This is called when position of some entity could not be resolved (see the UnresolvedPos struct) * It adds this position to list of unresolved positions which we will attempt to resolve later * and moves the entity to special sector that keeps these unfortunate entities. */ - void HandleUnresolvedPos(GEMClientObject * entity, const csVector3 & pos, const csVector3& rot, const csString & sector); + void HandleUnresolvedPos(GEMClientObject* entity, const csVector3 &pos, const csVector3 &rot, const csString §or); void PruneEntities(); - bool IsUnresSector(iSector* sector) { return unresSector == sector;} - iSector* GetUnresSector() { return unresSector; } + bool IsUnresSector(iSector* sector) + { + return unresSector == sector; + } + iSector* GetUnresSector() + { + return unresSector; + } - int GetRequestStatus() { return requeststatus; } + int GetRequestStatus() + { + return requeststatus; + } /// Add one new actor or item entity from the queue. void CheckEntityQueues(); @@ -221,7 +248,7 @@ * @param object The Crystal Space object we want to attach our client object to. * @param clientObject The client object we want to attach. */ - void AttachObject( iObject* object, GEMClientObject* clientObject); + void AttachObject(iObject* object, GEMClientObject* clientObject); /** Unattach a client object from a Crystal Space object. * In most cases the Crystal Space object is a meshwrapper. @@ -229,7 +256,7 @@ * @param object The Crystal Space object we want to unattach our client object from. * @param clientObject The client object we want to unattach. */ - void UnattachObject( iObject* object, GEMClientObject* clientObject); + void UnattachObject(iObject* object, GEMClientObject* clientObject); /** See if there is a client object attached to a given object. * @@ -237,7 +264,7 @@ * * @return A GEMClientObject if it exists that is attached to the Crystal Space object. */ - GEMClientObject* FindAttachedObject (iObject* object); + GEMClientObject* FindAttachedObject(iObject* object); /** Create a list of all nearby GEM objects. @@ -248,7 +275,7 @@ * * @return A csArray<> of all the objects in the given radius. */ - csArray<GEMClientObject*> FindNearbyEntities (iSector* sector, const csVector3& pos, float radius, bool doInvisible = false); + csArray<GEMClientObject*> FindNearbyEntities(iSector* sector, const csVector3 &pos, float radius, bool doInvisible = false); /** * Search for an instance object and return it if existing. Else return 0 csPtr. @@ -268,51 +295,54 @@ csPtr<iMeshFactoryWrapper> FindNullFactory(const char* name) const; void AddNullFactory(const char* name, csRef<iMeshFactoryWrapper> object); void RemoveNullFactory(const char* name); - + /** Substituites in a string the group identifiers like $H $B etc depending on the race of the player. - * + * * @param string The string where do to the replacements - */ + */ void replaceRacialGroup(csString &string); - bool InstanceItems() { return instantiateItems; } + bool InstanceItems() + { + return instantiateItems; + } protected: /** Finds given entity in list of unresolved entities */ - csList<UnresolvedPos*>::Iterator FindUnresolvedPos(GEMClientObject * entity); + csList<UnresolvedPos*>::Iterator FindUnresolvedPos(GEMClientObject* entity); int requeststatus; csRef<iVFS> vfs; csRef<MsgHandler> msghandler; psClientDR* clientdr; - psEntityLabels * entityLabels; - psShadowManager * shadowManager; + psEntityLabels* entityLabels; + psShadowManager* shadowManager; psWorld* gameWorld; - void HandleWorld( MsgEntry* me ); - void HandleActor( MsgEntry* me ); - void HandleItem( MsgEntry* me ); - void HandleActionLocation( MsgEntry* me ); - void HandleObjectRemoval( MsgEntry* me ); - void HandleNameChange( MsgEntry* me ); - void HandleGuildChange( MsgEntry* me ); - void HandleGroupChange( MsgEntry* me ); + void HandleWorld(MsgEntry* me); + void HandleActor(MsgEntry* me); + void HandleItem(MsgEntry* me); + void HandleActionLocation(MsgEntry* me); + void HandleObjectRemoval(MsgEntry* me); + void HandleNameChange(MsgEntry* me); + void HandleGuildChange(MsgEntry* me); + void HandleGroupChange(MsgEntry* me); - void HandleMecsActivate( MsgEntry* me ); + void HandleMecsActivate(MsgEntry* me); void AddEntity(GEMClientObject* obj); /** Handles a stats message from the server. * This basically just publishes the data to PAWS so various widgets can be updated. */ - void HandleStats( MsgEntry* me ); + void HandleStats(MsgEntry* me); GEMClientActor* local_player; csList<UnresolvedPos*> unresPos; ///< list of entities with unresolved location - iSector * unresSector; ///< sector where we keep these entities + iSector* unresSector; ///< sector where we keep these entities }; enum GEMOBJECT_TYPE @@ -334,7 +364,10 @@ GEMClientObject(psCelClient* cel, EID id); virtual ~GEMClientObject(); - virtual GEMOBJECT_TYPE GetObjectType() { return GEM_OBJECT; } + virtual GEMOBJECT_TYPE GetObjectType() + { + return GEM_OBJECT; + } /** Performs helm group substitutions. */ void SubstituteRacialMeshFact(); @@ -342,14 +375,14 @@ /** Start loading the mesh. */ void LoadMesh(); - /** Set the position of mesh + /** Set the position of mesh * @param pos the coordinates of the mesh * @param rotangle the y axis rotation of the mesh * @param room the sector in which the mesh is moved to */ - void Move(const csVector3& pos, const csVector3& rotangle, const char* room); + void Move(const csVector3 &pos, const csVector3 &rotangle, const char* room); - /** Set the rotation of mesh + /** Set the rotation of mesh * @param xRot the variable used to set the x rotation of the item * @param yRot the variable used to set the x rotation of the item * @param zRot the variable used to set the z rotation of the item @@ -357,7 +390,7 @@ void Rotate(float xRot, float yRot, float zRot); /** Set position of entity */ - virtual void SetPosition(const csVector3& pos, const csVector3& rot, iSector* sector); + virtual void SetPosition(const csVector3 &pos, const csVector3 &rot, iSector* sector); /** Get position of entity */ virtual csVector3 GetPosition(); @@ -376,61 +409,100 @@ virtual iSectorList* GetSectors() const; /** Return the bounding box of this entity. */ - virtual const csBox3& GetBBox() const; + virtual const csBox3 &GetBBox() const; - EID GetEID() { return eid; } + EID GetEID() + { + return eid; + } csRef<iMeshWrapper> pcmesh; virtual int GetMasqueradeType(); - int GetType() { return type; } + int GetType() + { + return type; + } - virtual const char* GetName() { return name; } + virtual const char* GetName() + { + return name; + } virtual void ChangeName(const char* name); - const char* GetFactName() { return factName; } + const char* GetFactName() + { + return factName; + } - psEffect* GetEntityLabel() { return entitylabel; } - void SetEntityLabel(psEffect* el) { entitylabel = el; } + psEffect* GetEntityLabel() + { + return entitylabel; + } + void SetEntityLabel(psEffect* el) + { + entitylabel = el; + } - psEffect * GetShadow() { return shadow; } - void SetShadow(psEffect * shadow) { this->shadow = shadow; } + psEffect* GetShadow() + { + return shadow; + } + void SetShadow(psEffect* shadow) + { + this->shadow = shadow; + } /** * Indicate if this object is alive */ - virtual bool IsAlive() { return false; } + virtual bool IsAlive() + { + return false; + } /** Get the flag bit field. * @return The bit field that contains the flags on this actor. */ - int Flags() { return flags; } + int Flags() + { + return flags; + } - /** Get the mesh that this object has. - * @return The iMeshWrapper or 0 if no mesh. - */ - csRef<iMeshWrapper> GetMesh() const; + /** Get the mesh that this object has. + * @return The iMeshWrapper or 0 if no mesh. + */ + csRef<iMeshWrapper> GetMesh() const; - virtual void Update(); + virtual void Update(); - float RangeTo(GEMClientObject * obj, bool ignoreY); + float RangeTo(GEMClientObject* obj, bool ignoreY); - bool HasShadow() const { return hasShadow; } + bool HasShadow() const + { + return hasShadow; + } - bool HasLabel() const { return hasLabel; } + bool HasLabel() const + { + return hasLabel; + } - /** - * Delayed mesh loading. - */ - virtual bool CheckLoadStatus() { return false; } + /** + * Delayed mesh loading. + */ + virtual bool CheckLoadStatus() + { + return false; + } - /** - * Delayed load 'post-process'. - */ - virtual void PostLoad(bool /*nullmesh*/) { } + /** + * Delayed load 'post-process'. + */ + virtual void PostLoad(bool /*nullmesh*/) { } protected: - static psCelClient *cel; + static psCelClient* cel; csString name; csString factName; @@ -440,7 +512,7 @@ int flags; ///< Various flags on the entity. psEffect* entitylabel; - psEffect * shadow; + psEffect* shadow; bool hasLabel; bool hasShadow; @@ -462,10 +534,13 @@ { public: - GEMClientActor( psCelClient* cel, psPersistActor& mesg ); + GEMClientActor(psCelClient* cel, psPersistActor &mesg); virtual ~GEMClientActor(); - virtual GEMOBJECT_TYPE GetObjectType() { return GEM_ACTOR; } + virtual GEMOBJECT_TYPE GetObjectType() + { + return GEM_ACTOR; + } /** When receiving a psPersistActor message for the actor we currently * control, some of our data (notably DRcounter) is probably newer @@ -474,7 +549,7 @@ * * @param oldActor The actor to copy data from. */ - void CopyNewestData(GEMClientActor& oldActor); + void CopyNewestData(GEMClientActor &oldActor); /** Get the last position of this object. * @@ -482,57 +557,78 @@ * @param yrot The Y-Axis rotation of the object. [CHANGED] * @param sector The sector of the object is in [CHANGED] */ - void GetLastPosition (csVector3& pos, float& yrot, iSector*& sector); + void GetLastPosition(csVector3 &pos, float &yrot, iSector* §or); /** Get the object velocity. * * @return The velocity of the object as a vector. */ - const csVector3 GetVelocity () const; + const csVector3 GetVelocity() const; - virtual void SetPosition(const csVector3& pos, float rot, iSector* sector); + virtual void SetPosition(const csVector3 &pos, float rot, iSector* sector); /** Set the velocity of the actor. */ - void SetVelocity(const csVector3& vel); + void SetVelocity(const csVector3 &vel); /** Set the rotation of the actor. */ void SetYRotation(const float yrot); - - void SetAlive( bool aliveFlag, bool newactor ); - virtual bool IsAlive() { return alive; } - virtual int GetMasqueradeType() { return masqueradeType; } + void SetAlive(bool aliveFlag, bool newactor); + virtual bool IsAlive() + { + return alive; + } + virtual int GetMasqueradeType() + { + return masqueradeType; + } + /** Get the condition manager on this actor. */ - psClientVitals* GetVitalMgr() { return vitalManager; } + psClientVitals* GetVitalMgr() + { + return vitalManager; + } csVector3 Pos() const; csVector3 Rot() const; - iSector *GetSector() const; + iSector* GetSector() const; virtual const char* GetName(bool realName = true); - const char* GetGuildName() { return guildName; } - void SetGuildName(const char* guild) { guildName = guild; } + const char* GetGuildName() + { + return guildName; + } + void SetGuildName(const char* guild) + { + guildName = guild; + } - bool NeedDRUpdate(unsigned char& priority); + bool NeedDRUpdate(unsigned char &priority); void SendDRUpdate(unsigned char priority,csStringHashReversible* msgstrings); - void SetDRData(psDRMessage& drmsg); + void SetDRData(psDRMessage &drmsg); void StopMoving(bool worldVel = false); - psCharAppearance* CharAppearance() { return charApp; } + psCharAppearance* CharAppearance() + { + return charApp; + } psLinearMovement* linmove; /// The Vital of the player with regards to his health/mana/fatigue/etc. - psClientVitals *vitalManager; + psClientVitals* vitalManager; void SetMode(uint8_t mode, bool newactor = false); - uint8_t GetMode() { return serverMode; } + uint8_t GetMode() + { + return serverMode; + } void SetIdleAnimation(const char* anim); - void SetAnimationVelocity(const csVector3& velocity); + void SetAnimationVelocity(const csVector3 &velocity); bool SetAnimation(const char* anim, int duration=0); void RefreshCal3d(); ///< Reloads iSpriteCal3DState @@ -547,7 +643,7 @@ * This optimal routine tries to get the animation index given an * animation csStringID. */ - int GetAnimIndex (csStringHashReversible* msgstrings, csStringID animid); + int GetAnimIndex(csStringHashReversible* msgstrings, csStringID animid); // The following hash is used by GetAnimIndex(). csHash<int,csStringID> anim_hash; @@ -577,16 +673,28 @@ // Access functions for the group var bool IsGroupedWith(GEMClientActor* actor); bool IsOwnedBy(GEMClientActor* actor); - unsigned int GetGroupID() { return groupID; } - void SetGroupID(unsigned int id) { groupID = id; } - EID GetOwnerEID() { return ownerEID; } - void SetOwnerEID(EID id) { ownerEID = id; } + unsigned int GetGroupID() + { + return groupID; + } + void SetGroupID(unsigned int id) + { + groupID = id; + } + EID GetOwnerEID() + { + return ownerEID; + } + void SetOwnerEID(EID id) + { + ownerEID = id; + } csPDelArray<Trait> traitList; /** Get the movment system this object is using. */ - psLinearMovement& Movement(); + psLinearMovement &Movement(); virtual void Update(); @@ -638,15 +746,18 @@ class GEMClientItem : public GEMClientObject { public: - GEMClientItem( psCelClient* cel, psPersistItem& mesg ); + GEMClientItem(psCelClient* cel, psPersistItem &mesg); virtual ~GEMClientItem(); - virtual GEMOBJECT_TYPE GetObjectType() { return GEM_ITEM; } - + virtual GEMOBJECT_TYPE GetObjectType() + { + return GEM_ITEM; + } + /** * Delayed mesh loading. */ - virtual bool CheckLoadStatus(); + virtual bool CheckLoadStatus(); protected: virtual void PostLoad(); @@ -677,11 +788,17 @@ class GEMClientActionLocation : public GEMClientObject { public: - GEMClientActionLocation( psCelClient* cel, psPersistActionLocation& mesg ); + GEMClientActionLocation(psCelClient* cel, psPersistActionLocation &mesg); - virtual GEMOBJECT_TYPE GetObjectType() { return GEM_ACTION_LOC; } + virtual GEMOBJECT_TYPE GetObjectType() + { + return GEM_ACTION_LOC; + } - const char* GetMeshName() { return meshname; } + const char* GetMeshName() + { + return meshname; + } protected: csString meshname; Modified: trunk/src/common/net/messages.cpp =================================================================== --- trunk/src/common/net/messages.cpp 2013-09-13 16:00:34 UTC (rev 8790) +++ trunk/src/common/net/messages.cpp 2013-09-13 16:03:37 UTC (rev 8791) @@ -46,7 +46,7 @@ #define FULL_DEBUG_DUMP // -MsgHandler *psMessageCracker::msghandler; +MsgHandler* psMessageCracker::msghandler; void psMessageCracker::SendMessage() @@ -57,7 +57,7 @@ } -void psMessageCracker::Multicast(csArray<PublishDestination>& multi, uint32_t except, float range) +void psMessageCracker::Multicast(csArray<PublishDestination> &multi, uint32_t except, float range) { CS_ASSERT(valid); CS_ASSERT(msg); @@ -75,28 +75,28 @@ PSF_IMPLEMENT_MSG_FACTORY(psCharDeleteMessage,MSGTYPE_CHAR_DELETE); -psCharDeleteMessage::psCharDeleteMessage( const char* name, uint32_t client ) +psCharDeleteMessage::psCharDeleteMessage(const char* name, uint32_t client) { if(!name) return; - msg.AttachNew(new MsgEntry( strlen(name) + 1 )); + msg.AttachNew(new MsgEntry(strlen(name) + 1)); - msg->SetType( MSGTYPE_CHAR_DELETE ); + msg->SetType(MSGTYPE_CHAR_DELETE); msg->clientnum = client; - msg->Add( name ); + msg->Add(name); - valid = !(msg->overrun ); + valid = !(msg->overrun); } -psCharDeleteMessage::psCharDeleteMessage( MsgEntry* message ) +psCharDeleteMessage::psCharDeleteMessage(MsgEntry* message) { if(!message) return; charName = message->GetStr(); } -csString psCharDeleteMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psCharDeleteMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString msgtext; @@ -111,7 +111,7 @@ PSF_IMPLEMENT_MSG_FACTORY(psPreAuthenticationMessage,MSGTYPE_PREAUTHENTICATE); psPreAuthenticationMessage::psPreAuthenticationMessage(uint32_t clientnum, - uint32_t version) + uint32_t version) { msg.AttachNew(new MsgEntry(sizeof(uint32_t))); @@ -124,9 +124,9 @@ valid=!(msg->overrun); } -psPreAuthenticationMessage::psPreAuthenticationMessage(MsgEntry *message) +psPreAuthenticationMessage::psPreAuthenticationMessage(MsgEntry* message) { - if (!message) + if(!message) return; netversion = message->GetUInt32(); @@ -140,7 +140,7 @@ return netversion == PS_NETVERSION; } -csString psPreAuthenticationMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psPreAuthenticationMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString msgtext; @@ -154,10 +154,10 @@ PSF_IMPLEMENT_MSG_FACTORY(psAuthenticationMessage,MSGTYPE_AUTHENTICATE); psAuthenticationMessage::psAuthenticationMessage(uint32_t clientnum, - const char *userid,const char *password, const char* os, const char* gfxcard, const char* gfxversion, const char *password256, uint32_t version) + const char* userid,const char* password, const char* os, const char* gfxcard, const char* gfxversion, const char* password256, uint32_t version) { - if (!userid || !password) + if(!userid || !password) { msg = NULL; return; @@ -181,9 +181,9 @@ valid=!(msg->overrun); } -psAuthenticationMessage::psAuthenticationMessage(MsgEntry *message) +psAuthenticationMessage::psAuthenticationMessage(MsgEntry* message) { - if (!message) + if(!message) return; netversion = message->GetUInt32(); @@ -192,7 +192,7 @@ os_ = message->GetStr(); gfxcard_ = message->GetStr(); gfxversion_ = message->GetStr(); - if (!message->IsEmpty()) + if(!message->IsEmpty()) { sPassword256 = message->GetStr(); } @@ -206,7 +206,7 @@ return netversion == PS_NETVERSION; } -csString psAuthenticationMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psAuthenticationMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString msgtext; @@ -220,17 +220,17 @@ PSF_IMPLEMENT_MSG_FACTORY(psAuthApprovedMessage,MSGTYPE_AUTHAPPROVED); -psAuthApprovedMessage::psAuthApprovedMessage (uint32_t clientnum, - PID playerID, uint8_t numChars) +psAuthApprovedMessage::psAuthApprovedMessage(uint32_t clientnum, + PID playerID, uint8_t numChars) { msgClientValidToken = clientnum; msgPlayerID = playerID; msgNumOfChars = numChars; } -psAuthApprovedMessage::psAuthApprovedMessage(MsgEntry *message) +psAuthApprovedMessage::psAuthApprovedMessage(MsgEntry* message) { - if (!message) + if(!message) return; msgClientValidToken = message->GetUInt32(); @@ -238,9 +238,9 @@ msgNumOfChars = message->GetUInt8(); } -void psAuthApprovedMessage::AddCharacter(const char *fullname, const char *race, - const char *mesh, const char *traits, - const char *equipment) +void psAuthApprovedMessage::AddCharacter(const char* fullname, const char* race, + const char* mesh, const char* traits, + const char* equipment) { contents.Push(fullname); contents.Push(race); @@ -249,10 +249,10 @@ contents.Push(equipment); } -void psAuthApprovedMessage::GetCharacter(MsgEntry *message, - csString& fullname, csString& race, - csString& mesh, csString& traits, - csString& equipment) +void psAuthApprovedMessage::GetCharacter(MsgEntry* message, + csString &fullname, csString &race, + csString &mesh, csString &traits, + csString &equipment) { fullname = message->GetStr(); race = message->GetStr(); @@ -265,7 +265,7 @@ { size_t msgSize = sizeof(uint32_t)*2 + sizeof(uint8_t); - for (size_t i = 0; i < contents.GetSize(); ++i) + for(size_t i = 0; i < contents.GetSize(); ++i) msgSize += strlen(contents[i]) + 1; msg.AttachNew(new MsgEntry(msgSize)); @@ -277,11 +277,11 @@ msg->Add(msgPlayerID.Unbox()); msg->Add(msgNumOfChars); - for (size_t i = 0; i < contents.GetSize(); ++i) + for(size_t i = 0; i < contents.GetSize(); ++i) msg->Add(contents[i]); } -csString psAuthApprovedMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psAuthApprovedMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString msgtext; @@ -295,7 +295,7 @@ PSF_IMPLEMENT_MSG_FACTORY(psPreAuthApprovedMessage,MSGTYPE_PREAUTHAPPROVED); -psPreAuthApprovedMessage::psPreAuthApprovedMessage (uint32_t clientnum) +psPreAuthApprovedMessage::psPreAuthApprovedMessage(uint32_t clientnum) { msg.AttachNew(new MsgEntry(sizeof(uint32_t))); @@ -308,9 +308,9 @@ valid=!(msg->overrun); } -psPreAuthApprovedMessage::psPreAuthApprovedMessage(MsgEntry *message) +psPreAuthApprovedMessage::psPreAuthApprovedMessage(MsgEntry* message) { - if (!message) + if(!message) return; ClientNum = message->GetUInt32(); @@ -319,7 +319,7 @@ valid=!(message->overrun); } -csString psPreAuthApprovedMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psPreAuthApprovedMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString msgtext; @@ -333,12 +333,12 @@ PSF_IMPLEMENT_MSG_FACTORY(psAuthRejectedMessage,MSGTYPE_AUTHREJECTED); psAuthRejectedMessage::psAuthRejectedMessage(uint32_t clientnum, - const char *reason) + const char* reason) { - if (!reason) + if(!reason) return; - msg.AttachNew(new MsgEntry( strlen(reason)+1 )); + msg.AttachNew(new MsgEntry(strlen(reason)+1)); msg->SetType(MSGTYPE_AUTHREJECTED); msg->clientnum = clientnum; @@ -349,9 +349,9 @@ valid=!(msg->overrun); } -psAuthRejectedMessage::psAuthRejectedMessage(MsgEntry *message) +psAuthRejectedMessage::psAuthRejectedMessage(MsgEntry* message) { - if (!message) + if(!message) return; msgReason = message->GetStr(); @@ -360,7 +360,7 @@ valid=!(message->overrun); } -csString psAuthRejectedMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psAuthRejectedMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString msgtext; @@ -373,9 +373,9 @@ PSF_IMPLEMENT_MSG_FACTORY(psCharacterPickerMessage,MSGTYPE_AUTHCHARACTER); -psCharacterPickerMessage::psCharacterPickerMessage( const char* characterName ) +psCharacterPickerMessage::psCharacterPickerMessage(const char* characterName) { - msg.AttachNew(new MsgEntry( strlen(characterName)+1 )); + msg.AttachNew(new MsgEntry(strlen(characterName)+1)); msg->SetType(MSGTYPE_AUTHCHARACTER); msg->clientnum = 0; @@ -387,7 +387,7 @@ } -psCharacterPickerMessage::psCharacterPickerMessage( MsgEntry* message ) +psCharacterPickerMessage::psCharacterPickerMessage(MsgEntry* message) { characterName = message->GetStr(); @@ -395,7 +395,7 @@ valid=!(message->overrun); } -csString psCharacterPickerMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psCharacterPickerMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString msgtext; @@ -422,7 +422,7 @@ psCharacterApprovedMessage::psCharacterApprovedMessage(MsgEntry* /*message*/) { - // No data, always valid + // No data, always valid } csString psCharacterApprovedMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) @@ -439,10 +439,10 @@ PSF_IMPLEMENT_MSG_FACTORY(psChatMessage,MSGTYPE_CHAT); -psChatMessage::psChatMessage(uint32_t cnum, EID actorid, const char *person, const char * other, - const char *chatMessage, uint8_t type, bool translate, uint16_t channelID) +psChatMessage::psChatMessage(uint32_t cnum, EID actorid, const char* person, const char* other, + const char* chatMessage, uint8_t type, bool translate, uint16_t channelID) { - if (!chatMessage || !person) + if(!chatMessage || !person) return; iChatType = type; @@ -453,7 +453,7 @@ bool includeOther = iChatType == CHAT_ADVISOR; size_t sz = strlen(person) + 1 + strlen(chatMessage) + 1 + sizeof(uint8_t)*2 + sizeof(uint32_t); - if (includeOther) + if(includeOther) sz += strlen(other) + 1; bool chanMsg = iChatType == CHAT_CHANNEL; @@ -472,16 +472,16 @@ msg->Add(actorid.Unbox()); if(chanMsg) msg->Add(channelID); - if (includeOther) + if(includeOther) msg->Add(other); // Sets valid flag based on message overrun state valid=!(msg->overrun); } -psChatMessage::psChatMessage(MsgEntry *message) +psChatMessage::psChatMessage(MsgEntry* message) { - if (!message) + if(!message) return; iChatType = message->GetUInt8(); @@ -494,7 +494,7 @@ actor = message->GetUInt32(); if(chanMsg) channelID = message->GetUInt16(); - if (includeOther && !message->IsEmpty()) + if(includeOther && !message->IsEmpty()) sOther = message->GetStr(); // Sets valid flag based on message overrun state @@ -503,7 +503,7 @@ } -csString psChatMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psChatMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString msgtext; @@ -516,27 +516,44 @@ return msgtext; } -const char *psChatMessage::GetTypeText() +const char* psChatMessage::GetTypeText() { - switch (iChatType) + switch(iChatType) { - case CHAT_SAY: return "Say"; - case CHAT_TELL: return "Tell"; - case CHAT_AWAY: return "Tell"; - case CHAT_NPC: return "TellNPC"; - case CHAT_TELLSELF: return "TellSelf"; - case CHAT_GROUP: return "GroupMsg"; - case CHAT_SHOUT: return "Shout"; - case CHAT_GM: return "GM"; - case CHAT_GUILD: return "GuildChat"; - case CHAT_ALLIANCE: return "AllianceChat"; - case CHAT_AUCTION: return "Auction"; - case CHAT_PET_ACTION: return "Action"; - case CHAT_REPORT: return "Report"; - case CHAT_ADVISOR: return "Advisor"; - case CHAT_ADVICE: return "Advice"; - case CHAT_CHANNEL: return "Channel"; - default: return "Unknown"; + case CHAT_SAY: + return "Say"; + case CHAT_TELL: + return "Tell"; + case CHAT_AWAY: + return "Tell"; + case CHAT_NPC: + return "TellNPC"; + case CHAT_TELLSELF: + return "TellSelf"; + case CHAT_GROUP: + return "GroupMsg"; + case CHAT_SHOUT: + return "Shout"; + case CHAT_GM: + return "GM"; + case CHAT_GUILD: + return "GuildChat"; + case CHAT_ALLIANCE: + return "AllianceChat"; + case CHAT_AUCTION: + return "Auction"; + case CHAT_PET_ACTION: + return "Action"; + case CHAT_REPORT: + return "Report"; + case CHAT_ADVISOR: + return "Advisor"; + case CHAT_ADVICE: + return "Advice"; + case CHAT_CHANNEL: + return "Channel"; + default: + return "Unknown"; } } @@ -563,7 +580,7 @@ valid=!(message->overrun); } -csString psChannelJoinMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psChannelJoinMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString text; text.Format("Channel name: %s", channel.GetData()); @@ -595,7 +612,7 @@ valid=!(message->overrun); } -csString psChannelJoinedMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psChannelJoinedMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString text; text.Format("Channel ID: %d, name: %s", id, channel.GetData()); @@ -625,7 +642,7 @@ valid=!(message->overrun); } -csString psChannelLeaveMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psChannelLeaveMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString text; text.Format("Channel ID: %d", chanID); @@ -635,7 +652,7 @@ // --------------------------------------------------------------------------- psSystemMessageSafe::psSystemMessageSafe(uint32_t clientnum, uint32_t msgtype, - const char *text) + const char* text) { char str[MAXSYSTEMMSGSIZE]; @@ -658,7 +675,7 @@ PSF_IMPLEMENT_MSG_FACTORY(psSystemMessage,MSGTYPE_SYSTEM); -psSystemMessage::psSystemMessage(uint32_t clientnum, uint32_t msgtype, const char *fmt, ... ) +psSystemMessage::psSystemMessage(uint32_t clientnum, uint32_t msgtype, const char* fmt, ...) { char str[MAXSYSTEMMSGSIZE]; va_list args; @@ -685,7 +702,7 @@ valid=!(msg->overrun); } -psSystemMessage::psSystemMessage(uint32_t clientnum, uint32_t msgtype, const char *fmt, va_list args ) +psSystemMessage::psSystemMessage(uint32_t clientnum, uint32_t msgtype, const char* fmt, va_list args) { char str[MAXSYSTEMMSGSIZE]; @@ -704,7 +721,7 @@ valid=!(msg->overrun); } -psSystemMessage::psSystemMessage(MsgEntry *message) +psSystemMessage::psSystemMessage(MsgEntry* message) { type = message->GetUInt32(); msgline = message->GetStr(); @@ -713,7 +730,7 @@ valid=!(message->overrun); } -csString psSystemMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psSystemMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString msgtext; @@ -726,26 +743,26 @@ PSF_IMPLEMENT_MSG_FACTORY(psPetitionMessage,MSGTYPE_PETITION); -psPetitionMessage::psPetitionMessage(uint32_t clientnum, csArray<psPetitionInfo> *petition, const char* errMsg, - bool succeed, int type, bool gm) +psPetitionMessage::psPetitionMessage(uint32_t clientnum, csArray<psPetitionInfo>* petition, const char* errMsg, + bool succeed, int type, bool gm) { size_t petitionLen = (petition != NULL ? petition->GetSize():0); size_t messageSize = 0; size_t errLen = 0; - if ( errMsg ) + if(errMsg) { errLen = strlen(errMsg)+1; } - psPetitionInfo *curr; + psPetitionInfo* curr; - for (size_t i = 0; i < petitionLen; i++) + for(size_t i = 0; i < petitionLen; i++) { curr = &petition->Get(i); messageSize+= sizeof(int32_t); // Petition ID messageSize+= curr->petition.Length()+1; // Petition String messageSize+= curr->status.Length()+1; // Petition status string - if ( !gm ) + if(!gm) { messageSize+=curr->created.Length()+1; messageSize+=curr->assignedgm.Length()+1; @@ -769,8 +786,8 @@ sizeof(int32_t))); // Space for type int32_t - //+ (maxPetitionTextLen + 250)* (petitionLen+1) + sizeof(errMsg) + - // sizeof(succeed) + sizeof(int32_t) + sizeof(gm)); + //+ (maxPetitionTextLen + 250)* (petitionLen+1) + sizeof(errMsg) + + // sizeof(succeed) + sizeof(int32_t) + sizeof(gm)); msg->SetType(MSGTYPE_PETITION); msg->clientnum = clientnum; @@ -778,8 +795,8 @@ msg->Add((int32_t)petitionLen); msg->Add(gm); - psPetitionInfo *current; - for (size_t i = 0; i < petitionLen; i++) + psPetitionInfo* current; + for(size_t i = 0; i < petitionLen; i++) { current = &petition->Get(i); msg->Add((int32_t)current->id); @@ -788,7 +805,7 @@ msg->Add(current->created.GetData()); msg->Add(current->assignedgm.GetData()); // Add specified fields based upon GM status or not - if (!gm) + if(!gm) { msg->Add(current->resolution.GetData()); } @@ -806,18 +823,18 @@ // Sets valid flag based on message overrun state valid=!(msg->overrun); - if (valid) + if(valid) msg->ClipToCurrentSize(); } -psPetitionMessage::psPetitionMessage(MsgEntry *message) +psPetitionMessage::psPetitionMessage(MsgEntry* message) { // Get the petitions int count = message->GetInt32(); isGM = message->GetBool(); psPetitionInfo current; - for (int i = 0; i < count; i++) + for(int i = 0; i < count; i++) { // Set each property in psPetitionInfo: current.id = message->GetInt32(); @@ -827,7 +844,7 @@ current.assignedgm = message->GetStr(); // Check GM fields or user fields: - if (!isGM) + if(!isGM) { current.resolution = message->GetStr(); } @@ -850,13 +867,13 @@ valid=!(message->overrun); } -csString psPetitionMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psPetitionMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString msgtext; msgtext.AppendFmt("IsGM: %s",(isGM?"true":"false")); - for (size_t i = 0; i < petitions.GetSize(); i++) + for(size_t i = 0; i < petitions.GetSize(); i++) { psPetitionInfo current = petitions[i]; @@ -865,7 +882,7 @@ current.status.GetDataSafe()); // Check GM fields or user fields: - if (!isGM) + if(!isGM) { msgtext.AppendFmt(" Created: '%s' AssignedGM: '%s')", current.created.GetDataSafe(), @@ -905,11 +922,11 @@ // Sets valid flag based on message overrun state valid=!(msg->overrun); - if (valid) + if(valid) msg->ClipToCurrentSize(); } -psPetitionRequestMessage::psPetitionRequestMessage(MsgEntry *message) +psPetitionRequestMessage::psPetitionRequestMessage(MsgEntry* message) { isGM = message->GetBool(); request = message->GetStr(); @@ -920,7 +937,7 @@ valid=!(message->overrun); } -csString psPetitionRequestMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psPetitionRequestMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString msgtext; @@ -947,11 +964,11 @@ msg->Add(gmSettings); valid=!(msg->overrun); - if (valid) + if(valid) msg->ClipToCurrentSize(); } -psGMGuiMessage::psGMGuiMessage(uint32_t clientnum, csArray<PlayerInfo> *playerArray, int type) +psGMGuiMessage::psGMGuiMessage(uint32_t clientnum, csArray<PlayerInfo>* playerArray, int type) { size_t playerCount = (playerArray == NULL ? 0 : playerArray->GetSize()); msg.AttachNew(new MsgEntry(sizeof(playerCount) + 250 * (playerCount+1) + sizeof(type))); @@ -961,7 +978,7 @@ msg->Add((int32_t)type); msg->Add((uint32_t)playerCount); - for (size_t i=0; i<playerCount; i++) + for(size_t i=0; i<playerCount; i++) { PlayerInfo playerInfo = playerArray->Get(i); @@ -974,21 +991,21 @@ // Sets valid flag based on message overrun state valid=!(msg->overrun); - if (valid) + if(valid) msg->ClipToCurrentSize(); } -psGMGuiMessage::psGMGuiMessage(MsgEntry *message) +psGMGuiMessage::psGMGuiMessage(MsgEntry* message) { type = message->GetInt32(); - if (type == TYPE_GETGMSETTINGS) + if(type == TYPE_GETGMSETTINGS) gmSettings = message->GetInt32(); else { size_t playerCount = message->GetUInt32(); - for (size_t i=0; i<playerCount; i++) + for(size_t i=0; i<playerCount; i++) { PlayerInfo playerInfo; playerInfo.name = message->GetStr(); @@ -1005,11 +1022,11 @@ valid=!(message->overrun); } -csString psGMGuiMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psGMGuiMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString msgtext; - for (size_t i=0; i < players.GetSize(); i++) + for(size_t i=0; i < players.GetSize(); i++) { PlayerInfo p = players[i]; msgtext.AppendFmt(" %zu(Name: '%s' Last: '%s'" @@ -1029,7 +1046,7 @@ PSF_IMPLEMENT_MSG_FACTORY(psGuildCmdMessage,MSGTYPE_GUILDCMD); -psGuildCmdMessage::psGuildCmdMessage(const char *cmd) +psGuildCmdMessage::psGuildCmdMessage(const char* cmd) { msg.AttachNew(new MsgEntry(strlen(cmd) + 1)); @@ -1042,7 +1059,7 @@ valid=!(msg->overrun); } -psGuildCmdMessage::psGuildCmdMessage(MsgEntry *message) +psGuildCmdMessage::psGuildCmdMessage(MsgEntry* message) { valid = true; level = 0; @@ -1051,65 +1068,65 @@ command = words[0]; - if (command == "/newguild" || command == "/endguild" || command == "/guildname" || command == "/guildpoints" || command == "/allianceleader") + if(command == "/newguild" || command == "/endguild" || command == "/guildname" || command == "/guildpoints" || command == "/allianceleader") { guildname = words.GetTail(1); return; } - if (command == "/guildinvite" || command == "/guildremove" || command == "/allianceinvite" || command == "/getmemberpermissions") + if(command == "/guildinvite" || command == "/guildremove" || command == "/allianceinvite" || command == "/getmemberpermissions") { player = words[1]; return; } - if (command == "/setmemberpermissions") + if(command == "/setmemberpermissions") { player = words[1]; subCmd = words[2]; permission = words[3]; return; } - if (command == "/guildlevel") + if(command == "/guildlevel") { level = words.GetInt(1); levelname = words.GetTail(2); return; } - if (command == "/guildmembers") + if(command == "/guildmembers") { level = words.GetInt(1); return; } - if (command == "/guildpromote") + if(command == "/guildpromote") { player = words[1]; level = words.GetInt(2); return; } - if (command == "/guildsecret") + if(command == "/guildsecret") { secret = words[1]; return; } - if (command == "/guildweb") + if(command == "/guildweb") { web_page = words.GetTail(1); return; } - if (command == "/guildmotd") + if(command == "/guildmotd") { motd = words.GetTail(1); return; } - if (command == "/newalliance" || command == "/allianceremove") + if(command == "/newalliance" || command == "/allianceremove") { alliancename = words.GetTail(1); return; } - if (command == "/endalliance" || - command == "/allianceleave" || - command == "/guildinfo" || - command == "/guildwar" || - command == "/guildyield" ) + if(command == "/endalliance" || + command == "/allianceleave" || + command == "/guildinfo" || + command == "/guildwar" || + command == "/guildyield") { return; } @@ -1117,62 +1134,62 @@ valid = false; } -csString psGuildCmdMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psGuildCmdMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString msgtext; msgtext.AppendFmt("Command: '%s'",command.GetDataSafe()); - if (command == "/newguild" || command == "/endguild" || command == "/guildname" || command == "/guildpoints" ) + if(command == "/newguild" || command == "/endguild" || command == "/guildname" || command == "/guildpoints") { msgtext.AppendFmt("GuildName: '%s'",guildname.GetDataSafe()); return msgtext; } - if (command == "/guildinvite" || command == "/guildremove" || command == "/allianceinvite") + if(command == "/guildinvite" || command == "/guildremove" || command == "/allianceinvite") { msgtext.AppendFmt("Player: '%s'",player.GetDataSafe()); return msgtext; } - if (command == "/guildlevel") + if(command == "/guildlevel") { msgtext.AppendFmt("Level: %d LevelName: '%s'",level,levelname.GetDataSafe()); return msgtext; } - if (command == "/guildmembers") + if(command == "/guildmembers") { msgtext.AppendFmt("Level: %d",level); return msgtext; } - if (command == "/guildpromote") + if(command == "/guildpromote") { msgtext.AppendFmt("Player: '%s' Level: %d",player.GetDataSafe(),level); return msgtext; } - if (command == "/guildsecret") + if(command == "/guildsecret") { msgtext.AppendFmt("Secret: '%s'",secret.GetDataSafe()); return msgtext; } - if (command == "/guildweb") + if(command == "/guildweb") { msgtext.AppendFmt("Web page: '%s'",web_page.GetDataSafe()); return msgtext; } - if (command == "/guildmotd") + if(command == "/guildmotd") { msgtext.AppendFmt("Motd: '%s'",motd.GetDataSafe()); return msgtext; } - if (command == "/newalliance" || command == "/allianceremove" || command == "/allianceleader") + if(command == "/newalliance" || command == "/allianceremove" || command == "/allianceleader") { msgtext.AppendFmt("AlianceName: '%s'",alliancename.GetDataSafe()); return msgtext; } - if (command == "/endalliance" || - command == "/allianceleave" || - command == "/guildinfo" || - command == "/guildwar" || - command == "/guildyield" ) + if(command == "/endalliance" || + command == "/allianceleave" || + command == "/guildinfo" || + command == "/guildwar" || + command == "/guildyield") { return msgtext; } @@ -1186,8 +1203,8 @@ PSF_IMPLEMENT_MSG_FACTORY(psGUIGuildMessage,MSGTYPE_GUIGUILD); -psGUIGuildMessage::psGUIGuildMessage( uint32_t command, - csString commandData) +psGUIGuildMessage::psGUIGuildMessage(uint32_t command, + csString commandData) { msg.AttachNew(new MsgEntry(sizeof(command) + commandData.Length() + @@ -1196,16 +1213,16 @@ msg->SetType(MSGTYPE_GUIGUILD); msg->clientnum = 0; - msg->Add( command ); - msg->Add( commandData ); + msg->Add(command); + msg->Add(commandData); // Sets valid flag based on message overrun state valid=!(msg->overrun); } -psGUIGuildMessage::psGUIGuildMessage( uint32_t clientNum, - uint32_t command, - csString commandData) +psGUIGuildMessage::psGUIGuildMessage(uint32_t clientNum, + uint32_t command, + csString commandData) { msg.AttachNew(new MsgEntry(sizeof(command) + commandData.Length() + @@ -1214,16 +1231,16 @@ msg->SetType(MSGTYPE_GUIGUILD); msg->clientnum = clientNum; - msg->Add( command ); - msg->Add( commandData ); + msg->Add(command); + msg->Add(commandData); // Sets valid flag based on message overrun state valid=!(msg->overrun); } -psGUIGuildMessage::psGUIGuildMessage( MsgEntry* message ) +psGUIGuildMessage::psGUIGuildMessage(MsgEntry* message) { - if ( !message ) + if(!message) return; command = message->GetUInt32(); @@ -1233,7 +1250,7 @@ valid=!(message->overrun); } -csString psGUIGuildMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psGUIGuildMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString msgtext; @@ -1247,7 +1264,7 @@ PSF_IMPLEMENT_MSG_FACTORY(psGroupCmdMessage,MSGTYPE_GROUPCMD); -psGroupCmdMessage::psGroupCmdMessage(const char *cmd) +psGroupCmdMessage::psGroupCmdMessage(const char* cmd) { msg.AttachNew(new MsgEntry(strlen(cmd) + 1)); @@ -1260,7 +1277,7 @@ valid=!(msg->overrun); } -psGroupCmdMessage::psGroupCmdMessage(uint32_t clientnum,const char *cmd) +psGroupCmdMessage::psGroupCmdMessage(uint32_t clientnum,const char* cmd) { msg.AttachNew(new MsgEntry(strlen(cmd) + 1)); @@ -1275,22 +1292,22 @@ } -psGroupCmdMessage::psGroupCmdMessage(MsgEntry *message) +psGroupCmdMessage::psGroupCmdMessage(MsgEntry* message) { valid = true; WordArray words(message->GetStr()); command = words[0]; - if (command == "/invite" || command == "/groupremove" || command == "/groupchallenge") + if(command == "/invite" || command == "/groupremove" || command == "/groupchallenge") { player = words[1]; return; } - if (command == "/disband" || - command == "/leavegroup" || - command == "/groupmembers" || - command == "/groupyield") + if(command == "/disband" || + command == "/leavegroup" || + command == "/groupmembers" || + command == "/groupyield") { return; } @@ -1298,17 +1315,17 @@ valid = false; } -csString psGroupCmdMessage::ToString(NetBase::AccessPointers * /*accessPointers*/) +csString psGroupCmdMessage::ToString(NetBase::AccessPointers* /*accessPointers*/) { csString msgtext; msgtext.AppendFmt("Command: '%s'", command.GetDataSafe()); - if (command == "/invite" || command == "/groupremove") + if(command == "/invite" || command == "/groupremove") { msgtext.AppendFmt("Player: '%s'", player.GetDataSafe()); return msgtext; } - if (command == "/disband" || + if(command == "/disband" || command == "/leavegroup" || command == "/groupmembers") { @@ -1326,7 +1343,7 @@ PSF_IMPLEMENT_MSG_FACTORY(psUserCmdMessage,MSGTYPE_USERCMD); -psUserCmdMessage::psUserCmdMessage(const char *cmd) +psUserCmdMessage::psUserCmdMessage(const char* cmd) { msg.AttachNew(new MsgEntry(strlen(cmd) + 1)); @@ -1339,7 +1356,7 @@ valid=!(msg->overrun); } -psUserCmdMessage::psUserCmdMessage(MsgEntry *message) +psUserCmdMessage::psUserCmdMessage(MsgEntry* message) { valid = true; @@ -1347,132 +1364,132 @@ command = words[0]; - if (command == "/who") + if(command == "/who") { filter = words.GetTail(1); return; } - if (command == "/buddy") + if(command == "/buddy") { player = words[1]; //Holds the name of the player we are going to add/remove from the buddy list action = words[2]; //Holds if the player asked explictly to add or remove a buddy return; } - if ( command == "/pos" ) + if(command == "/pos") { player = words.GetTail(1); return; } - if ( command == "/admin" ) + if(command == "/admin") { if(words.GetCount() > 1) level = words.GetInt(1); else level = -1; } - if ( command == "/spawn" || - command == "/unstick" || - command == "/die" || - command == "/train" || - command == "/use" || - command == "/stopattack" || - command == "/starttrading" || - command == "/stoptrading" || - command == "/quests" || - command == "/tip" || - command == "/motd" || - command == "/challenge" || - command == "/yield" || - command == "/npcmenu" || - command == "/sit" || - command == "/stand" || - command == "/unmount") + if(command == "/spawn" || + command == "/unstick" || + command == "/die" || + command == "/train" || + command == "/use" || + command == "/stopattack" || + command == "/starttrading" || + command == "/stoptrading" || + command == "/quests" || + command == "/tip" || + command == "/motd" || + command == "/challenge" || + command == "/yield" || + command == "/npcmenu" || + command == "/sit" || + command == "/stand" || + command == "/unmount") { return; } - if (command == "/attack") + if(command == "/attack") { stance = words.Get(1); return; } - if (command == "/roll") + if(command == "/roll") { - if (words.GetCount() == 1) + if(words.GetCount() == 1) { dice = 1; sides = 6; - dtarget = 0; + dtarget = 0; } - else if (words.GetCount() == 2) + else if(words.GetCount() == 2) { dice = 1; sides = words.GetInt(1); - dtarget = 0; + dtarget = 0; } - else if (words.GetCount() == 3) + else if(words.GetCount() == 3) { dice = words.GetInt(1); sides = words.GetInt(2); - dtarget = 0; + dtarget = 0; } - else - { - dice = words.GetInt(1); - sides = words.GetInt(2); - dtarget = words.GetInt(3); - } + else + { + dice = words.GetInt(1); + sides = words.GetInt(2); + dtarget = words.GetInt(3); + } return; } - if ( command == "/assist" ) + if(command == "/assist") { player = words[1]; return; } - if ( command == "/marriage" ) + if(command == "/marriage") { action = words.Get(1); - if ( action == "propose" ) + if(action == "propose") { player = words.Get(2); text = words.GetTail(3); } - else if ( action == "divorce" ) + else if(action == "divorce") { text = words.GetTail(2); } return; } - if ( command == "/bank" ) + if(command == "/bank") { action = words.Get(1); return; } - if ( command == "/pickup" ) + if(command == "/pickup") { target = words.Get(1); return; } - if ( command == "/guard" ) + if(command == "/guard") { target = words.Get(1); action = words.Get(2); return; } - if ( command == "/mount" ) + if(command == "/mount") { target = words.Get(1); return; } - if ( command == "/rotate" ) + if(command == "/rotate") { target = words.Get(1); action = words.GetTail(2); return; } - if ( command == "/loot" ) + if(command == "/loot") { short i = 1; - + if(words.Get(i) == "roll") { dice = 1; @@ -1480,7 +1497,7 @@ } else dice = 0; ... [truncated message content] |