mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-28 22:15:49 -04:00
Minor fixes including removing <> from make_pair usage and using explicit conversions where required by the explicit constructor flags
Now builds/runs using c++11
This commit is contained in:
@@ -180,7 +180,7 @@ void Squad::addUnit(NetworkId const & unit)
|
||||
|
||||
//-- Add the unit to the new squad
|
||||
|
||||
IGNORE_RETURN(m_unitMap->insert(std::make_pair(unit, &PersistentCrcString::empty)));
|
||||
IGNORE_RETURN(m_unitMap->insert(std::make_pair(CachedNetworkId(unit), &PersistentCrcString::empty)));
|
||||
|
||||
if (leader)
|
||||
{
|
||||
@@ -419,7 +419,7 @@ void Squad::buildFormation()
|
||||
NetworkId const & unit = iterSortedUnitList->second.first;
|
||||
PersistentCrcString const * unitName = iterSortedUnitList->second.second;
|
||||
|
||||
IGNORE_RETURN(m_unitMap->insert(std::make_pair(unit, unitName)));
|
||||
IGNORE_RETURN(m_unitMap->insert(std::make_pair(CachedNetworkId(unit), unitName)));
|
||||
}
|
||||
|
||||
m_formation.build(*this);
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
uint32 sequenceId,
|
||||
bool clearable,
|
||||
Command::Priority,
|
||||
bool auto );
|
||||
bool autoAttack );
|
||||
|
||||
CommandQueueEntry(CommandQueueEntry const &entry);
|
||||
CommandQueueEntry& operator=(CommandQueueEntry const &);
|
||||
|
||||
@@ -168,12 +168,12 @@ void CentralServerConnection::onReceive(const Archive::ByteStream & message)
|
||||
// return an appropriate response.
|
||||
if( object && object->isAuthoritative() )
|
||||
{
|
||||
GenericValueTypeMessage< std::pair< unsigned int, bool > > rmsg( "CSFindAuthObjectReply", std::make_pair< unsigned int, bool >( msg.getValue().second, true ) );
|
||||
GenericValueTypeMessage< std::pair< unsigned int, bool > > rmsg( "CSFindAuthObjectReply", std::make_pair( msg.getValue().second, true ) );
|
||||
GameServer::getInstance().sendToCentralServer( rmsg );
|
||||
}
|
||||
else
|
||||
{
|
||||
GenericValueTypeMessage< std::pair< unsigned int, bool > > rmsg( "CSFindAuthObjectReply", std::make_pair< unsigned int, bool >( msg.getValue().second, false ) );
|
||||
GenericValueTypeMessage< std::pair< unsigned int, bool > > rmsg( "CSFindAuthObjectReply", std::make_pair( msg.getValue().second, false ) );
|
||||
GameServer::getInstance().sendToCentralServer( rmsg );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,20 +108,20 @@ namespace PlanetObjectNamespace
|
||||
|
||||
if(index == std::string::npos)
|
||||
{
|
||||
parsedVector.push_back(std::make_pair<std::string, std::string::size_type>(eventString, 0));
|
||||
parsedVector.push_back(std::make_pair(eventString, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
while(index != std::string::npos)
|
||||
{
|
||||
std::string subString = eventString.substr(offset, (index - offset));
|
||||
parsedVector.push_back(std::make_pair<std::string, std::string::size_type>(subString, index));
|
||||
parsedVector.push_back(std::make_pair(subString, index));
|
||||
offset = index + 1;
|
||||
index = eventString.find(delimiter, offset);
|
||||
}
|
||||
|
||||
std::string subString = eventString.substr(offset, eventString.size());
|
||||
parsedVector.push_back(std::make_pair<std::string, std::string::size_type>(subString, index));
|
||||
parsedVector.push_back(std::make_pair(subString, index));
|
||||
}
|
||||
|
||||
const char * makeCopyOfString(const char * rhs)
|
||||
|
||||
@@ -279,7 +279,7 @@ void PlayerQuestObject::addNewTask(std::string title, std::string description, i
|
||||
{
|
||||
|
||||
m_taskStatus.push_back(0);
|
||||
m_taskCounters.push_back(std::make_pair<int,int>(0, counterMax));
|
||||
m_taskCounters.push_back(std::make_pair(0, counterMax));
|
||||
|
||||
m_waypoints.push_back(waypoint);
|
||||
|
||||
@@ -315,7 +315,7 @@ void PlayerQuestObject::readInObjVarData()
|
||||
std::vector<int> maxValues;
|
||||
if(getObjVars().getItem(s_taskMaxCounterObjVar, maxValues))
|
||||
for(std::vector<int>::size_type i = 0; i < counters.size(); ++i)
|
||||
m_taskCounters.push_back(std::make_pair<int,int>(counters[i], maxValues[i]));
|
||||
m_taskCounters.push_back(std::make_pair(counters[i], maxValues[i]));
|
||||
}
|
||||
|
||||
// Task Status
|
||||
@@ -463,7 +463,7 @@ std::string const & PlayerQuestObject::getTaskDescription(int index)
|
||||
void PlayerQuestObject::setTaskCounter(int index, int value)
|
||||
{
|
||||
int maxValue = m_taskCounters.get()[index].second;
|
||||
m_taskCounters.set(static_cast<unsigned int>(index), std::make_pair<int, int>(value, maxValue));
|
||||
m_taskCounters.set(static_cast<unsigned int>(index), std::make_pair(value, maxValue));
|
||||
|
||||
saveDataToObjVars();
|
||||
}
|
||||
|
||||
@@ -6190,7 +6190,7 @@ void TangibleObject::addUserToAccessList(const NetworkId user)
|
||||
}
|
||||
else
|
||||
{
|
||||
sendControllerMessageToAuthServer(CM_addUserToAccessList, new MessageQueueGenericValueType< std::pair<int, NetworkId> >(std::make_pair<int, NetworkId>(-1, user) ) );
|
||||
sendControllerMessageToAuthServer(CM_addUserToAccessList, new MessageQueueGenericValueType< std::pair<int, NetworkId> >(std::make_pair(-1, user) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6210,7 +6210,7 @@ void TangibleObject::addGuildToAccessList(int guildId)
|
||||
}
|
||||
else
|
||||
{
|
||||
sendControllerMessageToAuthServer(CM_addUserToAccessList, new MessageQueueGenericValueType< std::pair<int, NetworkId> >(std::make_pair<int, NetworkId>(guildId, NetworkId::cms_invalid) ) );
|
||||
sendControllerMessageToAuthServer(CM_addUserToAccessList, new MessageQueueGenericValueType< std::pair<int, NetworkId> >(std::make_pair(guildId, NetworkId::cms_invalid) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6239,7 +6239,7 @@ void TangibleObject::removeUserFromAccessList(const NetworkId user)
|
||||
}
|
||||
else
|
||||
{
|
||||
sendControllerMessageToAuthServer(CM_removeUserFromAccessList, new MessageQueueGenericValueType< std::pair<int, NetworkId> >(std::make_pair<int, NetworkId>(-1, user)));
|
||||
sendControllerMessageToAuthServer(CM_removeUserFromAccessList, new MessageQueueGenericValueType< std::pair<int, NetworkId> >(std::make_pair(-1, user)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6267,7 +6267,7 @@ void TangibleObject::removeGuildFromAccessList(int guildId)
|
||||
}
|
||||
else
|
||||
{
|
||||
sendControllerMessageToAuthServer(CM_removeUserFromAccessList, new MessageQueueGenericValueType< std::pair<int, NetworkId> >(std::make_pair<int, NetworkId>(guildId, NetworkId::cms_invalid)));
|
||||
sendControllerMessageToAuthServer(CM_removeUserFromAccessList, new MessageQueueGenericValueType< std::pair<int, NetworkId> >(std::make_pair(guildId, NetworkId::cms_invalid)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6543,7 +6543,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env
|
||||
{
|
||||
SlottedContainmentProperty::SlotArrangement const slots = slottedContainment->getSlotArrangement(slottedContainment->getCurrentArrangement()); // Get the old arrangement
|
||||
for(unsigned int j = 0; j < slots.size(); ++j)
|
||||
wornObjects.insert(std::make_pair<SlotId, const ServerObject*>(slots[j], item));
|
||||
wornObjects.insert(std::make_pair(slots[j], item));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6586,7 +6586,7 @@ jlongArray JNICALL ScriptMethodsObjectInfoNamespace::getAllWornItems(JNIEnv *env
|
||||
if(!slotOccupied)
|
||||
{
|
||||
for(unsigned int j = 0; j < slots.size(); ++j)
|
||||
wornObjects.insert(std::make_pair<SlotId, const ServerObject*>(slots[j], item));
|
||||
wornObjects.insert(std::make_pair(slots[j], item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ int PopulationList::getNearestPopulation(const std::string &scene, int x, int z)
|
||||
}
|
||||
}
|
||||
}
|
||||
m_populationCache.insert(std::make_pair<Location, int>(where,population));
|
||||
m_populationCache.insert(std::make_pair(where,population));
|
||||
return population;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,22 +66,6 @@ namespace std
|
||||
template <class _Key, class _Tp, class _Hash, class _Compare, class _Alloc> class unordered_map;
|
||||
template <class _Key, class _Hash, class _Compare, class _Alloc> class unordered_set;
|
||||
}
|
||||
|
||||
template <class ForwardIterator>
|
||||
bool is_sorted (ForwardIterator first, ForwardIterator last)
|
||||
{
|
||||
if (first==last) return true;
|
||||
ForwardIterator next = first;
|
||||
while (++next!=last) {
|
||||
if (*next<*first) // or, if (comp(*next,*first)) for version (2)
|
||||
return false;
|
||||
|
||||
++first;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template <class _Tp, class _Alloc = std::allocator<_Tp> > struct stddeque
|
||||
|
||||
@@ -543,8 +543,8 @@ void AiDebugString::addCircleAtObjectOffset(NetworkId const & target, Vector con
|
||||
// Object-space circle relative to the target
|
||||
|
||||
if (radius > 0.0f)
|
||||
{
|
||||
m_circleList->push_back(std::make_pair(target, std::make_pair(Circle(position_o, radius), color)));
|
||||
{
|
||||
m_circleList->push_back(std::make_pair(CachedNetworkId(target), std::make_pair(Circle(position_o, radius), color)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -100,7 +100,7 @@ void AppearanceManager::install()
|
||||
crcStringVector = new CrcStringVector();
|
||||
crcStringVector->reserve(static_cast<size_t>(numberOfColumns));
|
||||
|
||||
ms_objectTemplateAppearanceTemplateMap.insert(std::make_pair(new PersistentCrcString(crcSourceName), crcStringVector));
|
||||
ms_objectTemplateAppearanceTemplateMap.insert(std::make_pair((const CrcString*)new PersistentCrcString(crcSourceName), crcStringVector));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,35 +59,35 @@ extern "C"
|
||||
|
||||
// ======================================================================
|
||||
|
||||
void *operator new(size_t size, MemoryManagerNotALeak) throw (std::bad_alloc)
|
||||
void *operator new(size_t size, MemoryManagerNotALeak)
|
||||
{
|
||||
return MemoryManager::allocate(size, reinterpret_cast<uint32>(__builtin_return_address(0)), false, false);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void *operator new(size_t size) throw (std::bad_alloc)
|
||||
void *operator new(std::size_t size)
|
||||
{
|
||||
return MemoryManager::allocate(size, reinterpret_cast<uint32>(__builtin_return_address(0)), false, true);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void *operator new[](size_t size) throw (std::bad_alloc)
|
||||
void *operator new[](size_t size)
|
||||
{
|
||||
return MemoryManager::allocate(size, reinterpret_cast<uint32>(__builtin_return_address(0)), true, true);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void *operator new(size_t size, const char *file, int line) throw (std::bad_alloc)
|
||||
void *operator new(size_t size, const char *file, int line)
|
||||
{
|
||||
return MemoryManager::allocate(size, reinterpret_cast<uint32>(__builtin_return_address(0)), false, true);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void *operator new[](size_t size, const char *file, int line) throw (std::bad_alloc)
|
||||
void *operator new[](size_t size, const char *file, int line)
|
||||
{
|
||||
return MemoryManager::allocate(size, reinterpret_cast<uint32>(__builtin_return_address(0)), true, true);
|
||||
}
|
||||
|
||||
@@ -10,17 +10,18 @@
|
||||
#define INCLUDED_OsNewDel_H
|
||||
|
||||
// ======================================================================
|
||||
#include <cstddef>
|
||||
|
||||
enum MemoryManagerNotALeak
|
||||
{
|
||||
MM_notALeak
|
||||
};
|
||||
|
||||
void *operator new(size_t size, MemoryManagerNotALeak) throw(std::bad_alloc);
|
||||
void *operator new(size_t size) throw(std::bad_alloc);
|
||||
void *operator new[](size_t size) throw(std::bad_alloc);
|
||||
void *operator new(size_t size, char const *file, int line) throw(std::bad_alloc);
|
||||
void *operator new[](size_t size, char const *file, int line) throw(std::bad_alloc);
|
||||
void *operator new(size_t size, MemoryManagerNotALeak);
|
||||
void *operator new(size_t size);
|
||||
void *operator new[](std::size_t size);
|
||||
void *operator new(size_t size, char const *file, int line);
|
||||
void *operator new[](size_t size, char const *file, int line);
|
||||
|
||||
void operator delete(void *pointer) throw();
|
||||
void operator delete[](void *pointer) throw();
|
||||
|
||||
@@ -630,7 +630,7 @@ void AppearanceTemplateListNamespace::addNamedAppearanceTemplate(AppearanceTempl
|
||||
NOT_NULL(appearanceTemplate);
|
||||
|
||||
//-- add to named list
|
||||
std::pair<NamedTemplates::iterator, bool> result = ms_namedTemplates.insert(std::make_pair(&appearanceTemplate->getCrcName(), appearanceTemplate));
|
||||
std::pair<NamedTemplates::iterator, bool> result = ms_namedTemplates.insert(std::make_pair((const CrcString*)&appearanceTemplate->getCrcName(), appearanceTemplate));
|
||||
|
||||
//-- make sure it's not already there
|
||||
DEBUG_FATAL(!result.second, ("tried to add existing named appearanceTemplate %s", appearanceTemplate->getName()));
|
||||
@@ -649,7 +649,7 @@ void AppearanceTemplateListNamespace::addNamedTimedAppearanceTemplate(Appearance
|
||||
NOT_NULL(appearanceTemplate);
|
||||
|
||||
//-- add to named list
|
||||
std::pair<NamedTimedTemplates::iterator, bool> result = ms_namedTimedTemplates.insert(std::make_pair(&appearanceTemplate->getCrcName(), std::make_pair(ms_keepTime + Random::randomReal(ms_keepEpsilon), appearanceTemplate)));
|
||||
std::pair<NamedTimedTemplates::iterator, bool> result = ms_namedTimedTemplates.insert(std::make_pair((const CrcString*)&appearanceTemplate->getCrcName(), std::make_pair(ms_keepTime + Random::randomReal(ms_keepEpsilon), appearanceTemplate)));
|
||||
|
||||
//-- make sure it's not already there
|
||||
DEBUG_FATAL(!result.second, ("tried to add existing named timed appearanceTemplate %s", appearanceTemplate->getName()));
|
||||
|
||||
Reference in New Issue
Block a user