From 3dcf3295ec11037cba2d5e1042db092331bcd9f6 Mon Sep 17 00:00:00 2001 From: Akiko Date: Tue, 19 May 2015 11:46:01 +0200 Subject: [PATCH] - fixed several self assignments - fixed a return of a local reference - fixed deprecated char/string convertions --- TinNS/Source/Common/Message.hxx | 2 +- TinNS/Source/GameServer/Container.cxx | 9 ++++----- TinNS/Source/GameServer/Container.hxx | 10 +++++----- TinNS/Source/GameServer/Decoder/UdpAnalyser.hxx | 2 +- TinNS/Source/GameServer/Definitions/Definition.cxx | 8 +++++--- TinNS/Source/GameServer/Vehicle.cxx | 6 +++--- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/TinNS/Source/Common/Message.hxx b/TinNS/Source/Common/Message.hxx index 30c19ee..0ff3623 100644 --- a/TinNS/Source/Common/Message.hxx +++ b/TinNS/Source/Common/Message.hxx @@ -99,5 +99,5 @@ public: static void ListPools(); static void DumpPools(); void Dump(); - void DumpHead(char* nComment = ""); + void DumpHead(char* nComment = nullptr); }; diff --git a/TinNS/Source/GameServer/Container.cxx b/TinNS/Source/GameServer/Container.cxx index aa60f3c..64b1991 100644 --- a/TinNS/Source/GameServer/Container.cxx +++ b/TinNS/Source/GameServer/Container.cxx @@ -616,9 +616,9 @@ bool PContainerAutoCompact::MoveItem( uint8_t srcSlotId, uint8_t nCount, uint8_t /* --- PContainer2D class --- */ -void PContainer2D::SetEntryPosXY( PContainerEntry* nEntry, uint8_t nSlotId, uint8_t nPosX, uint8_t nPosY ) +void PContainer2D::SetEntryPosXY( PContainerEntry* nEntry, uint8_t /*nSlotId*/, uint8_t nPosX, uint8_t nPosY ) { - nSlotId = nSlotId; + //nSlotId = nSlotId; if (( nPosX >= INV_BACKPACK_COLS ) || ( nPosY == 255 ) ) { nPosX = nPosY = 0; @@ -631,7 +631,6 @@ void PContainer2D::SetEntryPosXY( PContainerEntry* nEntry, uint8_t nSlotId, uint ///// PContainer2DWorkaround::PContainer2DWorkaround( uint8_t nMaxSlots ) : PContainerWithHoles( nMaxSlots ) { - nMaxSlots = nMaxSlots; mNextFreeSlot = 0; mMaxCols = 254; mMaxRows = 254; @@ -704,9 +703,9 @@ bool PContainer2DWorkaround::GetFreeSlot( uint8_t* nSlotId ) return false; } -void PContainer2DWorkaround::SetEntryPosXY( PContainerEntry* nEntry, uint8_t nSlotId, uint8_t nPosX, uint8_t nPosY ) +void PContainer2DWorkaround::SetEntryPosXY( PContainerEntry* nEntry, uint8_t /*nSlotId*/, uint8_t nPosX, uint8_t nPosY ) { - nSlotId = nSlotId; + //nSlotId = nSlotId; if (( nPosX == 255 ) && ( nPosY == 255 ) ) { nEntry->Set2DPos( 255, 255 ); diff --git a/TinNS/Source/GameServer/Container.hxx b/TinNS/Source/GameServer/Container.hxx index 4037b79..58bc238 100644 --- a/TinNS/Source/GameServer/Container.hxx +++ b/TinNS/Source/GameServer/Container.hxx @@ -113,7 +113,7 @@ class PContainer // Holes allowed, no autofind free slots class PContainerWithHoles : public PContainer // Holes allowed, no autofind free slots { public: - PContainerWithHoles(uint8_t nMaxSlots = 0) : PContainer(nMaxSlots){ nMaxSlots = nMaxSlots; } + PContainerWithHoles(uint8_t nMaxSlots = 0) : PContainer(nMaxSlots) {} virtual ~PContainerWithHoles() {} }; @@ -125,7 +125,7 @@ protected: virtual bool GetFreeSlot(uint8_t* nSlotId); public: - PContainerAutoCompact(uint8_t nMaxSlots = 0) : PContainer(nMaxSlots){ nMaxSlots = nMaxSlots; } + PContainerAutoCompact(uint8_t nMaxSlots = 0) : PContainer(nMaxSlots) {} virtual ~PContainerAutoCompact() {} virtual bool MoveItem(uint8_t srcSlotId, uint8_t nCount, uint8_t dstSlotId); }; @@ -134,7 +134,7 @@ public: class PContainer2D : public PContainerAutoCompact // + slotId not used, non-significant XY used (no XY check yet) { public: - PContainer2D(uint8_t nMaxSlots = 0) : PContainerAutoCompact(nMaxSlots){ nMaxSlots = nMaxSlots; } + PContainer2D(uint8_t nMaxSlots = 0) : PContainerAutoCompact(nMaxSlots) {} virtual ~PContainer2D() {} virtual void SetEntryPosXY(PContainerEntry* nEntry, uint8_t nSlotId, uint8_t nPosX = 0, uint8_t nPosY = 0); @@ -180,14 +180,14 @@ class PContainerAutoFindFree : public PContainerWithHoles // No holes kept after virtual bool GetFreeSlot(uint8_t* nSlotId); public: - PContainerAutoFindFree(uint8_t nMaxSlots = 0) : PContainerWithHoles(nMaxSlots){ nMaxSlots = nMaxSlots; } + PContainerAutoFindFree(uint8_t nMaxSlots = 0) : PContainerWithHoles(nMaxSlots) {} virtual ~PContainerAutoFindFree() {} }; class PContainerAutoCompactOnClose : public PContainerAutoFindFree // No holes kept after EndUse, automatic find first free slots (no control on insertion slot) { public: - PContainerAutoCompactOnClose(uint8_t nMaxSlots = 0) : PContainerAutoFindFree(nMaxSlots){ nMaxSlots = nMaxSlots; } + PContainerAutoCompactOnClose(uint8_t nMaxSlots = 0) : PContainerAutoFindFree(nMaxSlots) {} virtual ~PContainerAutoCompactOnClose() {} virtual bool EndUse(uint32_t nExclusiveUseCharID = 0); diff --git a/TinNS/Source/GameServer/Decoder/UdpAnalyser.hxx b/TinNS/Source/GameServer/Decoder/UdpAnalyser.hxx index 8215ab5..9c98d48 100644 --- a/TinNS/Source/GameServer/Decoder/UdpAnalyser.hxx +++ b/TinNS/Source/GameServer/Decoder/UdpAnalyser.hxx @@ -2,7 +2,7 @@ #include -class PMsgDecodeData; +struct PMsgDecodeData; class PUdpMsgAnalyser { friend class PUdpMsgDecoder; diff --git a/TinNS/Source/GameServer/Definitions/Definition.cxx b/TinNS/Source/GameServer/Definitions/Definition.cxx index 6eb9c6d..17f9911 100644 --- a/TinNS/Source/GameServer/Definitions/Definition.cxx +++ b/TinNS/Source/GameServer/Definitions/Definition.cxx @@ -1,5 +1,7 @@ #include "GameServer/Definitions/Includes.hxx" +const std::string EmptyString; + PDef::PDef() : mIndex(0) { @@ -9,9 +11,9 @@ PDef::~PDef() { } -bool PDef::LoadFromDef(PTokenList *Tokens) +bool PDef::LoadFromDef(PTokenList * /*Tokens*/) { - Tokens = Tokens; + //Tokens = Tokens; return false; } @@ -23,5 +25,5 @@ int32_t PDef::GetIndex() const const std::string &PDef::GetName() const { - return ""; + return EmptyString; } diff --git a/TinNS/Source/GameServer/Vehicle.cxx b/TinNS/Source/GameServer/Vehicle.cxx index 2eb6e05..33276b4 100644 --- a/TinNS/Source/GameServer/Vehicle.cxx +++ b/TinNS/Source/GameServer/Vehicle.cxx @@ -259,9 +259,9 @@ bool PVehicles::IsValidVehicle( uint32_t nVehicleId, bool nCheckOwner, uint32_t { // Look in DB // tmp - uint32_t tVehicleId = nVehicleId; tVehicleId = tVehicleId; - bool tCheckOwner = nCheckOwner; tCheckOwner = tCheckOwner; - uint32_t tOwnerId = nOwnerId; tOwnerId = tOwnerId; + uint32_t tVehicleId = nVehicleId; + bool tCheckOwner = nCheckOwner; + uint32_t tOwnerId = nOwnerId; return true; // tmp } -- 2.15.1