- fixed several self assignments
authorAkiko <akiko@linux-addicted.net>
Tue, 19 May 2015 09:46:01 +0000 (11:46 +0200)
committerAkiko <akiko@linux-addicted.net>
Tue, 19 May 2015 09:46:01 +0000 (11:46 +0200)
- fixed a return of a local reference
- fixed deprecated char/string convertions

TinNS/Source/Common/Message.hxx
TinNS/Source/GameServer/Container.cxx
TinNS/Source/GameServer/Container.hxx
TinNS/Source/GameServer/Decoder/UdpAnalyser.hxx
TinNS/Source/GameServer/Definitions/Definition.cxx
TinNS/Source/GameServer/Vehicle.cxx

index 30c19ee..0ff3623 100644 (file)
@@ -99,5 +99,5 @@ public:
     static void ListPools();
     static void DumpPools();
     void Dump();
-    void DumpHead(char* nComment = "");
+    void DumpHead(char* nComment = nullptr);
 };
index aa60f3c..64b1991 100644 (file)
@@ -616,9 +616,9 @@ bool PContainerAutoCompact::MoveItem( uint8_t srcSlotId, uint8_t nCount, uint8_t
 \r
 /* --- PContainer2D class --- */\r
 \r
-void PContainer2D::SetEntryPosXY( PContainerEntry* nEntry, uint8_t nSlotId, uint8_t nPosX, uint8_t nPosY )\r
+void PContainer2D::SetEntryPosXY( PContainerEntry* nEntry, uint8_t /*nSlotId*/, uint8_t nPosX, uint8_t nPosY )\r
 {\r
-  nSlotId = nSlotId;\r
+  //nSlotId = nSlotId;\r
   if (( nPosX >= INV_BACKPACK_COLS ) || ( nPosY == 255 ) )\r
   {\r
     nPosX = nPosY = 0;\r
@@ -631,7 +631,6 @@ void PContainer2D::SetEntryPosXY( PContainerEntry* nEntry, uint8_t nSlotId, uint
 /////\r
 PContainer2DWorkaround::PContainer2DWorkaround( uint8_t nMaxSlots ) : PContainerWithHoles( nMaxSlots )\r
 {\r
-  nMaxSlots = nMaxSlots;\r
   mNextFreeSlot = 0;\r
   mMaxCols = 254;\r
   mMaxRows = 254;\r
@@ -704,9 +703,9 @@ bool PContainer2DWorkaround::GetFreeSlot( uint8_t* nSlotId )
     return false;\r
 }\r
 \r
-void PContainer2DWorkaround::SetEntryPosXY( PContainerEntry* nEntry, uint8_t nSlotId, uint8_t nPosX, uint8_t nPosY )\r
+void PContainer2DWorkaround::SetEntryPosXY( PContainerEntry* nEntry, uint8_t /*nSlotId*/, uint8_t nPosX, uint8_t nPosY )\r
 {\r
-  nSlotId = nSlotId;\r
+  //nSlotId = nSlotId;\r
   if (( nPosX == 255 ) && ( nPosY == 255 ) )\r
   {\r
     nEntry->Set2DPos( 255, 255 );\r
index 4037b79..58bc238 100644 (file)
@@ -113,7 +113,7 @@ class PContainer // Holes allowed, no autofind free slots
 class PContainerWithHoles : public PContainer // Holes allowed, no autofind free slots\r
 {\r
   public:\r
-    PContainerWithHoles(uint8_t nMaxSlots = 0) : PContainer(nMaxSlots){ nMaxSlots = nMaxSlots; }\r
+    PContainerWithHoles(uint8_t nMaxSlots = 0) : PContainer(nMaxSlots) {}\r
     virtual ~PContainerWithHoles() {}\r
 };\r
 \r
@@ -125,7 +125,7 @@ protected:
     virtual bool GetFreeSlot(uint8_t* nSlotId);\r
 \r
 public:\r
-    PContainerAutoCompact(uint8_t nMaxSlots = 0) : PContainer(nMaxSlots){ nMaxSlots = nMaxSlots; }\r
+    PContainerAutoCompact(uint8_t nMaxSlots = 0) : PContainer(nMaxSlots) {}\r
     virtual ~PContainerAutoCompact() {}\r
     virtual bool MoveItem(uint8_t srcSlotId, uint8_t nCount, uint8_t dstSlotId);\r
 };\r
@@ -134,7 +134,7 @@ public:
 class PContainer2D : public PContainerAutoCompact // + slotId not used, non-significant XY used (no XY check yet)\r
 {\r
   public:\r
-    PContainer2D(uint8_t nMaxSlots = 0) : PContainerAutoCompact(nMaxSlots){ nMaxSlots = nMaxSlots; }\r
+    PContainer2D(uint8_t nMaxSlots = 0) : PContainerAutoCompact(nMaxSlots) {}\r
     virtual ~PContainer2D() {}\r
 \r
         virtual void SetEntryPosXY(PContainerEntry* nEntry, uint8_t nSlotId, uint8_t nPosX = 0, uint8_t nPosY = 0);\r
@@ -180,14 +180,14 @@ class PContainerAutoFindFree : public PContainerWithHoles // No holes kept after
     virtual bool GetFreeSlot(uint8_t* nSlotId);\r
 \r
   public:\r
-    PContainerAutoFindFree(uint8_t nMaxSlots = 0) : PContainerWithHoles(nMaxSlots){ nMaxSlots = nMaxSlots; }\r
+    PContainerAutoFindFree(uint8_t nMaxSlots = 0) : PContainerWithHoles(nMaxSlots) {}\r
     virtual ~PContainerAutoFindFree() {}\r
 };\r
 \r
 class PContainerAutoCompactOnClose : public PContainerAutoFindFree // No holes kept after EndUse, automatic find first free slots (no control on insertion slot)\r
 {\r
   public:\r
-    PContainerAutoCompactOnClose(uint8_t nMaxSlots = 0) : PContainerAutoFindFree(nMaxSlots){ nMaxSlots = nMaxSlots; }\r
+    PContainerAutoCompactOnClose(uint8_t nMaxSlots = 0) : PContainerAutoFindFree(nMaxSlots) {}\r
     virtual ~PContainerAutoCompactOnClose() {}\r
 \r
     virtual bool EndUse(uint32_t nExclusiveUseCharID = 0);\r
index 8215ab5..9c98d48 100644 (file)
@@ -2,7 +2,7 @@
 \r
 #include <cstdint>\r
 \r
-class PMsgDecodeData;\r
+struct PMsgDecodeData;\r
 \r
 class PUdpMsgAnalyser {\r
     friend class PUdpMsgDecoder;\r
index 6eb9c6d..17f9911 100644 (file)
@@ -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;
 }
index 2eb6e05..33276b4 100644 (file)
@@ -259,9 +259,9 @@ bool PVehicles::IsValidVehicle( uint32_t nVehicleId, bool nCheckOwner, uint32_t
 {\r
   // Look in DB\r
   // tmp\r
-  uint32_t tVehicleId = nVehicleId; tVehicleId = tVehicleId;\r
-  bool tCheckOwner = nCheckOwner; tCheckOwner = tCheckOwner;\r
-  uint32_t tOwnerId = nOwnerId; tOwnerId = tOwnerId;\r
+  uint32_t tVehicleId = nVehicleId;\r
+  bool tCheckOwner = nCheckOwner;\r
+  uint32_t tOwnerId = nOwnerId;\r
   return true; // tmp\r
 }\r
 \r