hopefully this fixes some more...

This commit is contained in:
DarthArgus
2014-10-26 22:20:06 -07:00
parent 9db3229116
commit eb2e7c78d8
23 changed files with 105 additions and 156 deletions
@@ -735,7 +735,6 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const
else if (message.isType("RequestSameServer"))
{
Archive::ReadIterator ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
GenericValueTypeMessage<std::pair<NetworkId, NetworkId> > msg(ri);
bool result=Scene::getInstance().requestSameServer(msg.getValue().first, msg.getValue().second);
@@ -751,7 +750,6 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const
else if (message.isType("RequestAuthTransfer"))
{
Archive::ReadIterator ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
GenericValueTypeMessage<std::pair<NetworkId, uint32> > msg(ri);
bool result=Scene::getInstance().requestAuthTransfer(msg.getValue().first, msg.getValue().second);
@@ -767,7 +765,6 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const
else if (message.isType("GameServerForceChangeAuthorityMessage"))
{
Archive::ReadIterator ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
GameServerForceChangeAuthorityMessage msg(ri);
GameServerData * fromServer = PlanetServer::getGameServerData(msg.getFromProcess());
GameServerData * toServer = PlanetServer::getGameServerData(msg.getToProcess());
@@ -805,7 +802,6 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const
else if (message.isType("FindAuthObjectResponse"))
{
Archive::ReadIterator ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
GenericValueTypeMessage<std::pair<std::pair<NetworkId, unsigned int>, bool> > msg(ri);
GameServerConnection const *gameServer = dynamic_cast<const GameServerConnection*>(&source);
NOT_NULL(gameServer);
@@ -814,7 +810,6 @@ void PlanetServer::receiveMessage(const MessageDispatch::Emitter & source, const
else if (message.isType("TaskProcessDiedMessage"))
{
Archive::ReadIterator ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
TaskProcessDiedMessage died(ri);
// verify it was a game server
const std::string & proc = died.getProcessName();
@@ -240,82 +240,75 @@ void TaskManager::remove()
void TaskManager::processRcFile()
{
AbstractFile * file = new StdioFile(ConfigTaskManager::getRcFileName(), "r");
if(file)
if(file->isOpen())
{
if(file->isOpen())
// read spawn directives
int fileLength = file->length();
if(fileLength > 0)
{
// read spawn directives
int fileLength = file->length();
if(fileLength > 0)
char * buffer = new char[fileLength + 1]; //lint !e737 Loss of sign in promotion from int to unsigned long
IGNORE_RETURN(memset(buffer, 0, fileLength + 1)); //lint !e732 loss of sign in promotion from int to unsigned long
int readResult = file->read(buffer, fileLength);
if(readResult > 0)
{
char * buffer = new char[fileLength + 1]; //lint !e737 Loss of sign in promotion from int to unsigned long
IGNORE_RETURN(memset(buffer, 0, fileLength + 1)); //lint !e732 loss of sign in promotion from int to unsigned long
int readResult = file->read(buffer, fileLength);
if(readResult > 0)
// parse the file
size_t start = 0;
std::string rcData = buffer;
while(start < rcData.size())
{
// parse the file
size_t start = 0;
std::string rcData = buffer;
while(start < rcData.size())
size_t recordEnd = rcData.find_first_of('\n', start);
if(recordEnd < std::string::npos)
{
size_t recordEnd = rcData.find_first_of('\n', start);
if(recordEnd < std::string::npos)
std::string record = rcData.substr(start, recordEnd - start);
if(record.length() > 0)
{
std::string record = rcData.substr(start, recordEnd - start);
if(record.length() > 0)
size_t firstChar = record.find_first_not_of(" \t");
if(firstChar < std::string::npos)
{
size_t firstChar = record.find_first_not_of(" \t");
if(record[firstChar] == '#')
{
start = recordEnd + 1;
continue;
}
}
ProcessEntry pe;
// get server name
size_t serverNameEndPos = record.find_first_of(' ', firstChar);
if(serverNameEndPos < std::string::npos)
{
pe.processName = record.substr(firstChar, serverNameEndPos - firstChar);
// get target host directive
firstChar = record.find_first_not_of(' ', serverNameEndPos);
if(firstChar < std::string::npos)
{
if(record[firstChar] == '#')
size_t hostEndPos = record.find_first_of(' ', firstChar);
if(hostEndPos < std::string::npos)
{
start = recordEnd + 1;
continue;
}
}
ProcessEntry pe;
// get server name
size_t serverNameEndPos = record.find_first_of(' ', firstChar);
if(serverNameEndPos < std::string::npos)
{
pe.processName = record.substr(firstChar, serverNameEndPos - firstChar);
// get target host directive
firstChar = record.find_first_not_of(' ', serverNameEndPos);
if(firstChar < std::string::npos)
{
size_t hostEndPos = record.find_first_of(' ', firstChar);
if(hostEndPos < std::string::npos)
pe.targetHost = record.substr(firstChar, hostEndPos - firstChar);
if(pe.targetHost != "any" && pe.targetHost != "local")
{
pe.targetHost = record.substr(firstChar, hostEndPos - firstChar);
if(pe.targetHost != "any" && pe.targetHost != "local")
{
Address a(pe.targetHost, 0);
pe.targetHost = a.getHostAddress();
}
Address a(pe.targetHost, 0);
pe.targetHost = a.getHostAddress();
}
// get executable name
firstChar = record.find_first_not_of(' ', hostEndPos);
if(firstChar < std::string::npos)
// get executable name
firstChar = record.find_first_not_of(' ', hostEndPos);
if(firstChar < std::string::npos)
{
size_t executableEndPos = record.find_first_of(' ', firstChar);
if(executableEndPos < std::string::npos)
{
size_t executableEndPos = record.find_first_of(' ', firstChar);
if(executableEndPos < std::string::npos)
pe.executable = record.substr(firstChar, executableEndPos - firstChar);
// get options
firstChar = record.find_first_not_of(' ', executableEndPos);
if(firstChar < std::string::npos)
{
pe.executable = record.substr(firstChar, executableEndPos - firstChar);
pe.options = record.substr(firstChar);
// get options
firstChar = record.find_first_not_of(' ', executableEndPos);
if(firstChar < std::string::npos)
{
pe.options = record.substr(firstChar);
IGNORE_RETURN(m_processEntries.insert(std::make_pair(pe.processName, pe)));
}
else
{
REPORT_LOG(true, ("Could not parse taskmanager.rc entry [%s]\n", record.c_str()));
}
IGNORE_RETURN(m_processEntries.insert(std::make_pair(pe.processName, pe)));
}
else
{
@@ -339,26 +332,29 @@ void TaskManager::processRcFile()
}
else
{
REPORT_LOG(true, ("Could not parse taskmanager.rc ent-ry [%s]\n", record.c_str()));
REPORT_LOG(true, ("Could not parse taskmanager.rc entry [%s]\n", record.c_str()));
}
}
else
{
REPORT_LOG(true, ("Could not parse taskmanager.rc ent-ry [%s]\n", record.c_str()));
}
// m_localServers.insert(std::pair<std::string, unsigned long>(record,0));
// IGNORE_RETURN(loadOnStart.insert(record));
}
}
else
{
break;
}
start = recordEnd + 1;
}
else
{
break;
}
start = recordEnd + 1;
}
delete [] buffer;
}
file->close();
delete file;
delete [] buffer;
}
file->close();
delete file;
}
}
//-----------------------------------------------------------------------
@@ -560,7 +560,6 @@ void DatabaseProcess::receiveMessage(const MessageDispatch::Emitter & source, co
else if (message.isType("ExcommunicateGameServerMessage"))
{
Archive::ReadIterator ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
ri = static_cast<const GameNetworkMessage &>(message).getByteStream().begin();
ExcommunicateGameServerMessage msg(ri);
LOG("GameGameConnect",("Database Process was told to drop connection to %lu by Central",msg.getServerId()));
@@ -52,8 +52,6 @@ bool TaskGetStructures::process(DB::Session *session)
{
StructureRec *cr=new StructureRec;
NOT_NULL(cr);
cr->structureId = NetworkId(qry.getData().object_id.getValue());
cr->location = Unicode::wideToNarrow(qry.getData().scene_id.getValue());
cr->objectTemplate = Unicode::wideToNarrow(qry.getData().object_template.getValue());
@@ -97,7 +97,6 @@ void BattlefieldMarkerObject::onRegionNameChanged(std::string const &oldName, st
Controller *BattlefieldMarkerObject::createDefaultController()
{
Controller * _controller = new BattlefieldMarkerController(this);
NOT_NULL(_controller);
setController(_controller);
return _controller;
@@ -416,7 +416,6 @@ void BuildingObject::removeDefaultTemplate(void)
Controller* BuildingObject::createDefaultController(void)
{
Controller* _controller = new BuildingController(this);
NOT_NULL(_controller);
setController(_controller);
return _controller;
@@ -84,7 +84,6 @@ CellObject::~CellObject()
Controller * CellObject::createDefaultController()
{
Controller *controller = new CellController(this);
NOT_NULL(controller);
setController(controller);
return controller;
}
@@ -114,7 +114,6 @@ CityObject::~CityObject()
Controller* CityObject::createDefaultController()
{
Controller* controller = new CityController(this);
NOT_NULL(controller);
setController(controller);
return controller;
@@ -326,7 +326,6 @@ bool DraftSchematicObject::getAttribMinMax(int index, int & minValue,
{
const SharedDraftSchematicObjectTemplate::SchematicAttribute & minAttrib =
getAttribMin(index);
minValue = minAttrib.value;
const SharedDraftSchematicObjectTemplate::SchematicAttribute & maxAttrib =
getAttribMax(index);
@@ -128,7 +128,7 @@ CrcString const & CallStackCollectorNamespace::Node::getName() const
void CallStackCollectorNamespace::Node::addCallStack(uint32 * const callStack)
{
//-- Compute crc of memory
uint32 const crc = Crc::calculate(callStack, sizeof(uint32) * CALLSTACK_DEPTH);
uint32 const crc = Crc::calculate(callStack, (sizeof(uint32) * CALLSTACK_DEPTH));
//-- Find callstack in list
CallStackEntryMap::iterator iter = m_callStackEntryMap.find(crc);
@@ -141,7 +141,7 @@ void CallStackCollectorNamespace::Node::addCallStack(uint32 * const callStack)
{
//-- Create new callstack
uint32 * const newCallStack = new uint32[CALLSTACK_DEPTH];
memcpy(newCallStack, callStack, sizeof(uint32) * CALLSTACK_DEPTH);
memcpy(newCallStack, callStack, (sizeof(uint32) * CALLSTACK_DEPTH));
CallStackEntry callStackEntry;
callStackEntry.m_callStack = newCallStack;
@@ -567,7 +567,6 @@ TerrainQuadTree::Node * TerrainQuadTree::Node::findChunkNode (const ProceduralTe
TerrainQuadTree::Node * TerrainQuadTree::Node::findFirstRenderablePeerNeighbor (const TerrainQuadTree::Node * const otherNode, const int dir)
{
NOT_NULL (this);
NOT_NULL (otherNode);
const int dir_offsets[4][2] =
@@ -595,7 +594,6 @@ TerrainQuadTree::Node * TerrainQuadTree::Node::findFirstRenderablePeerNeighbor (
TerrainQuadTree::Node * TerrainQuadTree::Node::findFirstRenderableLowerNeighbor (const TerrainQuadTree::Node * const otherNode, const int dir)
{
NOT_NULL (this);
NOT_NULL (otherNode);
const int halfSize = otherNode->getSize () / 2;
@@ -758,7 +758,7 @@ void AffectorRiver::createWaterTables (ArrayList<AffectorRiver::WaterTable>& wat
const Vector2d currentEndRight = currentEnd + currentNormal * waterWidth;
const Vector2d& previousStart = !atStart ? m_pointList [i - 1] : m_pointList [i];
const Vector2d& previousEnd = !atStart ? m_pointList [i] : m_pointList [i];
const Vector2d& previousEnd = m_pointList [i];
const Vector2d previousSegment = previousEnd - previousStart;
const Vector2d previousDirection = !atStart ? Vector2d::normalized (previousSegment) : currentDirection;
const Vector2d previousNormal = !atStart ? Vector2d::normal (previousDirection, false) : currentNormal;
@@ -768,7 +768,7 @@ void AffectorRiver::createWaterTables (ArrayList<AffectorRiver::WaterTable>& wat
const Vector2d previousEndLeft = previousEnd - previousNormal * waterWidth;
const Vector2d previousEndRight = previousEnd + previousNormal * waterWidth;
const Vector2d& nextStart = !atEndNext ? m_pointList [i + 1] : m_pointList [i + 1];
const Vector2d& nextStart = m_pointList [i + 1];
const Vector2d& nextEnd = !atEndNext ? m_pointList [i + 2] : m_pointList [i + 1];
const Vector2d nextSegment = nextEnd - nextStart;
const Vector2d nextDirection = !atEndNext ? Vector2d::normalized (nextSegment) : currentDirection;