fix a few areas that vc++ 2012 pointed to as potential bugs

This commit is contained in:
Mark Vejvoda 2013-06-07 23:17:27 +00:00
parent 9a7fba2842
commit 4499308888
4 changed files with 5 additions and 3 deletions

View File

@ -1160,7 +1160,7 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] producers.size() = %d, producerIndex = %d, pIndex = %d, producersDefaultCommandType.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,producers.size(),producerIndex,pIndex,producersDefaultCommandType.size());
if(ai->outputAIBehaviourToConsole()) printf("produceSpecific giveCommand to unit [%s] commandType [%s]\n",aiInterface->getMyUnit(producerIndex)->getType()->getName().c_str(),defCt->getName().c_str());
if(ai->outputAIBehaviourToConsole()) printf("produceSpecific giveCommand to unit [%s] commandType [%s]\n",aiInterface->getMyUnit(producerIndex)->getType()->getName().c_str(),(defCt != NULL ? defCt->getName().c_str() : "n/a"));
if(aiInterface->isLogLevelEnabled(4) == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(producerIndex)->getType()->getName().c_str(),(defCt != NULL ? defCt->getName().c_str() : "(null)"));

View File

@ -1085,7 +1085,6 @@ bool NetworkMessageLaunch::receive(Socket* socket) {
}
for(unsigned int i = 0; i < maxFactionCRCCount; ++i) {
data.factionNameList[i].nullTerminate();
data.networkPlayerUUID[i].nullTerminate();
}
data.scenario.nullTerminate();

View File

@ -2336,6 +2336,9 @@ void ServerInterface::broadcastGameSetup(GameSettings *gameSettingsBuffer, bool
}
}
if(setGameSettingsBuffer == true) {
if(gameSettingsBuffer == NULL) {
throw megaglest_runtime_error("gameSettingsBuffer == NULL");
}
validateGameSettings(gameSettingsBuffer);
//setGameSettings(gameSettingsBuffer,false);
MutexSafeWrapper safeMutex(serverSynchAccessor,CODE_AT_LINE);

View File

@ -1771,7 +1771,7 @@ void UnitUpdater::updateRepair(Unit *unit, int frameIndex) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] rct = %p\n",__FILE__,__FUNCTION__,__LINE__,rct);
Unit *repaired = map->getCell(command->getPos())->getUnitWithEmptyCellMap(fLand);
Unit *repaired = (command != NULL ? map->getCell(command->getPos())->getUnitWithEmptyCellMap(fLand) : NULL);
if(repaired == NULL) {
repaired = map->getCell(command->getPos())->getUnit(fLand);
}