It's 2016 and C++11 supports these natively

This commit is contained in:
DarthArgus
2016-12-15 03:01:41 +00:00
parent 18cb7d0e95
commit 3bdc77a5d2
5 changed files with 28 additions and 11 deletions
@@ -47,6 +47,7 @@ public:
NetworkId& operator= (const NetworkId&);
bool operator< (const NetworkId& rhs) const;
bool operator> (const NetworkId& rhs) const;
bool operator== (const NetworkId& rhs) const;
bool operator!= (const NetworkId& rhs) const;
size_t getHashValue() const;
@@ -94,6 +95,11 @@ inline bool NetworkId::operator< (const NetworkId& rhs) const
return m_value < rhs.m_value;
}
inline bool NetworkId::operator> (const NetworkId& rhs) const
{
return m_value > rhs.m_value;
}
// -----------------------------------------------------------------------
inline bool NetworkId::operator== (const NetworkId& rhs) const
@@ -10,6 +10,7 @@
#define PLATFORM_LINUX
#include <cstdio>
#include <inttypes.h>
// ======================================================================
// basic types that we assume to be around
@@ -20,8 +21,8 @@ typedef unsigned long uint32;
typedef signed char int8;
typedef signed short int16;
typedef signed long int32;
typedef signed long long int int64;
typedef unsigned long long int uint64;
typedef int64_t int64;
typedef uint64_t uint64;
typedef float real;
typedef FILE* FILE_HANDLE;
@@ -39,7 +39,6 @@ ObjvarBuffer::ObjvarBuffer(DB::ModeQuery::Mode mode, ObjectTableBuffer *objectTa
ObjvarBuffer::~ObjvarBuffer()
{
m_data.clear();
m_overrides.clear();
}
bool ObjvarBuffer::load(DB::Session *session,const DB::TagSet &tags, const std::string &schema, bool usingGoldDatabase)
@@ -109,7 +108,7 @@ bool ObjvarBuffer::load(DB::Session *session,const DB::TagSet &tags, const std::
value.m_detached=false;
m_overrides.insert(std::make_pair(key,value));
m_data.insert(std::make_pair(key,value));
}
}
@@ -234,7 +233,7 @@ void ObjvarBuffer::getObjvarsForObject(const NetworkId &objectId, std::vector<Dy
// The last objvar sent to the game takes precedence, so we want to send the overrides after the values read in through the regular process
{
for (DataType::const_iterator i= m_overrides.lower_bound(IndexKey(objectId,0)); (i!=m_overrides.end()) && (i->first.m_objectId==objectId); ++i)
for (DataType::const_iterator i= m_data.lower_bound(IndexKey(objectId,0)); (i!=m_data.end()) && (i->first.m_objectId==objectId); ++i)
{
std::string name;
bool foundName = false;
@@ -16,7 +16,7 @@
#include "sharedFoundation/DynamicVariableList.h"
#include <map>
#include <string>
#include <memory>
// ======================================================================
class ObjectTableBuffer;
@@ -63,6 +63,7 @@ public:
IndexKey(const NetworkId &objectId, int nameId);
bool operator==(const IndexKey &rhs) const;
bool operator<(const IndexKey &rhs) const;
bool operator>(const IndexKey &rhs) const;
};
struct ObjvarValue
@@ -77,7 +78,6 @@ public:
DB::ModeQuery::Mode m_mode;
DataType m_data;
DataType m_overrides;
ObjectTableBuffer *m_objectTableBuffer;
bool m_useGoldNames;
@@ -109,10 +109,22 @@ inline bool ObjvarBuffer::IndexKey::operator<(const IndexKey &rhs) const
{
if (m_objectId < rhs.m_objectId)
return true;
else if (m_objectId == rhs.m_objectId)
if (m_objectId == rhs.m_objectId)
return (m_nameId < rhs.m_nameId);
else
return false;
return false;
}
inline bool ObjvarBuffer::IndexKey::operator>(const IndexKey &rhs) const
{
if (m_objectId > rhs.m_objectId)
return true;
if (m_objectId == rhs.m_objectId)
return (m_nameId > rhs.m_nameId);
return false;
}
// ======================================================================
@@ -140,7 +140,6 @@ SwgSnapshot::SwgSnapshot(DB::ModeQuery::Mode mode, bool useGoldDatabase) :
// ----------------------------------------------------------------------
SwgSnapshot::~SwgSnapshot(){
m_bufferList.clear();
}
// ----------------------------------------------------------------------