mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-29 23:15:56 -04:00
Revert "c++11, love you... although this may end up duplicating some items on"
This reverts commit 8a4cd1aeca.
This commit is contained in:
@@ -63,7 +63,7 @@ bool ObjvarBuffer::load(DB::Session *session,const DB::TagSet &tags, const std::
|
||||
break;
|
||||
}
|
||||
|
||||
IndexKey key = { row->object_id.getValue(), row->name_id.getValue() };
|
||||
IndexKey key(row->object_id.getValue(), row->name_id.getValue());
|
||||
ObjvarValue value;
|
||||
value.m_type=row->type.getValue();
|
||||
|
||||
@@ -100,7 +100,7 @@ bool ObjvarBuffer::load(DB::Session *session,const DB::TagSet &tags, const std::
|
||||
break;
|
||||
}
|
||||
|
||||
IndexKey key = { row->object_id.getValue(), row->name_id.getValue() };
|
||||
IndexKey key(row->object_id.getValue(), row->name_id.getValue());
|
||||
ObjvarValue value;
|
||||
value.m_type=row->type.getValue();
|
||||
|
||||
@@ -204,7 +204,7 @@ void ObjvarBuffer::getObjvarsForObject(const NetworkId &objectId, std::vector<Dy
|
||||
// unpacked object variables
|
||||
|
||||
{
|
||||
for (DataType::const_iterator i= m_data.lower_bound(IndexKey {objectId,0}); (i!=m_data.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;
|
||||
@@ -234,7 +234,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_overrides.lower_bound(IndexKey(objectId,0)); (i!=m_overrides.end()) && (i->first.m_objectId==objectId); ++i)
|
||||
{
|
||||
std::string name;
|
||||
bool foundName = false;
|
||||
@@ -279,10 +279,10 @@ void ObjvarBuffer::updateObjvars(const NetworkId &objectId, const std::vector<Dy
|
||||
{
|
||||
int nameId = ObjvarNameManager::getInstance().getOrAddNameId(i->key);
|
||||
|
||||
DataType::iterator row=m_data.find(IndexKey {objectId, nameId});
|
||||
DataType::iterator row=m_data.find(IndexKey(objectId, nameId));
|
||||
if (row==m_data.end())
|
||||
{
|
||||
row=m_data.insert(std::make_pair(IndexKey{objectId, nameId},ObjvarValue())).first;
|
||||
row=m_data.insert(std::make_pair(IndexKey(objectId, nameId),ObjvarValue())).first;
|
||||
if (i->cmd==DynamicVariableList::MapType::Command::ADD || override)
|
||||
row->second.m_inDatabase=false; // new variable
|
||||
else
|
||||
@@ -300,12 +300,12 @@ void ObjvarBuffer::updateObjvars(const NetworkId &objectId, const std::vector<Dy
|
||||
int nameId = ObjvarNameManager::getInstance().getNameId(i->key);
|
||||
if (nameId != 0) // It's possible to get an ERASE for a packed objvar where the name was never used in the OBJECT_VARIABLES table. We can safely ignore these.
|
||||
{
|
||||
DataType::iterator row=m_data.find(IndexKey {objectId, nameId});
|
||||
DataType::iterator row=m_data.find(IndexKey(objectId, nameId));
|
||||
if (row==m_data.end())
|
||||
{
|
||||
if (i->value.getPosition() == -1 || override)
|
||||
{
|
||||
row=m_data.insert(std::make_pair(IndexKey {objectId, nameId},ObjvarValue())).first;
|
||||
row=m_data.insert(std::make_pair(IndexKey(objectId, nameId),ObjvarValue())).first;
|
||||
row->second.m_inDatabase=true; // deleting existing variable
|
||||
}
|
||||
// else it was a packed objvar, and no update is necessary
|
||||
@@ -329,7 +329,7 @@ void ObjvarBuffer::updateObjvars(const NetworkId &objectId, const std::vector<Dy
|
||||
|
||||
void ObjvarBuffer::removeObject(const NetworkId &object)
|
||||
{
|
||||
DataType::iterator i=m_data.lower_bound(IndexKey {object,0});
|
||||
DataType::iterator i=m_data.lower_bound(IndexKey(object,0));
|
||||
while (i!=m_data.end() && i->first.m_objectId==object)
|
||||
{
|
||||
i = m_data.erase(i);
|
||||
|
||||
@@ -57,9 +57,13 @@ public:
|
||||
private:
|
||||
struct IndexKey
|
||||
{
|
||||
const NetworkId &m_objectId;
|
||||
NetworkId m_objectId;
|
||||
int m_nameId;
|
||||
|
||||
IndexKey(const NetworkId &objectId, int nameId);
|
||||
~IndexKey(){
|
||||
m_nameId = 0;
|
||||
}
|
||||
bool operator==(const IndexKey &rhs) const;
|
||||
bool operator<(const IndexKey &rhs) const;
|
||||
};
|
||||
@@ -70,6 +74,12 @@ public:
|
||||
std::string m_value;
|
||||
bool m_detached;
|
||||
bool m_inDatabase;
|
||||
~ObjvarValue(){
|
||||
m_type = 0;
|
||||
m_detached = 0;
|
||||
m_inDatabase = 0;
|
||||
m_value.clear();
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::map<IndexKey,ObjvarValue> DataType;
|
||||
@@ -82,6 +92,7 @@ public:
|
||||
|
||||
// typedef std::map<NetworkId,std::vector<DBSchema::ObjectVariableRow*> > LoadIndexType;
|
||||
// LoadIndexType m_loadIndex;
|
||||
|
||||
private:
|
||||
ObjvarBuffer(); //disable
|
||||
ObjvarBuffer(const ObjvarBuffer&); //disable
|
||||
@@ -90,6 +101,14 @@ public:
|
||||
|
||||
// ======================================================================
|
||||
|
||||
inline ObjvarBuffer::IndexKey::IndexKey(const NetworkId &objectId, int nameId) :
|
||||
m_objectId(objectId),
|
||||
m_nameId(nameId)
|
||||
{
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
inline bool ObjvarBuffer::IndexKey::operator==(const IndexKey &rhs) const
|
||||
{
|
||||
return ((m_objectId == rhs.m_objectId) && (m_nameId == rhs.m_nameId));
|
||||
|
||||
Reference in New Issue
Block a user