- lots more code cleanup, using safe buffer size code to avoid buffer overflows
This commit is contained in:
parent
39191dc11e
commit
011e0263b0
|
@ -220,7 +220,7 @@ void Renderer::init() {
|
|||
|
||||
if(glActiveTexture == NULL) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"Error: glActiveTexture == NULL\nglActiveTexture is only supported if the GL version is 1.3 or greater,\nor if the ARB_multitexture extension is supported!");
|
||||
snprintf(szBuf,8096,"Error: glActiveTexture == NULL\nglActiveTexture is only supported if the GL version is 1.3 or greater,\nor if the ARB_multitexture extension is supported!");
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -370,7 +370,7 @@ void Ai::update() {
|
|||
}
|
||||
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"AI for faction# %d voted %s [%d] CountCurrent [%d] PercentChance [%d]",aiInterface->getMyFaction()->getIndex(),(voteResult->allowSwitchTeam ? "Yes" : "No"),allowJoinTeam,factionSwitchTeamRequestCountCurrent,settings->getAiAcceptSwitchTeamPercentChance());
|
||||
snprintf(szBuf,8096,"AI for faction# %d voted %s [%d] CountCurrent [%d] PercentChance [%d]",aiInterface->getMyFaction()->getIndex(),(voteResult->allowSwitchTeam ? "Yes" : "No"),allowJoinTeam,factionSwitchTeamRequestCountCurrent,settings->getAiAcceptSwitchTeamPercentChance());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,szBuf);
|
||||
|
||||
aiInterface->printLog(3, szBuf);
|
||||
|
@ -460,7 +460,7 @@ const ResourceType *Ai::getNeededResource(int unitIndex) {
|
|||
|
||||
if( rt->getClass() != rcStatic && rt->getClass() != rcConsumable) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"Examining resource [%s] amount [%d] (previous amount [%d]",rt->getName().c_str(),r->getAmount(),amount);
|
||||
snprintf(szBuf,8096,"Examining resource [%s] amount [%d] (previous amount [%d]",rt->getName().c_str(),r->getAmount(),amount);
|
||||
aiInterface->printLog(3, szBuf);
|
||||
}
|
||||
|
||||
|
@ -487,9 +487,9 @@ const ResourceType *Ai::getNeededResource(int unitIndex) {
|
|||
}
|
||||
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"Unit [%d - %s] looking for resources (not static or consumable)",unit->getId(),unit->getType()->getName().c_str());
|
||||
snprintf(szBuf,8096,"Unit [%d - %s] looking for resources (not static or consumable)",unit->getId(),unit->getType()->getName().c_str());
|
||||
aiInterface->printLog(3, szBuf);
|
||||
sprintf(szBuf,"[resource type count %d] Needed resource [%s].",tt->getResourceTypeCount(),(neededResource != NULL ? neededResource->getName().c_str() : "<none>"));
|
||||
snprintf(szBuf,8096,"[resource type count %d] Needed resource [%s].",tt->getResourceTypeCount(),(neededResource != NULL ? neededResource->getName().c_str() : "<none>"));
|
||||
aiInterface->printLog(3, szBuf);
|
||||
|
||||
return neededResource;
|
||||
|
@ -504,14 +504,14 @@ bool Ai::isStableBase() {
|
|||
UnitClass ucWorkerType = ucWorker;
|
||||
if(getCountOfClass(ucWarrior,&ucWorkerType) > minWarriors) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"Base is stable [minWarriors = %d found = %d]",minWarriors,ucWorkerType);
|
||||
snprintf(szBuf,8096,"Base is stable [minWarriors = %d found = %d]",minWarriors,ucWorkerType);
|
||||
aiInterface->printLog(4, szBuf);
|
||||
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"Base is NOT stable [minWarriors = %d found = %d]",minWarriors,ucWorkerType);
|
||||
snprintf(szBuf,8096,"Base is NOT stable [minWarriors = %d found = %d]",minWarriors,ucWorkerType);
|
||||
aiInterface->printLog(4, szBuf);
|
||||
|
||||
return false;
|
||||
|
|
|
@ -157,25 +157,25 @@ CommandResult AiInterface::giveCommand(const Unit *unit, const CommandType *comm
|
|||
assert(this->gameSettings != NULL);
|
||||
|
||||
if(unit == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Can not find AI unit in AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Can not find AI unit in AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
const UnitType* unitType= unit->getType();
|
||||
if(unitType == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Can not find AI unittype with unit id: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unit->getId(),factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Can not find AI unittype with unit id: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unit->getId(),factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
if(commandType == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] commandType == NULL, unit id: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unit->getId(),factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] commandType == NULL, unit id: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unit->getId(),factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
const CommandType* ct= unit->getType()->findCommandTypeById(commandType->getId());
|
||||
if(ct == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d]\nCan not find AI command type for:\nunit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nGame out of synch.",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nCan not find AI command type for:\nunit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nGame out of synch.",
|
||||
__FILE__,__FUNCTION__,__LINE__,
|
||||
unit->getId(), unit->getFullName().c_str(),unit->getDesc().c_str(),
|
||||
unit->getFaction()->getIndex());
|
||||
|
@ -211,20 +211,20 @@ CommandResult AiInterface::giveCommand(int unitIndex, const CommandType *command
|
|||
|
||||
const Unit *unit = getMyUnit(unitIndex);
|
||||
if(unit == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Can not find AI unit with index: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unitIndex,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Can not find AI unit with index: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unitIndex,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
const UnitType* unitType= unit->getType();
|
||||
if(unitType == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Can not find AI unittype with unit index: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unitIndex,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Can not find AI unittype with unit index: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unitIndex,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
const CommandType* ct= unit->getType()->findCommandTypeById(commandType->getId());
|
||||
if(ct == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d]\nCan not find AI command type for:\nunit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nGame out of synch.",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nCan not find AI command type for:\nunit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nGame out of synch.",
|
||||
__FILE__,__FUNCTION__,__LINE__,
|
||||
unit->getId(), unit->getFullName().c_str(),unit->getDesc().c_str(),
|
||||
unit->getFaction()->getIndex());
|
||||
|
@ -258,20 +258,20 @@ CommandResult AiInterface::giveCommand(int unitIndex, const CommandType *command
|
|||
|
||||
const Unit *unit = getMyUnit(unitIndex);
|
||||
if(unit == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Can not find AI unit with index: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unitIndex,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Can not find AI unit with index: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unitIndex,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
const UnitType* unitType= unit->getType();
|
||||
if(unitType == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Can not find AI unittype with unit index: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unitIndex,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Can not find AI unittype with unit index: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unitIndex,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
const CommandType* ct= unit->getType()->findCommandTypeById(commandType->getId());
|
||||
if(ct == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d]\nCan not find AI command type for:\nunit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nGame out of synch.",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nCan not find AI command type for:\nunit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nGame out of synch.",
|
||||
__FILE__,__FUNCTION__,__LINE__,
|
||||
unit->getId(), unit->getFullName().c_str(),unit->getDesc().c_str(),
|
||||
unit->getFaction()->getIndex());
|
||||
|
@ -305,20 +305,20 @@ CommandResult AiInterface::giveCommand(int unitIndex, const CommandType *command
|
|||
|
||||
const Unit *unit = getMyUnit(unitIndex);
|
||||
if(unit == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Can not find AI unit with index: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unitIndex,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Can not find AI unit with index: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unitIndex,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
const UnitType* unitType= unit->getType();
|
||||
if(unitType == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Can not find AI unittype with unit index: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unitIndex,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Can not find AI unittype with unit index: %d, AI factionIndex = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,unitIndex,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
const CommandType* ct= (commandType != NULL ? unit->getType()->findCommandTypeById(commandType->getId()) : NULL);
|
||||
if(ct == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d]\nCan not find AI command type for:\nunit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nGame out of synch.",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nCan not find AI command type for:\nunit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nGame out of synch.",
|
||||
__FILE__,__FUNCTION__,__LINE__,
|
||||
unit->getId(), unit->getFullName().c_str(),unit->getDesc().c_str(),
|
||||
unit->getFaction()->getIndex());
|
||||
|
@ -399,8 +399,8 @@ const Resource *AiInterface::getResource(const ResourceType *rt){
|
|||
|
||||
Unit *AiInterface::getMyUnitPtr(int unitIndex) {
|
||||
if(unitIndex >= world->getFaction(factionIndex)->getUnitCount()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] unitIndex >= world->getFaction(factionIndex)->getUnitCount(), unitIndex = %d, world->getFaction(factionIndex)->getUnitCount() = %d",__FILE__,__FUNCTION__,__LINE__,unitIndex,world->getFaction(factionIndex)->getUnitCount());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] unitIndex >= world->getFaction(factionIndex)->getUnitCount(), unitIndex = %d, world->getFaction(factionIndex)->getUnitCount() = %d",__FILE__,__FUNCTION__,__LINE__,unitIndex,world->getFaction(factionIndex)->getUnitCount());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -493,15 +493,6 @@ bool AiInterface::isResourceNear(const Vec2i &pos, const ResourceType *rt, Vec2i
|
|||
if(r->getType() == rt) {
|
||||
resourcePos= pos + Vec2i(i,j);
|
||||
|
||||
//if(faction != NULL) {
|
||||
// char szBuf[4096]="";
|
||||
// sprintf(szBuf,"[%s::%s Line: %d] [isresourcenear] pos [%s] resourcePos [%s] fallbackToPeersHarvestingSameResource [%d] rt [%s]",
|
||||
// __FILE__,__FUNCTION__,__LINE__,pos.getString().c_str(),resourcePos.getString().c_str(),fallbackToPeersHarvestingSameResource,rt->getName().c_str());
|
||||
|
||||
// SystemFlags::OutputDebug(SystemFlags::debugWorldSynch,"----------------------------------- START [%d] ------------------------------------------------\n",faction->getFrameCount());
|
||||
// SystemFlags::OutputDebug(SystemFlags::debugWorldSynch,"%s",szBuf);
|
||||
// SystemFlags::OutputDebug(SystemFlags::debugWorldSynch,"------------------------------------ END [%d] -------------------------------------------------\n",faction->getFrameCount());
|
||||
//}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -591,7 +591,7 @@ bool AiRuleProduceResourceProducer::test(){
|
|||
if(ai->outputAIBehaviourToConsole()) printf("CONSUMABLE [%s][%d] Testing AI RULE Name[%s]\n",rt->getName().c_str(), r->getBalance(), this->getName().c_str());
|
||||
//aiInterface->printLog(4, "CONSUMABLE [%s][%d] Testing AI RULE Name[%s]",rt->getName().c_str(), r->getBalance(), this->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"CONSUMABLE [%s][%d] Testing AI RULE Name[%s]",rt->getName().c_str(), r->getBalance(), this->getName().c_str());
|
||||
snprintf(szBuf,8096,"CONSUMABLE [%s][%d] Testing AI RULE Name[%s]",rt->getName().c_str(), r->getBalance(), this->getName().c_str());
|
||||
aiInterface->printLog(4, szBuf);
|
||||
|
||||
bool factionUsesResourceType = aiInterface->factionUsesResourceType(aiInterface->getMyFactionType(), rt);
|
||||
|
@ -615,7 +615,7 @@ bool AiRuleProduceResourceProducer::test(){
|
|||
|
||||
if(ai->outputAIBehaviourToConsole()) printf("STATIC [%s][%d] [min %d] Testing AI RULE Name[%s]\n",rt->getName().c_str(), r->getAmount(), targetStaticResourceCount, this->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"STATIC resource check [%s][%d] [min %d] Testing AI RULE Name[%s]",rt->getName().c_str(), r->getAmount(), targetStaticResourceCount, this->getName().c_str());
|
||||
snprintf(szBuf,8096,"STATIC resource check [%s][%d] [min %d] Testing AI RULE Name[%s]",rt->getName().c_str(), r->getAmount(), targetStaticResourceCount, this->getName().c_str());
|
||||
aiInterface->printLog(4, szBuf);
|
||||
|
||||
if(rt->getClass() == rcStatic && r->getAmount() < targetStaticResourceCount) {
|
||||
|
@ -667,7 +667,7 @@ void AiRuleProduce::execute() {
|
|||
if(ai->outputAIBehaviourToConsole()) printf("AiRuleProduce producing [%s]\n",(produceTask->getUnitType() != NULL ? produceTask->getUnitType()->getName().c_str() : "null"));
|
||||
//aiInterface->printLog(4, "AiRuleProduce producing [%s]",(produceTask->getUnitType() != NULL ? produceTask->getUnitType()->getName().c_str() : "null"));
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"AiRuleProduce producing [%s]",(produceTask->getUnitType() != NULL ? produceTask->getUnitType()->getName().c_str() : "null"));
|
||||
snprintf(szBuf,8096,"AiRuleProduce producing [%s]",(produceTask->getUnitType() != NULL ? produceTask->getUnitType()->getName().c_str() : "null"));
|
||||
aiInterface->printLog(4, szBuf);
|
||||
|
||||
//generic produce task, produce random unit that has the skill or produces the resource
|
||||
|
@ -816,7 +816,7 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
|||
|
||||
if(ai->outputAIBehaviourToConsole()) printf("produceSpecific aiInterface->reqsOk(pt->getUnitType()) = [%s][%d] Testing AI RULE Name[%s]\n",pt->getUnitType()->getName().c_str(),aiInterface->reqsOk(pt->getUnitType()), this->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"produceSpecific aiInterface->reqsOk(pt->getUnitType()) = [%s][%d] Testing AI RULE Name[%s]",pt->getUnitType()->getName().c_str(),aiInterface->reqsOk(pt->getUnitType()), this->getName().c_str());
|
||||
snprintf(szBuf,8096,"produceSpecific aiInterface->reqsOk(pt->getUnitType()) = [%s][%d] Testing AI RULE Name[%s]",pt->getUnitType()->getName().c_str(),aiInterface->reqsOk(pt->getUnitType()), this->getName().c_str());
|
||||
aiInterface->printLog(4, szBuf);
|
||||
|
||||
//if unit meets requirements
|
||||
|
@ -860,12 +860,12 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
|||
}
|
||||
|
||||
if(ai->outputAIBehaviourToConsole()) printf("produceSpecific aiInterface->checkCosts(pt->getUnitType()) = [%d] Testing AI RULE Name[%s]\n",aiInterface->checkCosts(pt->getUnitType(),ctypeForCostCheck), this->getName().c_str());
|
||||
sprintf(szBuf,"produceSpecific aiInterface->checkCosts(pt->getUnitType()) = [%d] Testing AI RULE Name[%s]",aiInterface->checkCosts(pt->getUnitType(),ctypeForCostCheck), this->getName().c_str());
|
||||
snprintf(szBuf,8096,"produceSpecific aiInterface->checkCosts(pt->getUnitType()) = [%d] Testing AI RULE Name[%s]",aiInterface->checkCosts(pt->getUnitType(),ctypeForCostCheck), this->getName().c_str());
|
||||
aiInterface->printLog(4, szBuf);
|
||||
|
||||
//if unit doesnt meet resources retry
|
||||
if(aiInterface->checkCosts(pt->getUnitType(),ctypeForCostCheck) == false) {
|
||||
sprintf(szBuf,"Check costs FAILED.");
|
||||
snprintf(szBuf,8096,"Check costs FAILED.");
|
||||
aiInterface->printLog(4, szBuf);
|
||||
|
||||
ai->retryTask(pt);
|
||||
|
@ -912,7 +912,7 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
|||
|
||||
if(ai->outputAIBehaviourToConsole()) printf("produceSpecific producers.empty() = [%d] Testing AI RULE Name[%s]\n",producers.empty(), this->getName().c_str());
|
||||
//aiInterface->printLog(4, "produceSpecific producers.empty() = [%d] Testing AI RULE Name[%s]",producers.empty(), this->getName().c_str());
|
||||
sprintf(szBuf,"produceSpecific producers.empty() = [%d] Testing AI RULE Name[%s]",producers.empty(), this->getName().c_str());
|
||||
snprintf(szBuf,8096,"produceSpecific producers.empty() = [%d] Testing AI RULE Name[%s]",producers.empty(), this->getName().c_str());
|
||||
aiInterface->printLog(4, szBuf);
|
||||
|
||||
// Narrow down producers list to those who are not busy if possible
|
||||
|
@ -920,9 +920,9 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
|||
for(unsigned int i = 0; i < producers.size(); ++i) {
|
||||
int currentProducerIndex = producers[i];
|
||||
if(currentProducerIndex >= aiInterface->getMyUnitCount()) {
|
||||
char szBuf[1024]="";
|
||||
char szBuf[8096]="";
|
||||
printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,producers.size() = %lu\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)producers.size());
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %u, i = %u,producers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)producers.size());
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %u, i = %u,producers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)producers.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -952,15 +952,15 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
|||
currentProducerIndex=producers[prIndex];
|
||||
|
||||
if(currentProducerIndex >= aiInterface->getMyUnitCount()) {
|
||||
char szBuf[1024]="";
|
||||
char szBuf[8096]="";
|
||||
printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,producers.size() = %lu\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)producers.size());
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %u, i = %u,producers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)producers.size());
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %u, i = %u,producers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)producers.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
if(prIndex >= producers.size()) {
|
||||
char szBuf[1024]="";
|
||||
char szBuf[8096]="";
|
||||
printf("In [%s::%s Line: %d] prIndex >= producers.size(), currentProducerIndex = %d, i = %u,producers.size() = %lu \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,(unsigned long)producers.size());
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] currentProducerIndex >= producers.size(), currentProducerIndex = %d, i = %u,producers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,(unsigned long)producers.size());
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= producers.size(), currentProducerIndex = %d, i = %u,producers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,(unsigned long)producers.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1018,15 +1018,15 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
|||
currentProducerIndex=backupProducers[prIndex];
|
||||
|
||||
if(currentProducerIndex >= aiInterface->getMyUnitCount()) {
|
||||
char szBuf[1024]="";
|
||||
char szBuf[8096]="";
|
||||
printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,backupProducers.size() = %lu\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)backupProducers.size());
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,backupProducers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)backupProducers.size());
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,backupProducers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,(unsigned long)backupProducers.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
if(prIndex >= backupProducers.size()) {
|
||||
char szBuf[1024]="";
|
||||
char szBuf[8096]="";
|
||||
printf("In [%s::%s Line: %d] prIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = %lu \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,(unsigned long)backupProducers.size());
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] currentProducerIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,(unsigned long)backupProducers.size());
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = %lu",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,(unsigned long)backupProducers.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1062,7 +1062,7 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
|||
|
||||
if(ai->outputAIBehaviourToConsole()) printf("mega #1 produceSpecific giveCommand to unit [%s] commandType [%s]\n",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),ut->getCommandType(commandIndex)->getName().c_str());
|
||||
//aiInterface->printLog(4, "mega #1 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),ut->getCommandType(commandIndex)->getName().c_str());
|
||||
sprintf(szBuf,"mega #1 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),ut->getCommandType(commandIndex)->getName().c_str());
|
||||
snprintf(szBuf,8096,"mega #1 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),ut->getCommandType(commandIndex)->getName().c_str());
|
||||
aiInterface->printLog(4, szBuf);
|
||||
|
||||
aiInterface->giveCommand(bestIndex, ut->getCommandType(commandIndex));
|
||||
|
@ -1082,7 +1082,7 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
|||
|
||||
if(ai->outputAIBehaviourToConsole()) printf("mega #2 produceSpecific giveCommand to unit [%s] commandType [%s]\n",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
//aiInterface->printLog(4, "mega #2 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
sprintf(szBuf,"mega #2 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
snprintf(szBuf,8096,"mega #2 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
aiInterface->printLog(4, szBuf);
|
||||
|
||||
aiInterface->giveCommand(bestIndex, defCt);
|
||||
|
@ -1105,7 +1105,7 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
|||
|
||||
if(ai->outputAIBehaviourToConsole()) printf("mega #3 produceSpecific giveCommand to unit [%s] commandType [%s]\n",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
//aiInterface->printLog(4, "mega #3 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
sprintf(szBuf,"mega #3 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
snprintf(szBuf,8096,"mega #3 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
aiInterface->printLog(4, szBuf);
|
||||
|
||||
aiInterface->giveCommand(bestIndex, defCt);
|
||||
|
@ -1123,7 +1123,7 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
|||
}
|
||||
if(ai->outputAIBehaviourToConsole()) printf("mega #4 produceSpecific giveCommand to unit [%s] commandType [%s]\n",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
//aiInterface->printLog(4, "mega #4 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
sprintf(szBuf,"mega #4 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
snprintf(szBuf,8096,"mega #4 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
aiInterface->printLog(4, szBuf);
|
||||
|
||||
aiInterface->giveCommand(bestIndex, defCt);
|
||||
|
@ -1147,7 +1147,7 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
|||
|
||||
if(ai->outputAIBehaviourToConsole()) printf("produceSpecific giveCommand to unit [%s] commandType [%s]\n",aiInterface->getMyUnit(producerIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
//aiInterface->printLog(4, "produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(producerIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
sprintf(szBuf,"produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(producerIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
snprintf(szBuf,8096,"produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(producerIndex)->getType()->getName().c_str(),defCt->getName().c_str());
|
||||
aiInterface->printLog(4, szBuf);
|
||||
|
||||
aiInterface->giveCommand(producerIndex, defCt);
|
||||
|
|
|
@ -139,8 +139,8 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
|
|||
// }
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[findPath] unit->getPos() [%s] finalPos [%s]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[findPath] unit->getPos() [%s] finalPos [%s]",
|
||||
unit->getPos().getString().c_str(),finalPos.getString().c_str());
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
}
|
||||
|
@ -157,8 +157,8 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
|
|||
if(command != NULL && command->getCommandType() != NULL) {
|
||||
commandDesc = command->getCommandType()->toString();
|
||||
}
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"State: arrived#1 at pos: %s, command [%s]",finalPos.getString().c_str(),commandDesc.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"State: arrived#1 at pos: %s, command [%s]",finalPos.getString().c_str(),commandDesc.c_str());
|
||||
unit->setCurrentUnitTitle(szBuf);
|
||||
}
|
||||
|
||||
|
@ -242,8 +242,8 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
|
|||
if(minorDebugPathfinder) printf("Pathfind Unit [%d - %s] START BAILOUT ATTEMPT frameIndex = %d\n",unit->getId(),unit->getType()->getName().c_str(),frameIndex);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[attempting to BAIL OUT] finalPos [%s] ts [%d]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[attempting to BAIL OUT] finalPos [%s] ts [%d]",
|
||||
finalPos.getString().c_str(),ts);
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
}
|
||||
|
@ -293,8 +293,8 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
|
|||
bool canUnitMove = map->canMove(unit, unit->getPos(), newFinalPos);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[attempting to BAIL OUT] finalPos [%s] newFinalPos [%s] ts [%d] canUnitMove [%d]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[attempting to BAIL OUT] finalPos [%s] newFinalPos [%s] ts [%d] canUnitMove [%d]",
|
||||
finalPos.getString().c_str(),newFinalPos.getString().c_str(),ts,canUnitMove);
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
}
|
||||
|
@ -316,8 +316,8 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
|
|||
bool canUnitMove = map->canMove(unit, unit->getPos(), newFinalPos);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[attempting to BAIL OUT] finalPos [%s] newFinalPos [%s] ts [%d] canUnitMove [%d]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[attempting to BAIL OUT] finalPos [%s] newFinalPos [%s] ts [%d] canUnitMove [%d]",
|
||||
finalPos.getString().c_str(),newFinalPos.getString().c_str(),ts,canUnitMove);
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
}
|
||||
|
@ -917,8 +917,8 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled == true && chrono.getMillis() > 4) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[Setting new path for unit] openNodesList.size() [%lu] openPosList.size() [%lu] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[Setting new path for unit] openNodesList.size() [%lu] openPosList.size() [%lu] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]",
|
||||
factions[unitFactionIndex].openNodesList.size(),factions[unitFactionIndex].openPosList.size(),finalPos.getString().c_str(),targetPos.getString().c_str(),inBailout,ts);
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
}
|
||||
|
@ -930,8 +930,8 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
|
|||
commandDesc = command->getCommandType()->toString();
|
||||
}
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"State: moving, cmd [%s] pos: %s dest pos: %s, Queue= %d",commandDesc.c_str(),unit->getPos().getString().c_str(), targetPos.getString().c_str(),path->getQueueCount());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"State: moving, cmd [%s] pos: %s dest pos: %s, Queue= %d",commandDesc.c_str(),unit->getPos().getString().c_str(), targetPos.getString().c_str(),path->getQueueCount());
|
||||
unit->setCurrentUnitTitle(szBuf);
|
||||
}
|
||||
|
||||
|
@ -974,8 +974,8 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled == true && chrono.getMillis() > 4) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[Setting new path for unit] openNodesList.size() [%lu] openPosList.size() [%lu] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[Setting new path for unit] openNodesList.size() [%lu] openPosList.size() [%lu] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]",
|
||||
factions[unitFactionIndex].openNodesList.size(),factions[unitFactionIndex].openPosList.size(),finalPos.getString().c_str(),targetPos.getString().c_str(),inBailout,ts);
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
}
|
||||
|
@ -987,8 +987,8 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
|
|||
commandDesc = command->getCommandType()->toString();
|
||||
}
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"State: moving, cmd [%s] pos: %s dest pos: %s, Queue= %d",commandDesc.c_str(),unit->getPos().getString().c_str(), targetPos.getString().c_str(),path->getQueueCount());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"State: moving, cmd [%s] pos: %s dest pos: %s, Queue= %d",commandDesc.c_str(),unit->getPos().getString().c_str(), targetPos.getString().c_str(),path->getQueueCount());
|
||||
unit->setCurrentUnitTitle(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1176,8 +1176,8 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
|
|||
|
||||
std::pair<Vec2i,int> lastHarvest = unit->getLastHarvestResourceTarget();
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"State: blocked, cmd [%s] pos: [%s], dest pos: [%s], lastHarvest = [%s - %d], reason A= %d, B= %d, C= %d, D= %d, E= %d, F = %d",commandDesc.c_str(),unit->getPos().getString().c_str(), targetPos.getString().c_str(),lastHarvest.first.getString().c_str(),lastHarvest.second, pathFound,(lastNode == firstNode),path->getBlockCount(), path->isBlocked(), nodeLimitReached,path->isStuck());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"State: blocked, cmd [%s] pos: [%s], dest pos: [%s], lastHarvest = [%s - %d], reason A= %d, B= %d, C= %d, D= %d, E= %d, F = %d",commandDesc.c_str(),unit->getPos().getString().c_str(), targetPos.getString().c_str(),lastHarvest.first.getString().c_str(),lastHarvest.second, pathFound,(lastNode == firstNode),path->getBlockCount(), path->isBlocked(), nodeLimitReached,path->isStuck());
|
||||
unit->setCurrentUnitTitle(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1191,8 +1191,8 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
|
|||
}
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[path for unit BLOCKED] openNodesList.size() [%lu] openPosList.size() [%lu] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[path for unit BLOCKED] openNodesList.size() [%lu] openPosList.size() [%lu] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]",
|
||||
factions[unitFactionIndex].openNodesList.size(),factions[unitFactionIndex].openPosList.size(),finalPos.getString().c_str(),targetPos.getString().c_str(),inBailout,ts);
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
}
|
||||
|
@ -1267,8 +1267,8 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled == true && chrono.getMillis() > 4) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[Setting new path for unit] openNodesList.size() [%lu] openPosList.size() [%lu] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[Setting new path for unit] openNodesList.size() [%lu] openPosList.size() [%lu] finalPos [%s] targetPos [%s] inBailout [%d] ts [%d]",
|
||||
factions[unitFactionIndex].openNodesList.size(),factions[unitFactionIndex].openPosList.size(),finalPos.getString().c_str(),targetPos.getString().c_str(),inBailout,ts);
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
|
||||
|
@ -1281,7 +1281,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
|
|||
pathToTake += pos.getString();
|
||||
}
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
sprintf(szBuf,"Path for unit to take = %s",pathToTake.c_str());
|
||||
snprintf(szBuf,8096,"Path for unit to take = %s",pathToTake.c_str());
|
||||
}
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPathFinder).enabled == true) {
|
||||
|
@ -1291,8 +1291,8 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
|
|||
commandDesc = command->getCommandType()->toString();
|
||||
}
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"State: moving, cmd [%s] pos: %s dest pos: %s, Queue= %d",commandDesc.c_str(),unit->getPos().getString().c_str(), targetPos.getString().c_str(),path->getQueueCount());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"State: moving, cmd [%s] pos: %s dest pos: %s, Queue= %d",commandDesc.c_str(),unit->getPos().getString().c_str(), targetPos.getString().c_str(),path->getQueueCount());
|
||||
unit->setCurrentUnitTitle(szBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ void Logger::renderLoadingScreen() {
|
|||
Lang &lang= Lang::getInstance();
|
||||
string hintText = lang.get("Hint","",true);
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,hintText.c_str(),gameHintToShow.c_str());
|
||||
snprintf(szBuf,8096,hintText.c_str(),gameHintToShow.c_str());
|
||||
hintText = szBuf;
|
||||
|
||||
if(Renderer::renderText3DEnabled) {
|
||||
|
|
|
@ -87,8 +87,8 @@ void ChatManager::keyUp(SDL_KeyboardEvent key) {
|
|||
}
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
@ -314,8 +314,8 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) {
|
|||
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
@ -487,8 +487,8 @@ void ChatManager::updateNetwork() {
|
|||
}
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
|
|
@ -520,12 +520,12 @@ CommandResult Commander::pushNetworkCommand(const NetworkCommand* networkCommand
|
|||
networkCommand->getNetworkCommandType() != nctDisconnectNetworkPlayer) {
|
||||
unit= world->findUnitById(networkCommand->getUnitId());
|
||||
if(unit == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s - %d] Command refers to non existent unit id = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,networkCommand->getUnitId());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s - %d] Command refers to non existent unit id = %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,networkCommand->getUnitId());
|
||||
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
|
||||
if(gameNetworkInterface != NULL) {
|
||||
char szMsg[1024]="";
|
||||
sprintf(szMsg,"Player detected an error: Command refers to non existent unit id = %d. Game out of synch.",networkCommand->getUnitId());
|
||||
char szMsg[8096]="";
|
||||
snprintf(szMsg,8096,"Player detected an error: Command refers to non existent unit id = %d. Game out of synch.",networkCommand->getUnitId());
|
||||
gameNetworkInterface->sendTextMessage(szMsg,-1, true, "");
|
||||
}
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -677,12 +677,12 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = settings->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("PlayerSwitchedTeam",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("PlayerSwitchedTeam",languageList[i]).c_str(),settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,newTeam);
|
||||
snprintf(szMsg,8096,lang.get("PlayerSwitchedTeam",languageList[i]).c_str(),settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,newTeam);
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player %s switched from team# %d to team# %d.",settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,newTeam);
|
||||
snprintf(szMsg,8096,"Player %s switched from team# %d to team# %d.",settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,newTeam);
|
||||
}
|
||||
bool localEcho = lang.isLanguageLocal(languageList[i]);
|
||||
gameNetworkInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);
|
||||
|
@ -770,12 +770,12 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = settings->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("PlayerSwitchedTeam",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("PlayerSwitchedTeam",languageList[i]).c_str(),settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,vote->newTeam);
|
||||
snprintf(szMsg,8096,lang.get("PlayerSwitchedTeam",languageList[i]).c_str(),settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,vote->newTeam);
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player %s switched from team# %d to team# %d.",settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,vote->newTeam);
|
||||
snprintf(szMsg,8096,"Player %s switched from team# %d to team# %d.",settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,vote->newTeam);
|
||||
}
|
||||
bool localEcho = lang.isLanguageLocal(languageList[i]);
|
||||
gameNetworkInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);
|
||||
|
@ -795,12 +795,12 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = settings->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("PlayerSwitchedTeamDenied",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("PlayerSwitchedTeamDenied",languageList[i]).c_str(),settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,vote->newTeam);
|
||||
snprintf(szMsg,8096,lang.get("PlayerSwitchedTeamDenied",languageList[i]).c_str(),settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,vote->newTeam);
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player %s was denied the request to switch from team# %d to team# %d.",settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,vote->newTeam);
|
||||
snprintf(szMsg,8096,"Player %s was denied the request to switch from team# %d to team# %d.",settings->getNetworkPlayerName(factionIndex).c_str(),oldTeam,vote->newTeam);
|
||||
}
|
||||
bool localEcho = lang.isLanguageLocal(languageList[i]);
|
||||
gameNetworkInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);
|
||||
|
@ -830,22 +830,6 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const {
|
|||
|
||||
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
|
||||
if(gameNetworkInterface != NULL) {
|
||||
//
|
||||
// Lang &lang= Lang::getInstance();
|
||||
// const vector<string> languageList = settings->getUniqueNetworkPlayerLanguages();
|
||||
// for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
// char szMsg[1024]="";
|
||||
// if(lang.hasString("DisconnectNetorkPlayerIndexConfirmed",languageList[i]) == true) {
|
||||
// sprintf(szMsg,lang.get("DisconnectNetorkPlayerIndexConfirmed",languageList[i]).c_str(),playerIndex,settings->getNetworkPlayerName(factionIndex).c_str());
|
||||
// }
|
||||
// else {
|
||||
// sprintf(szMsg,"Notice - Admin is disconnecting player #%d - %s",playerIndex,settings->getNetworkPlayerName(factionIndex).c_str());
|
||||
// }
|
||||
// bool localEcho = lang.isLanguageLocal(languageList[i]);
|
||||
// gameNetworkInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);
|
||||
// }
|
||||
//
|
||||
// sleep(10);
|
||||
ServerInterface *server = networkManager.getServerInterface();
|
||||
if(server->isClientConnected(playerIndex) == true) {
|
||||
ConnectionSlot *slot = server->getSlot(playerIndex);
|
||||
|
@ -995,8 +979,8 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const {
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] networkCommand [%s]\n",__FILE__,__FUNCTION__,__LINE__,networkCommand->toString().c_str());
|
||||
|
||||
if(world == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] world == NULL for unit with id: %d",__FILE__,__FUNCTION__,__LINE__,networkCommand->getUnitId());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] world == NULL for unit with id: %d",__FILE__,__FUNCTION__,__LINE__,networkCommand->getUnitId());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1006,15 +990,15 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const {
|
|||
|
||||
//validate unit
|
||||
if(unit == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Can not find unit with id: %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,networkCommand->getUnitId());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Can not find unit with id: %d. Game out of synch.",__FILE__,__FUNCTION__,__LINE__,networkCommand->getUnitId());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"%s\n",szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s\n",szBuf);
|
||||
|
||||
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
|
||||
if(gameNetworkInterface != NULL) {
|
||||
char szMsg[1024]="";
|
||||
sprintf(szMsg,"Player detected an error: Can not find unit with id: %d. Game out of synch.",networkCommand->getUnitId());
|
||||
char szMsg[8096]="";
|
||||
snprintf(szMsg,8096,"Player detected an error: Can not find unit with id: %d. Game out of synch.",networkCommand->getUnitId());
|
||||
gameNetworkInterface->sendTextMessage(szMsg,-1, true, "");
|
||||
}
|
||||
|
||||
|
@ -1025,8 +1009,8 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const {
|
|||
|
||||
if(unit->getFaction()->getIndex() != networkCommand->getUnitFactionIndex()) {
|
||||
|
||||
char szBuf[10400]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d]\nUnit / Faction mismatch for network command = [%s]\n%s\nfor unit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nGame out of synch.",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nUnit / Faction mismatch for network command = [%s]\n%s\nfor unit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nGame out of synch.",
|
||||
__FILE__,__FUNCTION__,__LINE__,networkCommand->toString().c_str(),unit->getType()->getCommandTypeListDesc().c_str(),unit->getId(), unit->getFullName().c_str(),unit->getDesc().c_str(),unit->getFaction()->getIndex());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"%s\n",szBuf);
|
||||
|
@ -1036,49 +1020,24 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const {
|
|||
|
||||
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
|
||||
if(gameNetworkInterface != NULL && gameNetworkInterface->isConnected() == true) {
|
||||
char szMsg[1024]="";
|
||||
sprintf(szMsg,"Player detected an error: Unit / Faction mismatch for unitId: %d",networkCommand->getUnitId());
|
||||
char szMsg[8096]="";
|
||||
snprintf(szMsg,8096,"Player detected an error: Unit / Faction mismatch for unitId: %d",networkCommand->getUnitId());
|
||||
gameNetworkInterface->sendTextMessage(szMsg,-1, true, "");
|
||||
sprintf(szMsg,"Local faction index = %d, remote index = %d. Game out of synch.",unit->getFaction()->getIndex(),networkCommand->getUnitFactionIndex());
|
||||
snprintf(szMsg,8096,"Local faction index = %d, remote index = %d. Game out of synch.",unit->getFaction()->getIndex(),networkCommand->getUnitFactionIndex());
|
||||
gameNetworkInterface->sendTextMessage(szMsg,-1, true, "");
|
||||
|
||||
}
|
||||
else if(gameNetworkInterface != NULL) {
|
||||
char szMsg[1024]="";
|
||||
sprintf(szMsg,"Player detected an error: Connection lost, possible Unit / Faction mismatch for unitId: %d",networkCommand->getUnitId());
|
||||
char szMsg[8096]="";
|
||||
snprintf(szMsg,8096,"Player detected an error: Connection lost, possible Unit / Faction mismatch for unitId: %d",networkCommand->getUnitId());
|
||||
gameNetworkInterface->sendTextMessage(szMsg,-1, true,"");
|
||||
sprintf(szMsg,"Local faction index = %d, remote index = %d. Game out of synch.",unit->getFaction()->getIndex(),networkCommand->getUnitFactionIndex());
|
||||
snprintf(szMsg,8096,"Local faction index = %d, remote index = %d. Game out of synch.",unit->getFaction()->getIndex(),networkCommand->getUnitFactionIndex());
|
||||
gameNetworkInterface->sendTextMessage(szMsg,-1, true,"");
|
||||
}
|
||||
|
||||
std::string sError = "Error [#1]: Game is out of sync (Unit / Faction mismatch)\nplease check log files for details.";
|
||||
throw megaglest_runtime_error(sError);
|
||||
}
|
||||
/*
|
||||
I don't think we can validate in unit type since it can be different for certain commands (like attack and build etc)
|
||||
|
||||
else if(networkCommand->getUnitTypeId() >= 0 &&
|
||||
unit->getType()->getId() != networkCommand->getUnitTypeId() &&
|
||||
ct->getClass() != ccBuild) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d]\nUnit / Type mismatch for network command = [%s]\n%s\nfor unit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nactual local unitTypeId = %d.\nGame out of synch.",
|
||||
__FILE__,__FUNCTION__,__LINE__,networkCommand->toString().c_str(),unit->getType()->getCommandTypeListDesc().c_str(),unit->getId(), unit->getFullName().c_str(),unit->getDesc().c_str(),unit->getFaction()->getIndex(),unit->getType()->getId());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"%s\n",szBuf);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s\n",szBuf);
|
||||
std::string worldLog = world->DumpWorldToLog();
|
||||
|
||||
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
|
||||
if(gameNetworkInterface != NULL) {
|
||||
char szMsg[1024]="";
|
||||
sprintf(szMsg,"Player detected an error: Unit / Faction mismatch for unitId: %d, Local faction index = %d, remote idnex = %d. Game out of synch.",networkCommand->getUnitId(),unit->getFaction()->getIndex(),networkCommand->getUnitFactionIndex());
|
||||
gameNetworkInterface->sendTextMessage(szMsg,-1, true);
|
||||
}
|
||||
|
||||
std::string sError = "Error [#2]: Game is out of sync (unit type mismatch)\nplease check log files for details.";
|
||||
throw megaglest_runtime_error(sError);
|
||||
}
|
||||
*/
|
||||
|
||||
const UnitType* unitType= world->findUnitTypeById(unit->getFaction()->getType(), networkCommand->getUnitTypeId());
|
||||
|
||||
|
@ -1091,8 +1050,8 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const {
|
|||
//ct = NULL;
|
||||
|
||||
if(ct == NULL) {
|
||||
char szBuf[10400]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d]\nCan not find command type for network command = [%s]\n%s\nfor unit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nUnit Type Info:\n[%s]\nNetwork unit type:\n[%s]\nGame out of synch.",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nCan not find command type for network command = [%s]\n%s\nfor unit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nUnit Type Info:\n[%s]\nNetwork unit type:\n[%s]\nGame out of synch.",
|
||||
__FILE__,__FUNCTION__,__LINE__,networkCommand->toString().c_str(),unit->getType()->getCommandTypeListDesc().c_str(),
|
||||
unit->getId(), unit->getFullName().c_str(),unit->getDesc().c_str(),unit->getFaction()->getIndex(),unit->getType()->toString().c_str(),
|
||||
(unitType != NULL ? unitType->getName().c_str() : "null"));
|
||||
|
@ -1104,8 +1063,8 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const {
|
|||
|
||||
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
|
||||
if(gameNetworkInterface != NULL) {
|
||||
char szMsg[1024]="";
|
||||
sprintf(szMsg,"Player detected an error: Can not find command type: %d for unitId: %d [%s]. Game out of synch.",networkCommand->getCommandTypeId(),networkCommand->getUnitId(),(unitType != NULL ? unitType->getName().c_str() : "null"));
|
||||
char szMsg[8096]="";
|
||||
snprintf(szMsg,8096,"Player detected an error: Can not find command type: %d for unitId: %d [%s]. Game out of synch.",networkCommand->getCommandTypeId(),networkCommand->getUnitId(),(unitType != NULL ? unitType->getName().c_str() : "null"));
|
||||
gameNetworkInterface->sendTextMessage(szMsg,-1, true, "");
|
||||
}
|
||||
|
||||
|
@ -1119,8 +1078,8 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const {
|
|||
if (ct->getClass() == ccBuild) {
|
||||
//assert(networkCommand->getTargetId() >= 0 && networkCommand->getTargetId() < 4);
|
||||
if(networkCommand->getTargetId() < 0 || networkCommand->getTargetId() >= 4) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"networkCommand->getTargetId() >= 0 && networkCommand->getTargetId() < 4, [%s]",networkCommand->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"networkCommand->getTargetId() >= 0 && networkCommand->getTargetId() < 4, [%s]",networkCommand->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
facing = CardinalDir(networkCommand->getTargetId());
|
||||
|
|
|
@ -110,8 +110,8 @@ void Console::addLine(string line, bool playSound, int playerIndex, Vec3f textCo
|
|||
}
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
@ -144,8 +144,8 @@ void Console::addLine(string line, bool playSound, string playerName, Vec3f text
|
|||
}
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
|
|
@ -1032,7 +1032,7 @@ void Game::init(bool initForPreviewOnly) {
|
|||
string sErrBuf = "";
|
||||
if(ex.wantStackTrace() == true) {
|
||||
char szErrBuf[8096]="";
|
||||
sprintf(szErrBuf,"In [%s::%s %d]",__FILE__,__FUNCTION__,__LINE__);
|
||||
snprintf(szErrBuf,8096,"In [%s::%s %d]",__FILE__,__FUNCTION__,__LINE__);
|
||||
sErrBuf = string(szErrBuf) + string("\nerror [") + string(ex.what()) + string("]\n");
|
||||
}
|
||||
else {
|
||||
|
@ -1047,7 +1047,7 @@ void Game::init(bool initForPreviewOnly) {
|
|||
}
|
||||
catch(const exception &ex) {
|
||||
char szErrBuf[8096]="";
|
||||
sprintf(szErrBuf,"In [%s::%s %d]",__FILE__,__FUNCTION__,__LINE__);
|
||||
snprintf(szErrBuf,8096,"In [%s::%s %d]",__FILE__,__FUNCTION__,__LINE__);
|
||||
string sErrBuf = string(szErrBuf) + string("\nerror [") + string(ex.what()) + string("]\n");
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,sErrBuf.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,sErrBuf.c_str());
|
||||
|
@ -1132,8 +1132,8 @@ void Game::init(bool initForPreviewOnly) {
|
|||
if(loadGameNode != NULL) {
|
||||
aiInterfaces[i]->loadGame(loadGameNode,faction);
|
||||
}
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,Lang::getInstance().get("LogScreenGameLoadingCreatingAIFaction","",true).c_str(),i);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,Lang::getInstance().get("LogScreenGameLoadingCreatingAIFaction","",true).c_str(),i);
|
||||
logger.add(szBuf, true);
|
||||
}
|
||||
else {
|
||||
|
@ -1401,12 +1401,12 @@ void Game::update() {
|
|||
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
char szBuf[1024]="";
|
||||
char szBuf[8096]="";
|
||||
if(lang.hasString("AllowPlayerJoinTeam") == true) {
|
||||
sprintf(szBuf,lang.get("AllowPlayerJoinTeam").c_str(),settings->getNetworkPlayerName(vote->factionIndex).c_str(),vote->oldTeam,vote->newTeam);
|
||||
snprintf(szBuf,8096,lang.get("AllowPlayerJoinTeam").c_str(),settings->getNetworkPlayerName(vote->factionIndex).c_str(),vote->oldTeam,vote->newTeam);
|
||||
}
|
||||
else {
|
||||
sprintf(szBuf,"Allow player [%s] to join your team\n(changing from team# %d to team# %d)?",settings->getNetworkPlayerName(vote->factionIndex).c_str(),vote->oldTeam,vote->newTeam);
|
||||
snprintf(szBuf,8096,"Allow player [%s] to join your team\n(changing from team# %d to team# %d)?",settings->getNetworkPlayerName(vote->factionIndex).c_str(),vote->oldTeam,vote->newTeam);
|
||||
}
|
||||
|
||||
switchTeamConfirmMessageBox.setText(szBuf);
|
||||
|
@ -1489,8 +1489,8 @@ void Game::update() {
|
|||
renderer.clearZBuffer();
|
||||
renderer.reset2d();
|
||||
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"Please wait, loading game with replay [%d / %d]...",replayCommandsPlayed,replayTotal);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Please wait, loading game with replay [%d / %d]...",replayCommandsPlayed,replayTotal);
|
||||
string text = szBuf;
|
||||
if(Renderer::renderText3DEnabled) {
|
||||
Font3D *font = CoreData::getInstance().getMenuFontBig3D();
|
||||
|
@ -1700,7 +1700,7 @@ void Game::update() {
|
|||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d]\nError [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nError [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
@ -1772,8 +1772,8 @@ void Game::update() {
|
|||
catch(const exception &ex) {
|
||||
quitPendingIndicator = true;
|
||||
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
@ -1814,8 +1814,8 @@ void Game::updateNetworkMarkedCells() {
|
|||
}
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
@ -1841,8 +1841,8 @@ void Game::updateNetworkUnMarkedCells() {
|
|||
}
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
@ -1875,8 +1875,8 @@ void Game::updateNetworkHighligtedCells() {
|
|||
}
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
@ -1932,19 +1932,19 @@ void Game::ReplaceDisconnectedNetworkPlayersWithAI(bool isNetworkGame, NetworkRo
|
|||
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
char szBuf[4096]="";
|
||||
char szBuf[8096]="";
|
||||
if(faction->getPersonalityType() != fpt_Observer) {
|
||||
//faction->setControlType(ctCpuUltra);
|
||||
aiInterfaces[i] = new AiInterface(*this, i, faction->getTeam(), faction->getStartLocationIndex());
|
||||
|
||||
sprintf(szBuf,Lang::getInstance().get("LogScreenGameLoadingCreatingAIFaction","",true).c_str(),i);
|
||||
snprintf(szBuf,8096,Lang::getInstance().get("LogScreenGameLoadingCreatingAIFaction","",true).c_str(),i);
|
||||
logger.add(szBuf, true);
|
||||
|
||||
string msg = "Player #%d [%s] has disconnected, switching player to AI mode!";
|
||||
if(lang.hasString("GameSwitchPlayerToAI")) {
|
||||
msg = lang.get("GameSwitchPlayerToAI");
|
||||
}
|
||||
sprintf(szBuf,msg.c_str(),i+1,this->gameSettings.getNetworkPlayerName(i).c_str());
|
||||
snprintf(szBuf,8096,msg.c_str(),i+1,this->gameSettings.getNetworkPlayerName(i).c_str());
|
||||
|
||||
commander.tryNetworkPlayerDisconnected(i);
|
||||
}
|
||||
|
@ -1953,7 +1953,7 @@ void Game::ReplaceDisconnectedNetworkPlayersWithAI(bool isNetworkGame, NetworkRo
|
|||
if(lang.hasString("GameSwitchPlayerObserverToAI")) {
|
||||
msg = lang.get("GameSwitchPlayerObserverToAI");
|
||||
}
|
||||
sprintf(szBuf,msg.c_str(),i+1,this->gameSettings.getNetworkPlayerName(i).c_str());
|
||||
snprintf(szBuf,8096,msg.c_str(),i+1,this->gameSettings.getNetworkPlayerName(i).c_str());
|
||||
}
|
||||
|
||||
const vector<string> languageList = this->gameSettings.getUniqueNetworkPlayerLanguages();
|
||||
|
@ -2098,8 +2098,8 @@ void Game::removeUnitFromSelection(const Unit *unit) {
|
|||
}
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
@ -2121,8 +2121,8 @@ bool Game::addUnitToSelection(Unit *unit) {
|
|||
}
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
@ -2145,8 +2145,8 @@ void Game::addUnitToGroupSelection(Unit *unit,int groupIndex) {
|
|||
}
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
@ -2167,8 +2167,8 @@ void Game::removeUnitFromGroupSelection(int unitId,int groupIndex) {
|
|||
}
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
@ -2189,8 +2189,8 @@ void Game::recallGroupSelection(int groupIndex) {
|
|||
}
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
@ -2508,12 +2508,12 @@ void Game::mouseDownLeft(int x, int y) {
|
|||
if(faction->getPersonalityType() != fpt_Observer &&
|
||||
world.getThisFaction()->getIndex() != faction->getIndex() &&
|
||||
world.getThisFaction()->getTeam() != faction->getTeam()) {
|
||||
char szBuf[1024]="";
|
||||
char szBuf[8096]="";
|
||||
if(lang.hasString("JoinPlayerTeam") == true) {
|
||||
sprintf(szBuf,lang.get("JoinPlayerTeam").c_str(),faction->getIndex(),this->gameSettings.getNetworkPlayerName(i).c_str(),faction->getTeam());
|
||||
snprintf(szBuf,8096,lang.get("JoinPlayerTeam").c_str(),faction->getIndex(),this->gameSettings.getNetworkPlayerName(i).c_str(),faction->getTeam());
|
||||
}
|
||||
else {
|
||||
sprintf(szBuf,"Join player #%d - %s on Team: %d",faction->getIndex(),this->gameSettings.getNetworkPlayerName(i).c_str(),faction->getTeam());
|
||||
snprintf(szBuf,8096,"Join player #%d - %s on Team: %d",faction->getIndex(),this->gameSettings.getNetworkPlayerName(i).c_str(),faction->getTeam());
|
||||
}
|
||||
|
||||
menuItems.push_back(szBuf);
|
||||
|
@ -2549,12 +2549,12 @@ void Game::mouseDownLeft(int x, int y) {
|
|||
faction->getControlType() == ctNetwork &&
|
||||
this->gameSettings.getNetworkPlayerStatuses(i) != npst_Disconnected) {
|
||||
|
||||
char szBuf[1024]="";
|
||||
char szBuf[8096]="";
|
||||
if(lang.hasString("DisconnectNetorkPlayerIndex") == true) {
|
||||
sprintf(szBuf,lang.get("DisconnectNetorkPlayerIndex").c_str(),faction->getIndex()+1,this->gameSettings.getNetworkPlayerName(i).c_str());
|
||||
snprintf(szBuf,8096,lang.get("DisconnectNetorkPlayerIndex").c_str(),faction->getIndex()+1,this->gameSettings.getNetworkPlayerName(i).c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szBuf,"Disconnect player #%d - %s:",faction->getIndex()+1,this->gameSettings.getNetworkPlayerName(i).c_str());
|
||||
snprintf(szBuf,8096,"Disconnect player #%d - %s:",faction->getIndex()+1,this->gameSettings.getNetworkPlayerName(i).c_str());
|
||||
}
|
||||
|
||||
menuItems.push_back(szBuf);
|
||||
|
@ -2689,12 +2689,12 @@ void Game::mouseDownLeft(int x, int y) {
|
|||
GameSettings *settings = world.getGameSettingsPtr();
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
char szBuf[1024]="";
|
||||
char szBuf[8096]="";
|
||||
if(lang.hasString("DisconnectNetorkPlayerIndexConfirm") == true) {
|
||||
sprintf(szBuf,lang.get("DisconnectNetorkPlayerIndexConfirm").c_str(),factionIndex,settings->getNetworkPlayerName(factionIndex).c_str());
|
||||
snprintf(szBuf,8096,lang.get("DisconnectNetorkPlayerIndexConfirm").c_str(),factionIndex,settings->getNetworkPlayerName(factionIndex).c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szBuf,"Confirm disconnection for player #%d - %s?",factionIndex,settings->getNetworkPlayerName(factionIndex).c_str());
|
||||
snprintf(szBuf,8096,"Confirm disconnection for player #%d - %s?",factionIndex,settings->getNetworkPlayerName(factionIndex).c_str());
|
||||
}
|
||||
|
||||
disconnectPlayerConfirmMessageBox.setText(szBuf);
|
||||
|
@ -2708,12 +2708,12 @@ void Game::mouseDownLeft(int x, int y) {
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = settings->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DisconnectNetorkPlayerIndexConfirmed",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DisconnectNetorkPlayerIndexConfirmed",languageList[i]).c_str(),factionIndex,settings->getNetworkPlayerName(factionIndex).c_str());
|
||||
snprintf(szMsg,8096,lang.get("DisconnectNetorkPlayerIndexConfirmed",languageList[i]).c_str(),factionIndex,settings->getNetworkPlayerName(factionIndex).c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Notice - Admin is warning to disconnect player #%d - %s!",factionIndex,settings->getNetworkPlayerName(factionIndex).c_str());
|
||||
snprintf(szMsg,8096,"Notice - Admin is warning to disconnect player #%d - %s!",factionIndex,settings->getNetworkPlayerName(factionIndex).c_str());
|
||||
}
|
||||
bool localEcho = lang.isLanguageLocal(languageList[i]);
|
||||
gameNetworkInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);
|
||||
|
@ -2951,8 +2951,8 @@ void Game::mouseDownLeft(int x, int y) {
|
|||
}
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
@ -3009,8 +3009,8 @@ void Game::mouseDownRight(int x, int y) {
|
|||
}
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Error [%s] x = %d y = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what(),x,y);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Error [%s] x = %d y = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what(),x,y);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
@ -3066,8 +3066,8 @@ void Game::mouseUpLeft(int x, int y) {
|
|||
gui.mouseUpLeftGraphics(x, y);
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
@ -3112,8 +3112,8 @@ void Game::mouseDoubleClickLeft(int x, int y) {
|
|||
gui.mouseDoubleClickLeftGraphics(x, y);
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
@ -3273,8 +3273,8 @@ void Game::mouseMove(int x, int y, const MouseState *ms) {
|
|||
renderer.computePosition(Vec2i(mouseX, mouseY), mouseCellPos);
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
@ -3307,8 +3307,8 @@ void Game::eventMouseWheel(int x, int y, int zDelta) {
|
|||
//gameCamera.setMoveY(1);
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
@ -3627,8 +3627,8 @@ void Game::keyDown(SDL_KeyboardEvent key) {
|
|||
//throw megaglest_runtime_error("Test Error!");
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
@ -3712,8 +3712,8 @@ void Game::keyUp(SDL_KeyboardEvent key) {
|
|||
}
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
@ -4793,7 +4793,7 @@ void Game::saveGame(){
|
|||
string file = this->saveGame(GameConstants::saveGameFilePattern);
|
||||
char szBuf[8096]="";
|
||||
Lang &lang= Lang::getInstance();
|
||||
sprintf(szBuf,lang.get("GameSaved","",true).c_str(),file.c_str());
|
||||
snprintf(szBuf,8096,lang.get("GameSaved","",true).c_str(),file.c_str());
|
||||
console.addLine(szBuf);
|
||||
|
||||
Config &config= Config::getInstance();
|
||||
|
@ -4811,7 +4811,7 @@ string Game::saveGame(string name) {
|
|||
strftime(szBuf2,100,"%Y%m%d_%H%M%S",loctime);
|
||||
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,name.c_str(),szBuf2);
|
||||
snprintf(szBuf,8096,name.c_str(),szBuf2);
|
||||
name = szBuf;
|
||||
}
|
||||
else if(name == GameConstants::saveGameFileAutoTestDefault) {
|
||||
|
@ -4821,7 +4821,7 @@ string Game::saveGame(string name) {
|
|||
strftime(szBuf2,100,"%Y%m%d_%H%M%S",loctime);
|
||||
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,name.c_str(),szBuf2);
|
||||
snprintf(szBuf,8096,name.c_str(),szBuf2);
|
||||
name = szBuf;
|
||||
}
|
||||
|
||||
|
@ -5065,8 +5065,8 @@ void Game::loadGame(string name,Program *programPtr,bool isMasterserverMode) {
|
|||
Lang &lang= Lang::getInstance();
|
||||
string gameVer = versionNode->getAttribute("version")->getValue();
|
||||
if(gameVer != glestVersionString) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,lang.get("SavedGameBadVersion").c_str(),gameVer.c_str(),glestVersionString.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("SavedGameBadVersion").c_str(),gameVer.c_str(),glestVersionString.c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -5126,8 +5126,8 @@ void Game::loadGame(string name,Program *programPtr,bool isMasterserverMode) {
|
|||
Lang &lang= Lang::getInstance();
|
||||
string gameVer = versionNode->getAttribute("version")->getValue();
|
||||
if(gameVer != glestVersionString) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,lang.get("SavedGameBadVersion").c_str(),gameVer.c_str(),glestVersionString.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("SavedGameBadVersion").c_str(),gameVer.c_str(),glestVersionString.c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,8 +87,8 @@ GameCamera::~GameCamera() {
|
|||
}
|
||||
|
||||
std::string GameCamera::getCameraMovementKey() const {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"%s_%f_%f_%f_%s,%f",pos.getString().c_str(),hAng,vAng,rotate,move.getString().c_str(),fov);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"%s_%f_%f_%f_%s,%f",pos.getString().c_str(),hAng,vAng,rotate,move.getString().c_str(),fov);
|
||||
return szBuf;
|
||||
}
|
||||
|
||||
|
|
|
@ -181,16 +181,16 @@ public:
|
|||
const string &getScenarioDir() const {return scenarioDir;}
|
||||
const string &getFactionTypeName(int factionIndex) const {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
return factionTypeNames[factionIndex];
|
||||
}
|
||||
string getNetworkPlayerName(int factionIndex) const {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -202,8 +202,8 @@ public:
|
|||
}
|
||||
const int getNetworkPlayerStatuses(int factionIndex) const {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -211,8 +211,8 @@ public:
|
|||
}
|
||||
const string getNetworkPlayerLanguages(int factionIndex) const {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -221,8 +221,8 @@ public:
|
|||
|
||||
const int getNetworkPlayerGameStatus(int factionIndex) const {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -256,8 +256,8 @@ public:
|
|||
}
|
||||
ControlType getFactionControl(int factionIndex) const {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -265,8 +265,8 @@ public:
|
|||
}
|
||||
int getResourceMultiplierIndex(int factionIndex) const {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -288,8 +288,8 @@ public:
|
|||
int getFactionCount() const {return factionCount;}
|
||||
int getTeam(int factionIndex) const {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -298,8 +298,8 @@ public:
|
|||
|
||||
int getStartLocationIndex(int factionIndex) const {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -335,8 +335,8 @@ public:
|
|||
|
||||
void setFactionTypeName(int factionIndex, const string& factionTypeName) {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -344,8 +344,8 @@ public:
|
|||
}
|
||||
void setNetworkPlayerName(int factionIndex,const string& playername) {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -353,8 +353,8 @@ public:
|
|||
}
|
||||
void setNetworkPlayerStatuses(int factionIndex,int status) {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -363,8 +363,8 @@ public:
|
|||
|
||||
void setNetworkPlayerGameStatus(int factionIndex,int status) {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -372,8 +372,8 @@ public:
|
|||
}
|
||||
void setNetworkPlayerLanguages(int factionIndex, string language) {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -382,8 +382,8 @@ public:
|
|||
|
||||
void setFactionControl(int factionIndex, ControlType controller) {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -391,8 +391,8 @@ public:
|
|||
}
|
||||
void setResourceMultiplierIndex(int factionIndex, int multiplierIndex) {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -405,8 +405,8 @@ public:
|
|||
void setFactionCount(int factionCount) {this->factionCount= factionCount;}
|
||||
void setTeam(int factionIndex, int team) {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -414,8 +414,8 @@ public:
|
|||
}
|
||||
void setStartLocationIndex(int factionIndex, int startLocationIndex) {
|
||||
if(factionIndex < 0 || factionIndex >= GameConstants::maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s] Invalid factionIndex = %d\n",__FUNCTION__,factionIndex);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -448,7 +448,7 @@ void ScriptManager::init(World* world, GameCamera *gameCamera, const XmlNode *ro
|
|||
//string sErrBuf = "";
|
||||
//if(ex.wantStackTrace() == true) {
|
||||
char szErrBuf[8096]="";
|
||||
sprintf(szErrBuf,"In [%s::%s %d]",__FILE__,__FUNCTION__,__LINE__);
|
||||
snprintf(szErrBuf,8096,"In [%s::%s %d]",__FILE__,__FUNCTION__,__LINE__);
|
||||
string sErrBuf = string(szErrBuf) + string("\nerror [") + string(ex.what()) + string("]\n");
|
||||
//}
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,sErrBuf.c_str());
|
||||
|
@ -2495,8 +2495,8 @@ int ScriptManager::DisplayFormattedText(LuaHandle* luaHandle) {
|
|||
luaArguments.getGenericData(-args+7));
|
||||
}
|
||||
else {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Invalid parameter count in method [%s] args = %d [argument count must be between 1 and %d]",__FUNCTION__,args,max_args_allowed);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Invalid parameter count in method [%s] args = %d [argument count must be between 1 and %d]",__FUNCTION__,args,max_args_allowed);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2603,8 +2603,8 @@ if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags
|
|||
luaArguments.getGenericData(-args+7));
|
||||
}
|
||||
else {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Invalid parameter count in method [%s] args = %d [argument count must be between 1 and %d]",__FUNCTION__,args,max_args_allowed);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Invalid parameter count in method [%s] args = %d [argument count must be between 1 and %d]",__FUNCTION__,args,max_args_allowed);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2684,8 +2684,8 @@ int ScriptManager::DisplayFormattedLangText(LuaHandle* luaHandle) {
|
|||
luaArguments.getGenericData(-args+7));
|
||||
}
|
||||
else {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Invalid parameter count in method [%s] args = %d [argument count must be between 1 and %d]",__FUNCTION__,args,max_args_allowed);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Invalid parameter count in method [%s] args = %d [argument count must be between 1 and %d]",__FUNCTION__,args,max_args_allowed);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -395,7 +395,7 @@ void Renderer::init() {
|
|||
|
||||
if(glActiveTexture == NULL) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"Error: glActiveTexture == NULL\nglActiveTexture is only supported if the GL version is 1.3 or greater,\nor if the ARB_multitexture extension is supported!");
|
||||
snprintf(szBuf,8096,"Error: glActiveTexture == NULL\nglActiveTexture is only supported if the GL version is 1.3 or greater,\nor if the ARB_multitexture extension is supported!");
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1797,18 +1797,18 @@ void Renderer::renderMouse3d() {
|
|||
}
|
||||
|
||||
if(game == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s] Line: %d game == NULL",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s] Line: %d game == NULL",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
else if(game->getGui() == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s] Line: %d game->getGui() == NULL",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s] Line: %d game->getGui() == NULL",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
else if(game->getGui()->getMouse3d() == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s] Line: %d game->getGui()->getMouse3d() == NULL",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s] Line: %d game->getGui()->getMouse3d() == NULL",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1816,8 +1816,8 @@ void Renderer::renderMouse3d() {
|
|||
const Mouse3d *mouse3d= gui->getMouse3d();
|
||||
const Map *map= game->getWorld()->getMap();
|
||||
if(map == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s] Line: %d map == NULL",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s] Line: %d map == NULL",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2275,14 +2275,13 @@ void Renderer::renderClock() {
|
|||
const World *world = game->getWorld();
|
||||
const Vec4f fontColor = game->getGui()->getDisplay()->getColor();
|
||||
|
||||
//sprintf(szBuf,"%s %.2d:%.2d %s %s",lang.get("GameTime","",true).c_str(),hours,minutes,lang.get("LocalTime","",true).c_str(),szBuf2);
|
||||
if(config.getBool("InGameClock","true") == true) {
|
||||
int hours = world->getTimeFlow()->getTime();
|
||||
int minutes = (world->getTimeFlow()->getTime() - hours) * 100 * 0.6; // scale 100 to 60
|
||||
|
||||
Lang &lang= Lang::getInstance();
|
||||
char szBuf[200]="";
|
||||
sprintf(szBuf,"%s %.2d:%.2d",lang.get("GameTime","",true).c_str(),hours,minutes);
|
||||
snprintf(szBuf,200,"%s %.2d:%.2d",lang.get("GameTime","",true).c_str(),hours,minutes);
|
||||
if(str != "") {
|
||||
str += " ";
|
||||
}
|
||||
|
@ -2297,7 +2296,7 @@ void Renderer::renderClock() {
|
|||
|
||||
Lang &lang= Lang::getInstance();
|
||||
char szBuf[200]="";
|
||||
sprintf(szBuf,"%s %s",lang.get("LocalTime","",true).c_str(),szBuf2);
|
||||
snprintf(szBuf,200,"%s %s",lang.get("LocalTime","",true).c_str(),szBuf2);
|
||||
if(str != "") {
|
||||
str += " ";
|
||||
}
|
||||
|
@ -3616,7 +3615,7 @@ void Renderer::renderMessageBox(GraphicMessageBox *messageBox) {
|
|||
}
|
||||
catch(const exception &e) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d]\nError [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nError [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
||||
|
@ -4904,8 +4903,8 @@ void Renderer::renderGhostModel(const UnitType *building, const Vec2i pos,Cardin
|
|||
//const Mouse3d *mouse3d= gui->getMouse3d();
|
||||
const Map *map= game->getWorld()->getMap();
|
||||
if(map == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s] Line: %d map == NULL",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s] Line: %d map == NULL",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -6772,8 +6771,8 @@ void Renderer::selectUsingSelectionBuffer(Selection::UnitContainer &units,
|
|||
GLint renderModeResult = glRenderMode(GL_SELECT);
|
||||
if(renderModeResult < 0) {
|
||||
const char *errorString= reinterpret_cast<const char*>(gluErrorString(renderModeResult));
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"OpenGL error #%d [0x%X] : [%s] at file: [%s], line: %d",renderModeResult,renderModeResult,errorString,extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"OpenGL error #%d [0x%X] : [%s] at file: [%s], line: %d",renderModeResult,renderModeResult,errorString,extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__);
|
||||
|
||||
printf("%s\n",szBuf);
|
||||
}
|
||||
|
@ -6824,8 +6823,8 @@ void Renderer::selectUsingSelectionBuffer(Selection::UnitContainer &units,
|
|||
}
|
||||
else if(selCount < 0) {
|
||||
const char *errorString= reinterpret_cast<const char*>(gluErrorString(selCount));
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"OpenGL error #%d [0x%X] : [%s] at file: [%s], line: %d",selCount,selCount,errorString,extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"OpenGL error #%d [0x%X] : [%s] at file: [%s], line: %d",selCount,selCount,errorString,extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__);
|
||||
|
||||
printf("%s\n",szBuf);
|
||||
}
|
||||
|
@ -7881,7 +7880,7 @@ void Renderer::render2dMenuSetup() {
|
|||
}
|
||||
else {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s] Line: %d\nglActiveTexture == NULL\nglActiveTexture is only supported if the GL version is 1.3 or greater,\nor if the ARB_multitexture extension is supported!",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
snprintf(szBuf,8096,"In [%s::%s] Line: %d\nglActiveTexture == NULL\nglActiveTexture is only supported if the GL version is 1.3 or greater,\nor if the ARB_multitexture extension is supported!",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -934,12 +934,12 @@ void MainWindow::eventKeyDown(SDL_KeyboardEvent key) {
|
|||
#endif
|
||||
if(f == NULL) {
|
||||
Lang &lang= Lang::getInstance();
|
||||
char szBuf[1024]="";
|
||||
char szBuf[8096]="";
|
||||
if(lang.get("ScreenshotSavedTo").length() > 0 && lang.get("ScreenshotSavedTo")[0] != '?') {
|
||||
sprintf(szBuf,lang.get("ScreenshotSavedTo").c_str(),path.c_str());
|
||||
snprintf(szBuf,8096,lang.get("ScreenshotSavedTo").c_str(),path.c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szBuf,"Screenshot will be saved to: %s",path.c_str());
|
||||
snprintf(szBuf,8096,"Screenshot will be saved to: %s",path.c_str());
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,szBuf);
|
||||
|
@ -1385,8 +1385,8 @@ void runTilesetValidationForPath(string tilesetPath, string tilesetName,
|
|||
purgeCount++;
|
||||
|
||||
if(svnPurgeFiles == true) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"svn delete \"%s\"",foundFile.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"svn delete \"%s\"",foundFile.c_str());
|
||||
bool svnOk = executeShellCommand(szBuf,0);
|
||||
if(svnOk == false) {
|
||||
throw megaglest_runtime_error("Call to command failed [" + string(szBuf) + "]");
|
||||
|
@ -1488,8 +1488,8 @@ void runTilesetValidationForPath(string tilesetPath, string tilesetName,
|
|||
if(svnPurgeFiles == true) {
|
||||
copyFileTo(duplicateFile, expandedNewCommonFileName);
|
||||
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"svn delete \"%s\"",duplicateFile.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"svn delete \"%s\"",duplicateFile.c_str());
|
||||
bool svnOk = executeShellCommand(szBuf,0);
|
||||
if(svnOk == false) {
|
||||
throw megaglest_runtime_error("Call to command failed [" + string(szBuf) + "]");
|
||||
|
@ -1500,9 +1500,9 @@ void runTilesetValidationForPath(string tilesetPath, string tilesetName,
|
|||
//int result = 0;
|
||||
int result = rename(duplicateFile.c_str(),expandedNewCommonFileName.c_str());
|
||||
if(result != 0) {
|
||||
char szBuf[4096]="";
|
||||
char szBuf[8096]="";
|
||||
char *errmsg = strerror(errno);
|
||||
sprintf(szBuf,"!!! Error [%s] Could not rename [%s] to [%s]!",errmsg,duplicateFile.c_str(),expandedNewCommonFileName.c_str());
|
||||
snprintf(szBuf,8096,"!!! Error [%s] Could not rename [%s] to [%s]!",errmsg,duplicateFile.c_str(),expandedNewCommonFileName.c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
else {
|
||||
|
@ -1512,8 +1512,8 @@ void runTilesetValidationForPath(string tilesetPath, string tilesetName,
|
|||
}
|
||||
else {
|
||||
if(svnPurgeFiles == true) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"svn delete \"%s\"",duplicateFile.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"svn delete \"%s\"",duplicateFile.c_str());
|
||||
bool svnOk = executeShellCommand(szBuf,0);
|
||||
if(svnOk == false) {
|
||||
throw megaglest_runtime_error("Call to command failed [" + string(szBuf) + "]");
|
||||
|
@ -1549,8 +1549,8 @@ void runTilesetValidationForPath(string tilesetPath, string tilesetName,
|
|||
bool foundText = searchAndReplaceTextInFile(parentFile, searchText, newCommonFileName, false);
|
||||
printf("foundText = %d\n",foundText);
|
||||
if(foundText == false) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"Line ref = %d, Error finding text [%s] in file [%s]",__LINE__,searchText.c_str(),parentFile.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Line ref = %d, Error finding text [%s] in file [%s]",__LINE__,searchText.c_str(),parentFile.c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
mapUniqueParentList[parentFile]++;
|
||||
|
@ -1596,7 +1596,7 @@ void runTilesetValidationForPath(string tilesetPath, string tilesetName,
|
|||
if(foundText == false) {
|
||||
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"Line ref = %d, Error finding text\n[%s]\nin file\n[%s]\nnew Common File [%s]\n",__LINE__,searchText.c_str(),parentFile.c_str(),newCommonFileName.c_str());
|
||||
snprintf(szBuf,8096,"Line ref = %d, Error finding text\n[%s]\nin file\n[%s]\nnew Common File [%s]\n",__LINE__,searchText.c_str(),parentFile.c_str(),newCommonFileName.c_str());
|
||||
printf("\n\n=================================================\n%s",szBuf);
|
||||
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -1825,8 +1825,8 @@ void runTechValidationForPath(string techPath, string techName,
|
|||
purgeCount++;
|
||||
|
||||
if(svnPurgeFiles == true) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"svn delete \"%s\"",foundFile.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"svn delete \"%s\"",foundFile.c_str());
|
||||
bool svnOk = executeShellCommand(szBuf,0);
|
||||
if(svnOk == false) {
|
||||
throw megaglest_runtime_error("Call to command failed [" + string(szBuf) + "]");
|
||||
|
@ -1855,8 +1855,8 @@ void runTechValidationForPath(string techPath, string techName,
|
|||
checksum.addFile(fileName);
|
||||
uint32 crcValue = checksum.getSum();
|
||||
if(crcValue == 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"Error calculating CRC for file [%s]",fileName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Error calculating CRC for file [%s]",fileName.c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
// else {
|
||||
|
@ -1965,8 +1965,8 @@ void runTechValidationForPath(string techPath, string techName,
|
|||
if(svnPurgeFiles == true) {
|
||||
copyFileTo(duplicateFile, expandedNewCommonFileName);
|
||||
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"svn delete \"%s\"",duplicateFile.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"svn delete \"%s\"",duplicateFile.c_str());
|
||||
bool svnOk = executeShellCommand(szBuf,0);
|
||||
if(svnOk == false) {
|
||||
throw megaglest_runtime_error("Call to command failed [" + string(szBuf) + "]");
|
||||
|
@ -1979,9 +1979,9 @@ void runTechValidationForPath(string techPath, string techName,
|
|||
|
||||
int result = rename(duplicateFile.c_str(),expandedNewCommonFileName.c_str());
|
||||
if(result != 0) {
|
||||
char szBuf[4096]="";
|
||||
char szBuf[8096]="";
|
||||
char *errmsg = strerror(errno);
|
||||
sprintf(szBuf,"!!! Error [%s] Could not rename [%s] to [%s]!",errmsg,duplicateFile.c_str(),expandedNewCommonFileName.c_str());
|
||||
snprintf(szBuf,8096,"!!! Error [%s] Could not rename [%s] to [%s]!",errmsg,duplicateFile.c_str(),expandedNewCommonFileName.c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
else {
|
||||
|
@ -1991,8 +1991,8 @@ void runTechValidationForPath(string techPath, string techName,
|
|||
}
|
||||
else {
|
||||
if(svnPurgeFiles == true) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"svn delete \"%s\"",duplicateFile.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"svn delete \"%s\"",duplicateFile.c_str());
|
||||
bool svnOk = executeShellCommand(szBuf,0);
|
||||
if(svnOk == false) {
|
||||
throw megaglest_runtime_error("Call to command failed [" + string(szBuf) + "]");
|
||||
|
@ -2051,15 +2051,11 @@ void runTechValidationForPath(string techPath, string techName,
|
|||
//printf("Error finding text [%s] in file [%s]",searchText.c_str(),parentFile.c_str());
|
||||
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"Line ref = %d, Error finding text\n[%s]\nin file\n[%s]\nnew Common File [%s]\n",__LINE__,searchText.c_str(),parentFile.c_str(),newCommonFileName.c_str());
|
||||
snprintf(szBuf,8096,"Line ref = %d, Error finding text\n[%s]\nin file\n[%s]\nnew Common File [%s]\n",__LINE__,searchText.c_str(),parentFile.c_str(),newCommonFileName.c_str());
|
||||
printf("\n\n=================================================\n%s",szBuf);
|
||||
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
//char szBuf[4096]="";
|
||||
//sprintf(szBuf,"Error finding text [%s] in file [%s]",searchText.c_str(),parentFile.c_str());
|
||||
//throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
mapUniqueParentList[parentFile]++;
|
||||
}
|
||||
|
@ -2122,7 +2118,7 @@ void runTechValidationForPath(string techPath, string techName,
|
|||
foundText = searchAndReplaceTextInFile(parentFile, newCommonFileName, newCommonFileName, true);
|
||||
if(foundText == false) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"Line ref = %d, Error finding text\n[%s]\nin file\n[%s]\nnew Common File [%s]\n",__LINE__,searchText.c_str(),parentFile.c_str(),newCommonFileName.c_str());
|
||||
snprintf(szBuf,8096,"Line ref = %d, Error finding text\n[%s]\nin file\n[%s]\nnew Common File [%s]\n",__LINE__,searchText.c_str(),parentFile.c_str(),newCommonFileName.c_str());
|
||||
printf("\n\n=================================================\n%s",szBuf);
|
||||
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -2645,8 +2641,8 @@ void CheckForDuplicateData() {
|
|||
else if(invalidMapList.empty() == false) {
|
||||
string errorMsg = "Warning invalid maps were detected (will be ignored):\n";
|
||||
for(int i = 0; i < invalidMapList.size(); ++i) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"map [%s]\n",invalidMapList[i].c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"map [%s]\n",invalidMapList[i].c_str());
|
||||
|
||||
errorMsg += szBuf;
|
||||
}
|
||||
|
@ -2682,15 +2678,15 @@ void CheckForDuplicateData() {
|
|||
newFile = newFile.substr( 0, newFile.length()-ext.length()-1);
|
||||
newFile = newFile + "_custom." + ext;
|
||||
|
||||
char szBuf[4096]="";
|
||||
char szBuf[8096]="";
|
||||
int result = rename(oldFile.c_str(),newFile.c_str());
|
||||
if(result != 0) {
|
||||
char *errmsg = strerror(errno);
|
||||
sprintf(szBuf,"Error [%s]\nCould not rename [%s] to [%s]!",errmsg,oldFile.c_str(),newFile.c_str());
|
||||
snprintf(szBuf,8096,"Error [%s]\nCould not rename [%s] to [%s]!",errmsg,oldFile.c_str(),newFile.c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
else {
|
||||
sprintf(szBuf,"map [%s] in [%s]\nwas renamed to [%s]",duplicateMapsToRename[i].c_str(),oldFile.c_str(),newFile.c_str());
|
||||
snprintf(szBuf,8096,"map [%s] in [%s]\nwas renamed to [%s]",duplicateMapsToRename[i].c_str(),oldFile.c_str(),newFile.c_str());
|
||||
}
|
||||
errorMsg += szBuf;
|
||||
}
|
||||
|
@ -2733,15 +2729,15 @@ void CheckForDuplicateData() {
|
|||
string newFile = currentPath + duplicateTilesetsToRename[i];
|
||||
newFile = newFile + "_custom";
|
||||
|
||||
char szBuf[4096]="";
|
||||
char szBuf[8096]="";
|
||||
int result = rename(oldFile.c_str(),newFile.c_str());
|
||||
if(result != 0) {
|
||||
char *errmsg = strerror(errno);
|
||||
sprintf(szBuf,"Error [%s]\nCould not rename [%s] to [%s]!",errmsg,oldFile.c_str(),newFile.c_str());
|
||||
snprintf(szBuf,8096,"Error [%s]\nCould not rename [%s] to [%s]!",errmsg,oldFile.c_str(),newFile.c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
else {
|
||||
sprintf(szBuf,"tileset [%s] in [%s]\nwas renamed to [%s]",duplicateTilesetsToRename[i].c_str(),oldFile.c_str(),newFile.c_str());
|
||||
snprintf(szBuf,8096,"tileset [%s] in [%s]\nwas renamed to [%s]",duplicateTilesetsToRename[i].c_str(),oldFile.c_str(),newFile.c_str());
|
||||
|
||||
string tilesetName = extractFileFromDirectoryPath(oldFile);
|
||||
oldFile = newFile + "/" + tilesetName + ".xml";
|
||||
|
@ -2789,15 +2785,15 @@ void CheckForDuplicateData() {
|
|||
string newFile = currentPath + duplicateTechtreesToRename[i];
|
||||
newFile = newFile + "_custom";
|
||||
|
||||
char szBuf[4096]="";
|
||||
char szBuf[8096]="";
|
||||
int result = rename(oldFile.c_str(),newFile.c_str());
|
||||
if(result != 0) {
|
||||
char *errmsg = strerror(errno);
|
||||
sprintf(szBuf,"Error [%s]\nCould not rename [%s] to [%s]!",errmsg,oldFile.c_str(),newFile.c_str());
|
||||
snprintf(szBuf,8096,"Error [%s]\nCould not rename [%s] to [%s]!",errmsg,oldFile.c_str(),newFile.c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
else {
|
||||
sprintf(szBuf,"techtree [%s] in [%s]\nwas renamed to [%s]",duplicateTechtreesToRename[i].c_str(),oldFile.c_str(),newFile.c_str());
|
||||
snprintf(szBuf,8096,"techtree [%s] in [%s]\nwas renamed to [%s]",duplicateTechtreesToRename[i].c_str(),oldFile.c_str(),newFile.c_str());
|
||||
|
||||
string tilesetName = extractFileFromDirectoryPath(oldFile);
|
||||
oldFile = newFile + "/" + tilesetName + ".xml";
|
||||
|
@ -4293,7 +4289,7 @@ int glestMain(int argc, char** argv) {
|
|||
|
||||
if(fileExists(fileName) == false) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"File specified for loading a saved game cannot be found: [%s]",fileName.c_str());
|
||||
snprintf(szBuf,8096,"File specified for loading a saved game cannot be found: [%s]",fileName.c_str());
|
||||
printf("\n\n======================================================================================\n%s\n======================================================================================\n\n\n",szBuf);
|
||||
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -4535,7 +4531,7 @@ int glestMain(int argc, char** argv) {
|
|||
SDL_PumpEvents();
|
||||
|
||||
int result = 0;
|
||||
char szTextBuf[1024]="";
|
||||
char szTextBuf[8096]="";
|
||||
for(unsigned int i =0; i < models.size(); ++i) {
|
||||
string &file = models[i];
|
||||
bool modelLoadedOk = false;
|
||||
|
@ -4543,7 +4539,7 @@ int glestMain(int argc, char** argv) {
|
|||
renderer.clearBuffers();
|
||||
renderer.clearZBuffer();
|
||||
renderer.reset2d();
|
||||
sprintf(szTextBuf,"Please wait, converting models [%u of %lu] ...",i,(long int)models.size());
|
||||
snprintf(szTextBuf,8096,"Please wait, converting models [%u of %lu] ...",i,(long int)models.size());
|
||||
|
||||
if(CoreData::getInstance().getMenuFontBig3D() != NULL) {
|
||||
renderer.renderText3D(
|
||||
|
@ -4910,8 +4906,8 @@ int glestMain(int argc, char** argv) {
|
|||
|
||||
#if defined(__GNUC__) && !defined(__FreeBSD__) && !defined(BSD)
|
||||
void handleSIGSEGV(int sig) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf, "In [%s::%s Line: %d] Error detected: signal %d:\n",__FILE__,__FUNCTION__,__LINE__, sig);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf, 8096,"In [%s::%s Line: %d] Error detected: signal %d:\n",__FILE__,__FUNCTION__,__LINE__, sig);
|
||||
printf("%s",szBuf);
|
||||
//abort();
|
||||
|
||||
|
|
|
@ -588,7 +588,7 @@ void Program::setState(ProgramState *programStateNew, bool cleanupOldState) {
|
|||
}
|
||||
catch(const exception &e){
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d]\nError [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nError [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
//abort();
|
||||
|
|
|
@ -392,11 +392,6 @@ bool MenuState::keyPressEditLabel(SDL_KeyboardEvent c, GraphicLabel **activeInpu
|
|||
if(isAllowedInputTextKey(key)) {
|
||||
if(activeInputLabel->getText().size() < maxTextSize) {
|
||||
string text= activeInputLabel->getText();
|
||||
//text.insert(text.end()-1, key);
|
||||
|
||||
//char szCharText[20]="";
|
||||
//sprintf(szCharText,"%c",key);
|
||||
//char *utfStr = String::ConvertToUTF8(&szCharText[0]);
|
||||
|
||||
wchar_t keyW = extractKeyPressedUnicode(c);
|
||||
wchar_t textAppend[] = { keyW, 0 };
|
||||
|
|
|
@ -466,7 +466,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError loading scenario [%s]:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,scenario.c_str(),ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError loading scenario [%s]:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,scenario.c_str(),ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -884,8 +884,8 @@ void MenuStateConnectedGame::simpleTask(BaseThread *callingThread) {
|
|||
|
||||
if(curlResult != CURLE_OK) {
|
||||
string curlError = curl_easy_strerror(curlResult);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
console.addLine(string("#1 ") + szBuf,true);
|
||||
}
|
||||
|
||||
|
@ -903,8 +903,8 @@ void MenuStateConnectedGame::simpleTask(BaseThread *callingThread) {
|
|||
|
||||
if(curlResult != CURLE_OK) {
|
||||
string curlError = curl_easy_strerror(curlResult);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
console.addLine(string("#2 ") + szBuf,true);
|
||||
}
|
||||
|
||||
|
@ -918,8 +918,8 @@ void MenuStateConnectedGame::simpleTask(BaseThread *callingThread) {
|
|||
|
||||
if(curlResult != CURLE_OK) {
|
||||
string curlError = curl_easy_strerror(curlResult);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
console.addLine(string("#3 ") + szBuf,true);
|
||||
}
|
||||
|
||||
|
@ -928,8 +928,8 @@ void MenuStateConnectedGame::simpleTask(BaseThread *callingThread) {
|
|||
|
||||
if(curlResult != CURLE_OK) {
|
||||
string curlError = curl_easy_strerror(curlResult);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
console.addLine(string("#4 ") + szBuf,true);
|
||||
}
|
||||
}
|
||||
|
@ -1118,12 +1118,12 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingMapNowDownloading",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingMapNowDownloading",languageList[i]).c_str(),getHumanPlayerName().c_str(),getMissingMapFromFTPServer.c_str());
|
||||
snprintf(szMsg,8096,lang.get("DataMissingMapNowDownloading",languageList[i]).c_str(),getHumanPlayerName().c_str(),getMissingMapFromFTPServer.c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s is attempting to download the map: %s",getHumanPlayerName().c_str(),getMissingMapFromFTPServer.c_str());
|
||||
snprintf(szMsg,8096,"Player: %s is attempting to download the map: %s",getHumanPlayerName().c_str(),getMissingMapFromFTPServer.c_str());
|
||||
}
|
||||
bool localEcho = lang.isLanguageLocal(languageList[i]);
|
||||
clientInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);
|
||||
|
@ -1153,12 +1153,12 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingTilesetNowDownloading",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingTilesetNowDownloading",languageList[i]).c_str(),getHumanPlayerName().c_str(),getMissingTilesetFromFTPServer.c_str());
|
||||
snprintf(szMsg,8096,lang.get("DataMissingTilesetNowDownloading",languageList[i]).c_str(),getHumanPlayerName().c_str(),getMissingTilesetFromFTPServer.c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s is attempting to download the tileset: %s",getHumanPlayerName().c_str(),getMissingTilesetFromFTPServer.c_str());
|
||||
snprintf(szMsg,8096,"Player: %s is attempting to download the tileset: %s",getHumanPlayerName().c_str(),getMissingTilesetFromFTPServer.c_str());
|
||||
}
|
||||
bool localEcho = lang.isLanguageLocal(languageList[i]);
|
||||
clientInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);
|
||||
|
@ -1188,12 +1188,12 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingTechtreeNowDownloading",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingTechtreeNowDownloading",languageList[i]).c_str(),getHumanPlayerName().c_str(),getMissingTechtreeFromFTPServer.c_str());
|
||||
snprintf(szMsg,8096,lang.get("DataMissingTechtreeNowDownloading",languageList[i]).c_str(),getHumanPlayerName().c_str(),getMissingTechtreeFromFTPServer.c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s is attempting to download the techtree: %s",getHumanPlayerName().c_str(),getMissingTechtreeFromFTPServer.c_str());
|
||||
snprintf(szMsg,8096,"Player: %s is attempting to download the techtree: %s",getHumanPlayerName().c_str(),getMissingTechtreeFromFTPServer.c_str());
|
||||
}
|
||||
bool localEcho = lang.isLanguageLocal(languageList[i]);
|
||||
clientInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);
|
||||
|
@ -1292,12 +1292,12 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("CancelDownloadsMsg",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("CancelDownloadsMsg",languageList[i]).c_str(),getHumanPlayerName().c_str());
|
||||
snprintf(szMsg,8096,lang.get("CancelDownloadsMsg",languageList[i]).c_str(),getHumanPlayerName().c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s cancelled all file downloads.",getHumanPlayerName().c_str());
|
||||
snprintf(szMsg,8096,"Player: %s cancelled all file downloads.",getHumanPlayerName().c_str());
|
||||
}
|
||||
clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]);
|
||||
}
|
||||
|
@ -1707,7 +1707,7 @@ void MenuStateConnectedGame::mouseClickAdmin(int x, int y, MouseButton mouseButt
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -1849,12 +1849,12 @@ void MenuStateConnectedGame::loadGameSettings(GameSettings *gameSettings) {
|
|||
ClientInterface *clientInterface = networkManager.getClientInterface();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingMap=Player",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingMap=Player",languageList[i]).c_str(),getHumanPlayerName().c_str(),listBoxMap.getSelectedItem().c_str());
|
||||
snprintf(szMsg,8096,lang.get("DataMissingMap=Player",languageList[i]).c_str(),getHumanPlayerName().c_str(),listBoxMap.getSelectedItem().c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s is missing the map: %s",getHumanPlayerName().c_str(),listBoxMap.getSelectedItem().c_str());
|
||||
snprintf(szMsg,8096,"Player: %s is missing the map: %s",getHumanPlayerName().c_str(),listBoxMap.getSelectedItem().c_str());
|
||||
}
|
||||
bool localEcho = lang.isLanguageLocal(languageList[i]);
|
||||
clientInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);
|
||||
|
@ -1872,12 +1872,12 @@ void MenuStateConnectedGame::loadGameSettings(GameSettings *gameSettings) {
|
|||
ClientInterface *clientInterface = networkManager.getClientInterface();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingTileset=Player",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingTileset=Player",languageList[i]).c_str(),getHumanPlayerName().c_str(),listBoxTileset.getSelectedItem().c_str());
|
||||
snprintf(szMsg,8096,lang.get("DataMissingTileset=Player",languageList[i]).c_str(),getHumanPlayerName().c_str(),listBoxTileset.getSelectedItem().c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s is missing the tileset: %s",getHumanPlayerName().c_str(),listBoxTileset.getSelectedItem().c_str());
|
||||
snprintf(szMsg,8096,"Player: %s is missing the tileset: %s",getHumanPlayerName().c_str(),listBoxTileset.getSelectedItem().c_str());
|
||||
}
|
||||
bool localEcho = lang.isLanguageLocal(languageList[i]);
|
||||
clientInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);
|
||||
|
@ -1892,12 +1892,12 @@ void MenuStateConnectedGame::loadGameSettings(GameSettings *gameSettings) {
|
|||
ClientInterface *clientInterface = networkManager.getClientInterface();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingTechtree=Player",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingTechtree=Player",languageList[i]).c_str(),getHumanPlayerName().c_str(),listBoxTechTree.getSelectedItem().c_str());
|
||||
snprintf(szMsg,8096,lang.get("DataMissingTechtree=Player",languageList[i]).c_str(),getHumanPlayerName().c_str(),listBoxTechTree.getSelectedItem().c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s is missing the techtree: %s",getHumanPlayerName().c_str(),listBoxTechTree.getSelectedItem().c_str());
|
||||
snprintf(szMsg,8096,"Player: %s is missing the techtree: %s",getHumanPlayerName().c_str(),listBoxTechTree.getSelectedItem().c_str());
|
||||
}
|
||||
bool localEcho = lang.isLanguageLocal(languageList[i]);
|
||||
clientInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);
|
||||
|
@ -2456,7 +2456,7 @@ void MenuStateConnectedGame::render() {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
@ -2926,14 +2926,6 @@ void MenuStateConnectedGame::update() {
|
|||
label += " - data synch is ok";
|
||||
}
|
||||
|
||||
//std::string networkFrameString = lang.get("NetworkFramePeriod") + " " + intToStr(clientInterface->getGameSettings()->getNetworkFramePeriod());
|
||||
//float pingTime = clientInterface->getThreadedPingMS(clientInterface->getServerIpAddress().c_str());
|
||||
//char szBuf[1024]="";
|
||||
//sprintf(szBuf,"%s, ping = %.2fms, %s",label.c_str(),pingTime,networkFrameString.c_str());
|
||||
//sprintf(szBuf,"%s, %s",label.c_str(),networkFrameString.c_str());
|
||||
|
||||
|
||||
//labelStatus.setText(szBuf);
|
||||
labelStatus.setText(label);
|
||||
}
|
||||
else {
|
||||
|
@ -2965,13 +2957,6 @@ void MenuStateConnectedGame::update() {
|
|||
label += " - data synch is ok";
|
||||
}
|
||||
|
||||
//std::string networkFrameString = lang.get("NetworkFramePeriod") + " " + intToStr(clientInterface->getGameSettings()->getNetworkFramePeriod());
|
||||
//float pingTime = clientInterface->getThreadedPingMS(clientInterface->getServerIpAddress().c_str());
|
||||
//char szBuf[1024]="";
|
||||
//sprintf(szBuf,"%s, ping = %.2fms, %s",label.c_str(),pingTime,networkFrameString.c_str());
|
||||
//sprintf(szBuf,"%s, %s",label.c_str(),networkFrameString.c_str());
|
||||
|
||||
//labelStatus.setText(szBuf);
|
||||
labelStatus.setText(label);
|
||||
}
|
||||
|
||||
|
@ -3126,7 +3111,7 @@ void MenuStateConnectedGame::update() {
|
|||
}
|
||||
catch(const runtime_error &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,szBuf);
|
||||
//throw megaglest_runtime_error(szBuf);
|
||||
|
@ -3185,12 +3170,12 @@ bool MenuStateConnectedGame::loadFactions(const GameSettings *gameSettings, bool
|
|||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingTechtree",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingTechtree",languageList[i]).c_str(),getHumanPlayerName().c_str(),gameSettings->getTech().c_str());
|
||||
snprintf(szMsg,8096,lang.get("DataMissingTechtree",languageList[i]).c_str(),getHumanPlayerName().c_str(),gameSettings->getTech().c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s is missing the techtree: %s",getHumanPlayerName().c_str(),gameSettings->getTech().c_str());
|
||||
snprintf(szMsg,8096,"Player: %s is missing the techtree: %s",getHumanPlayerName().c_str(),gameSettings->getTech().c_str());
|
||||
}
|
||||
clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]);
|
||||
}
|
||||
|
@ -3256,7 +3241,7 @@ bool MenuStateConnectedGame::hasNetworkGameSettings()
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,szBuf);
|
||||
showMessageBox( szBuf, "Error", false);
|
||||
|
@ -3343,48 +3328,6 @@ void MenuStateConnectedGame::keyDown(SDL_KeyboardEvent key) {
|
|||
|
||||
void MenuStateConnectedGame::keyPress(SDL_KeyboardEvent c) {
|
||||
if(activeInputLabel != NULL) {
|
||||
/*
|
||||
int maxTextSize= activeInputLabel->getMaxEditWidth();
|
||||
for(int i = 0; i < GameConstants::maxPlayers; ++i) {
|
||||
if(&labelPlayerNames[i] == activeInputLabel) {
|
||||
SDLKey key = extractKeyPressed(c);
|
||||
if(isKeyPressed(SDLK_ESCAPE,c,false) == true || isKeyPressed(SDLK_RETURN,c,false) == true )
|
||||
{
|
||||
setActiveInputLabel(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
//if((c>='0' && c<='9') || (c>='a' && c<='z') || (c>='A' && c<='Z') ||
|
||||
// (c=='-') || (c=='(') || (c==')')) {
|
||||
if(isAllowedInputTextKey(key)) {
|
||||
if(activeInputLabel->getText().size() < maxTextSize) {
|
||||
string text= activeInputLabel->getText();
|
||||
|
||||
char szCharText[20]="";
|
||||
sprintf(szCharText,"%c",key);
|
||||
char *utfStr = String::ConvertToUTF8(&szCharText[0]);
|
||||
if(utfStr != NULL) {
|
||||
if(text.size() > 0) {
|
||||
text.insert(text.end() -1, utfStr[0]);
|
||||
}
|
||||
else {
|
||||
text = utfStr[0];
|
||||
}
|
||||
|
||||
delete [] utfStr;
|
||||
|
||||
activeInputLabel->setText(text);
|
||||
|
||||
switchSetupRequestFlagType |= ssrft_NetworkPlayerName;
|
||||
needToSetChangedGameSettings = true;
|
||||
lastSetChangedGameSettings = time(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
bool handled = keyPressEditLabel(c, &activeInputLabel);
|
||||
if(handled == true) {
|
||||
switchSetupRequestFlagType |= ssrft_NetworkPlayerName;
|
||||
|
@ -3548,12 +3491,12 @@ bool MenuStateConnectedGame::loadMapInfo(string file, MapInfo *mapInfo, bool loa
|
|||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingMap",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingMap",languageList[i]).c_str(),getHumanPlayerName().c_str(),gameSettings->getMap().c_str());
|
||||
snprintf(szMsg,8096,lang.get("DataMissingMap",languageList[i]).c_str(),getHumanPlayerName().c_str(),gameSettings->getMap().c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s is missing the map: %s",getHumanPlayerName().c_str(),gameSettings->getMap().c_str());
|
||||
snprintf(szMsg,8096,"Player: %s is missing the map: %s",getHumanPlayerName().c_str(),gameSettings->getMap().c_str());
|
||||
}
|
||||
clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]);
|
||||
}
|
||||
|
@ -3664,12 +3607,12 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName,
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("FileDownloadProgress",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("FileDownloadProgress",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str(),fileProgress);
|
||||
snprintf(szMsg,8096,lang.get("FileDownloadProgress",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str(),fileProgress);
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s download progress for [%s] is %d %%",getHumanPlayerName().c_str(),itemName.c_str(),fileProgress);
|
||||
snprintf(szMsg,8096,"Player: %s download progress for [%s] is %d %%",getHumanPlayerName().c_str(),itemName.c_str(),fileProgress);
|
||||
}
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] szMsg [%s] lastProgress.first = %d, fileProgress = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,szMsg,lastProgress.first,fileProgress);
|
||||
clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]);
|
||||
|
@ -3687,12 +3630,12 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName,
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingExtractDownload",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingExtractDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str());
|
||||
snprintf(szMsg,8096,lang.get("DataMissingExtractDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Please wait, player: %s is extracting: %s",getHumanPlayerName().c_str(),itemName.c_str());
|
||||
snprintf(szMsg,8096,"Please wait, player: %s is extracting: %s",getHumanPlayerName().c_str(),itemName.c_str());
|
||||
}
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] szMsg [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,szMsg);
|
||||
clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]);
|
||||
|
@ -3728,12 +3671,12 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName,
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingMapSuccessDownload",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingMapSuccessDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str());
|
||||
snprintf(szMsg,8096,lang.get("DataMissingMapSuccessDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s SUCCESSFULLY downloaded the map: %s",getHumanPlayerName().c_str(),itemName.c_str());
|
||||
snprintf(szMsg,8096,"Player: %s SUCCESSFULLY downloaded the map: %s",getHumanPlayerName().c_str(),itemName.c_str());
|
||||
}
|
||||
clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]);
|
||||
}
|
||||
|
@ -3744,12 +3687,12 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName,
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingMapFailDownload",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingMapFailDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str(),curlVersion->version);
|
||||
snprintf(szMsg,8096,lang.get("DataMissingMapFailDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str(),curlVersion->version);
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s FAILED to download the map: [%s] using CURL version [%s]",getHumanPlayerName().c_str(),itemName.c_str(),curlVersion->version);
|
||||
snprintf(szMsg,8096,"Player: %s FAILED to download the map: [%s] using CURL version [%s]",getHumanPlayerName().c_str(),itemName.c_str(),curlVersion->version);
|
||||
}
|
||||
clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]);
|
||||
|
||||
|
@ -3783,12 +3726,12 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName,
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingTilesetSuccessDownload",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingTilesetSuccessDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str());
|
||||
snprintf(szMsg,8096,lang.get("DataMissingTilesetSuccessDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s SUCCESSFULLY downloaded the tileset: %s",getHumanPlayerName().c_str(),itemName.c_str());
|
||||
snprintf(szMsg,8096,"Player: %s SUCCESSFULLY downloaded the tileset: %s",getHumanPlayerName().c_str(),itemName.c_str());
|
||||
}
|
||||
clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]);
|
||||
}
|
||||
|
@ -3827,12 +3770,12 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName,
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingTilesetFailDownload",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingTilesetFailDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str(),curlVersion->version);
|
||||
snprintf(szMsg,8096,lang.get("DataMissingTilesetFailDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str(),curlVersion->version);
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s FAILED to download the tileset: [%s] using CURL version [%s]",getHumanPlayerName().c_str(),itemName.c_str(),curlVersion->version);
|
||||
snprintf(szMsg,8096,"Player: %s FAILED to download the tileset: [%s] using CURL version [%s]",getHumanPlayerName().c_str(),itemName.c_str(),curlVersion->version);
|
||||
}
|
||||
clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]);
|
||||
|
||||
|
@ -3866,12 +3809,12 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName,
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingTechtreeSuccessDownload",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingTechtreeSuccessDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str());
|
||||
snprintf(szMsg,8096,lang.get("DataMissingTechtreeSuccessDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s SUCCESSFULLY downloaded the techtree: %s",getHumanPlayerName().c_str(),itemName.c_str());
|
||||
snprintf(szMsg,8096,"Player: %s SUCCESSFULLY downloaded the techtree: %s",getHumanPlayerName().c_str(),itemName.c_str());
|
||||
}
|
||||
clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]);
|
||||
}
|
||||
|
@ -3912,12 +3855,12 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName,
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingTechtreeFailDownload",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingTechtreeFailDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str(),curlVersion->version);
|
||||
snprintf(szMsg,8096,lang.get("DataMissingTechtreeFailDownload",languageList[i]).c_str(),getHumanPlayerName().c_str(),itemName.c_str(),curlVersion->version);
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s FAILED to download the techtree: [%s] using CURL version [%s]",getHumanPlayerName().c_str(),itemName.c_str(),curlVersion->version);
|
||||
snprintf(szMsg,8096,"Player: %s FAILED to download the techtree: [%s] using CURL version [%s]",getHumanPlayerName().c_str(),itemName.c_str(),curlVersion->version);
|
||||
}
|
||||
clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]);
|
||||
|
||||
|
@ -4013,8 +3956,8 @@ void MenuStateConnectedGame::setupUIFromGameSettings(GameSettings *gameSettings,
|
|||
getMissingTilesetFromFTPServer = gameSettings->getTileset();
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"%s %s ?",lang.get("DownloadMissingTilesetQuestion").c_str(),gameSettings->getTileset().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"%s %s ?",lang.get("DownloadMissingTilesetQuestion").c_str(),gameSettings->getTileset().c_str());
|
||||
|
||||
// Is the item in the mod center?
|
||||
if(tilesetCacheList.find(getMissingMapFromFTPServer) == tilesetCacheList.end()) {
|
||||
|
@ -4045,12 +3988,12 @@ void MenuStateConnectedGame::setupUIFromGameSettings(GameSettings *gameSettings,
|
|||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingTileset",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingTileset",languageList[i]).c_str(),getHumanPlayerName().c_str(),gameSettings->getTileset().c_str());
|
||||
snprintf(szMsg,8096,lang.get("DataMissingTileset",languageList[i]).c_str(),getHumanPlayerName().c_str(),gameSettings->getTileset().c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s is missing the tileset: %s",getHumanPlayerName().c_str(),gameSettings->getTileset().c_str());
|
||||
snprintf(szMsg,8096,"Player: %s is missing the tileset: %s",getHumanPlayerName().c_str(),gameSettings->getTileset().c_str());
|
||||
}
|
||||
clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]);
|
||||
}
|
||||
|
@ -4085,8 +4028,8 @@ void MenuStateConnectedGame::setupUIFromGameSettings(GameSettings *gameSettings,
|
|||
getMissingTechtreeFromFTPServer = gameSettings->getTech();
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"%s %s ?",lang.get("DownloadMissingTechtreeQuestion").c_str(),gameSettings->getTech().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"%s %s ?",lang.get("DownloadMissingTechtreeQuestion").c_str(),gameSettings->getTech().c_str());
|
||||
|
||||
// Is the item in the mod center?
|
||||
if(techCacheList.find(getMissingTechtreeFromFTPServer) == techCacheList.end()) {
|
||||
|
@ -4117,12 +4060,12 @@ void MenuStateConnectedGame::setupUIFromGameSettings(GameSettings *gameSettings,
|
|||
const vector<string> languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int i = 0; i < languageList.size(); ++i) {
|
||||
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("DataMissingTechtree",languageList[i]) == true) {
|
||||
sprintf(szMsg,lang.get("DataMissingTechtree",languageList[i]).c_str(),getHumanPlayerName().c_str(),gameSettings->getTech().c_str());
|
||||
snprintf(szMsg,8096,lang.get("DataMissingTechtree",languageList[i]).c_str(),getHumanPlayerName().c_str(),gameSettings->getTech().c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"Player: %s is missing the techtree: %s",getHumanPlayerName().c_str(),gameSettings->getTech().c_str());
|
||||
snprintf(szMsg,8096,"Player: %s is missing the techtree: %s",getHumanPlayerName().c_str(),gameSettings->getTech().c_str());
|
||||
}
|
||||
clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]);
|
||||
}
|
||||
|
@ -4172,8 +4115,8 @@ void MenuStateConnectedGame::setupUIFromGameSettings(GameSettings *gameSettings,
|
|||
getMissingMapFromFTPServer = currentMap;
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"%s %s ?",lang.get("DownloadMissingMapQuestion").c_str(),currentMap.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"%s %s ?",lang.get("DownloadMissingMapQuestion").c_str(),currentMap.c_str());
|
||||
|
||||
// Is the item in the mod center?
|
||||
if(mapCacheList.find(getMissingTechtreeFromFTPServer) == mapCacheList.end()) {
|
||||
|
@ -4537,8 +4480,8 @@ int MenuStateConnectedGame::setupMapList(string scenario) {
|
|||
loadMapInfo(Map::getMapPath(mapFiles.at(i), scenarioDir, false), &mapInfo, false);
|
||||
|
||||
if(GameConstants::maxPlayers+1 <= mapInfo.players) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Sorted map list [%d] does not match\ncurrent map playercount [%d]\nfor file [%s]\nmap [%s]",GameConstants::maxPlayers+1,mapInfo.players,Map::getMapPath(mapFiles.at(i), "", false).c_str(),mapInfo.desc.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Sorted map list [%d] does not match\ncurrent map playercount [%d]\nfor file [%s]\nmap [%s]",GameConstants::maxPlayers+1,mapInfo.players,Map::getMapPath(mapFiles.at(i), "", false).c_str(),mapInfo.desc.c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
playerSortedMaps[mapInfo.players].push_back(mapFiles.at(i));
|
||||
|
@ -4565,7 +4508,7 @@ int MenuStateConnectedGame::setupMapList(string scenario) {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -4605,7 +4548,7 @@ int MenuStateConnectedGame::setupTechList(string scenario) {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -4633,7 +4576,7 @@ void MenuStateConnectedGame::setupTilesetList(string scenario) {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu,
|
|||
catch(const std::exception &ex) {
|
||||
serverInitError = true;
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nNetwork init error:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nNetwork init error:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -657,7 +657,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu,
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError loading scenario [%s]:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,scenario.c_str(),ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError loading scenario [%s]:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,scenario.c_str(),ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -701,7 +701,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu,
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -915,8 +915,8 @@ void MenuStateCustomGame::cleanup() {
|
|||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
else {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d] Error cannot shutdown publishToMasterserverThread\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s %d] Error cannot shutdown publishToMasterserverThread\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("%s",szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
@ -934,8 +934,8 @@ void MenuStateCustomGame::cleanup() {
|
|||
delete publishToMasterserverThread;
|
||||
}
|
||||
else {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d] Error cannot shutdown publishToMasterserverThread\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s %d] Error cannot shutdown publishToMasterserverThread\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("%s",szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
@ -1370,12 +1370,12 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||
Lang &lang= Lang::getInstance();
|
||||
const vector<string> languageList = serverInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int j = 0; j < languageList.size(); ++j) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("BlockPlayerServerMsg",languageList[j]) == true) {
|
||||
sprintf(szMsg,lang.get("BlockPlayerServerMsg",languageList[j]).c_str(),serverInterface->getSlot(i)->getIpAddress().c_str());
|
||||
snprintf(szMsg,8096,lang.get("BlockPlayerServerMsg",languageList[j]).c_str(),serverInterface->getSlot(i)->getIpAddress().c_str());
|
||||
}
|
||||
else {
|
||||
sprintf(szMsg,"The server has temporarily blocked IP Address [%s] from this game.",serverInterface->getSlot(i)->getIpAddress().c_str());
|
||||
snprintf(szMsg,8096,"The server has temporarily blocked IP Address [%s] from this game.",serverInterface->getSlot(i)->getIpAddress().c_str());
|
||||
}
|
||||
|
||||
serverInterface->sendTextMessage(szMsg,-1, true,languageList[j]);
|
||||
|
@ -1471,7 +1471,7 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -1654,13 +1654,11 @@ void MenuStateCustomGame::PlayNow(bool saveGame) {
|
|||
mainMessageBoxState=1;
|
||||
|
||||
Lang &lang= Lang::getInstance();
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("NetworkSlotUnassignedErrorUI") == true) {
|
||||
//sprintf(szMsg,lang.get("NetworkSlotUnassignedErrorUI").c_str());
|
||||
strcpy(szMsg,lang.get("NetworkSlotUnassignedErrorUI").c_str());
|
||||
}
|
||||
else {
|
||||
//sprintf(szMsg,"Cannot start game.\nSome player(s) are not in a network game slot!");
|
||||
strcpy(szMsg,"Cannot start game.\nSome player(s) are not in a network game slot!");
|
||||
}
|
||||
|
||||
|
@ -1668,13 +1666,11 @@ void MenuStateCustomGame::PlayNow(bool saveGame) {
|
|||
|
||||
const vector<string> languageList = serverInterface->getGameSettings()->getUniqueNetworkPlayerLanguages();
|
||||
for(unsigned int j = 0; j < languageList.size(); ++j) {
|
||||
char szMsg[1024]="";
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("NetworkSlotUnassignedError",languageList[j]) == true) {
|
||||
//sprintf(szMsg,lang.get("NetworkSlotUnassignedError").c_str());
|
||||
strcpy(szMsg,lang.get("NetworkSlotUnassignedError").c_str());
|
||||
}
|
||||
else {
|
||||
//sprintf(szMsg,"Cannot start game, some player(s) are not in a network game slot!");
|
||||
strcpy(szMsg,"Cannot start game, some player(s) are not in a network game slot!");
|
||||
}
|
||||
|
||||
|
@ -2088,7 +2084,7 @@ void MenuStateCustomGame::render() {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
//throw megaglest_runtime_error(szBuf);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
|
@ -2484,9 +2480,8 @@ void MenuStateCustomGame::update() {
|
|||
}
|
||||
|
||||
//float pingTime = serverInterface->getSlot(i)->getThreadedPingMS(serverInterface->getSlot(i)->getIpAddress().c_str());
|
||||
char szBuf[1024]="";
|
||||
//sprintf(szBuf,"%s, ping = %.2fms",label.c_str(),pingTime);
|
||||
sprintf(szBuf,"%s",label.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"%s",label.c_str());
|
||||
|
||||
labelNetStatus[i].setText(szBuf);
|
||||
}
|
||||
|
@ -2701,7 +2696,7 @@ void MenuStateCustomGame::update() {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -3070,7 +3065,7 @@ void MenuStateCustomGame::simpleTask(BaseThread *callingThread) {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -3755,7 +3750,7 @@ bool MenuStateCustomGame::hasNetworkGameSettings() {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -3873,7 +3868,7 @@ void MenuStateCustomGame::updateControlers() {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
@ -3900,7 +3895,7 @@ void MenuStateCustomGame::closeUnusedSlots(){
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
@ -3931,8 +3926,8 @@ void MenuStateCustomGame::updateNetworkSlots() {
|
|||
serverInterface->addSlot(i);
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
showGeneralError=true;
|
||||
|
@ -3976,7 +3971,7 @@ void MenuStateCustomGame::updateNetworkSlots() {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
//throw megaglest_runtime_error(szBuf);
|
||||
|
@ -4390,7 +4385,7 @@ void MenuStateCustomGame::processScenario() {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -4444,7 +4439,7 @@ void MenuStateCustomGame::SetupUIForScenarios() {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -4490,8 +4485,8 @@ int MenuStateCustomGame::setupMapList(string scenario) {
|
|||
loadMapInfo(Map::getMapPath(mapFiles.at(i), scenarioDir, false), &mapInfo, false);
|
||||
|
||||
if(GameConstants::maxPlayers+1 <= mapInfo.players) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Sorted map list [%d] does not match\ncurrent map playercount [%d]\nfor file [%s]\nmap [%s]",GameConstants::maxPlayers+1,mapInfo.players,Map::getMapPath(mapFiles.at(i), "", false).c_str(),mapInfo.desc.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Sorted map list [%d] does not match\ncurrent map playercount [%d]\nfor file [%s]\nmap [%s]",GameConstants::maxPlayers+1,mapInfo.players,Map::getMapPath(mapFiles.at(i), "", false).c_str(),mapInfo.desc.c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
playerSortedMaps[mapInfo.players].push_back(mapFiles.at(i));
|
||||
|
@ -4520,7 +4515,7 @@ int MenuStateCustomGame::setupMapList(string scenario) {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -4560,7 +4555,7 @@ int MenuStateCustomGame::setupTechList(string scenario) {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -4639,7 +4634,7 @@ void MenuStateCustomGame::reloadFactions(bool keepExistingSelectedItem, string s
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -4665,7 +4660,7 @@ void MenuStateCustomGame::setupTilesetList(string scenario) {
|
|||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError detected:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
|
|
@ -674,7 +674,7 @@ void MenuStateJoinGame::keyPress(SDL_KeyboardEvent c) {
|
|||
string text= labelServerIp.getText();
|
||||
//text.insert(text.end()-1, key);
|
||||
char szCharText[20]="";
|
||||
sprintf(szCharText,"%c",key);
|
||||
snprintf(szCharText,20,"%c",key);
|
||||
char *utfStr = String::ConvertToUTF8(&szCharText[0]);
|
||||
if(text.size() > 0) {
|
||||
text.insert(text.end() -1, utfStr[0]);
|
||||
|
|
|
@ -149,8 +149,8 @@ MenuStateKeysetup::MenuStateKeysetup(Program *program, MainMenu *mainMenu,
|
|||
keyScrollBar.setVisibleStart(0);
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d] Error detected:\n%s\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s %d] Error detected:\n%s\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -422,12 +422,11 @@ void MenuStateKeysetup::keyDown(SDL_KeyboardEvent key) {
|
|||
// }
|
||||
|
||||
char szCharText[20]="";
|
||||
sprintf(szCharText,"%c",hotkeyChar);
|
||||
snprintf(szCharText,20,"%c",hotkeyChar);
|
||||
char *utfStr = String::ConvertToUTF8(&szCharText[0]);
|
||||
|
||||
char szBuf[1024] = "";
|
||||
//sprintf(szBuf,"%s [%d][%d]",keyName.c_str(),key.keysym.sym,keysym);
|
||||
sprintf(szBuf,"%s [%s][%d][%d][%d]",keyName.c_str(),utfStr,key.keysym.sym,hotkeyChar,key.keysym.unicode);
|
||||
char szBuf[8096] = "";
|
||||
snprintf(szBuf,8096,"%s [%s][%d][%d][%d]",keyName.c_str(),utfStr,key.keysym.sym,hotkeyChar,key.keysym.unicode);
|
||||
labelTestValue.setText(szBuf);
|
||||
|
||||
delete [] utfStr;
|
||||
|
|
|
@ -208,7 +208,7 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||
|
||||
Lang &lang= Lang::getInstance();
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,lang.get("LoadGameDeletingFile","",true).c_str(),filename.c_str());
|
||||
snprintf(szBuf,8096,lang.get("LoadGameDeletingFile","",true).c_str(),filename.c_str());
|
||||
console.addLineOnly(szBuf);
|
||||
|
||||
for(int i = 0; i < slots.size(); i++) {
|
||||
|
@ -242,7 +242,7 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||
|
||||
Lang &lang= Lang::getInstance();
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,lang.get("LoadGameLoadingFile","",true).c_str(),filename.c_str());
|
||||
snprintf(szBuf,8096,lang.get("LoadGameLoadingFile","",true).c_str(),filename.c_str());
|
||||
console.addLineOnly(szBuf);
|
||||
|
||||
Game::loadGame(filename,program,false);
|
||||
|
@ -290,8 +290,8 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||
const XmlNode *versionNode= rootNode;
|
||||
string gameVer = versionNode->getAttribute("version")->getValue();
|
||||
if(gameVer != glestVersionString) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,lang.get("SavedGameBadVersion").c_str(),gameVer.c_str(),glestVersionString.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("SavedGameBadVersion").c_str(),gameVer.c_str(),glestVersionString.c_str());
|
||||
infoTextLabel.setText(szBuf);
|
||||
}
|
||||
else {
|
||||
|
@ -300,8 +300,8 @@ void MenuStateLoadGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||
newGameSettings.loadGame(gameNode);
|
||||
|
||||
//LoadSavedGameInfo=Map: %s\nTileset: %s\nTech: %s\nScenario: %s\n# players: %d\nFaction: %s
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,lang.get("LoadSavedGameInfo").c_str(),
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("LoadSavedGameInfo").c_str(),
|
||||
newGameSettings.getMap().c_str(),
|
||||
newGameSettings.getTileset().c_str(),
|
||||
newGameSettings.getTech().c_str(),
|
||||
|
|
|
@ -257,7 +257,7 @@ MenuStateMasterserver::MenuStateMasterserver(Program *program, MainMenu *mainMen
|
|||
int randomNickId = rand() % 999;
|
||||
string netPlayerName=Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str());
|
||||
string ircname=netPlayerName.substr(0,9);
|
||||
sprintf(szIRCNick,"MG_%s_%d",ircname.c_str(),randomNickId);
|
||||
snprintf(szIRCNick,80,"MG_%s_%d",ircname.c_str(),randomNickId);
|
||||
normalizeNick(szIRCNick);
|
||||
|
||||
currentIrcNick=ircname;
|
||||
|
@ -394,8 +394,8 @@ void MenuStateMasterserver::IRC_CallbackEvent(IRCEventType evt, const char* orig
|
|||
else if(evt == IRC_evt_chatText) {
|
||||
//printf ("===> IRC: '%s' said in channel %s: %s\n",origin ? origin : "someone",params[0], params[1] );
|
||||
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"%s: %s",origin ? origin : "someone",params[1]);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"%s: %s",origin ? origin : "someone",params[1]);
|
||||
string helpSTr=szBuf;
|
||||
if(helpSTr.find(currentIrcNick)!=string::npos){
|
||||
CoreData &coreData= CoreData::getInstance();
|
||||
|
@ -1002,9 +1002,8 @@ void MenuStateMasterserver::rebuildServerLines(const string &serverInfo) {
|
|||
//printf("Getting Ping time for host %s\n",masterServerInfo->getIpAddress().c_str());
|
||||
//float pingTime = Socket::getAveragePingMS(masterServerInfo->getIpAddress().c_str(),1);
|
||||
//printf("Ping time = %f\n",pingTime);
|
||||
char szBuf[1024]="";
|
||||
//sprintf(szBuf,"%s, %.2fms",masterServerInfo->getServerTitle().c_str(),pingTime);
|
||||
sprintf(szBuf,"%s",masterServerInfo->getServerTitle().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"%s",masterServerInfo->getServerTitle().c_str());
|
||||
masterServerInfo->setServerTitle(szBuf);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
|
|
@ -428,8 +428,8 @@ void MenuStateMods::simpleTask(BaseThread *callingThread) {
|
|||
|
||||
if(curlResult != CURLE_OK) {
|
||||
string curlError = curl_easy_strerror(curlResult);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
console.addLine(string("#1 ") + szBuf,true);
|
||||
}
|
||||
|
||||
|
@ -447,8 +447,8 @@ void MenuStateMods::simpleTask(BaseThread *callingThread) {
|
|||
|
||||
if(curlResult != CURLE_OK) {
|
||||
string curlError = curl_easy_strerror(curlResult);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
console.addLine(string("#2 ") + szBuf,true);
|
||||
}
|
||||
|
||||
|
@ -462,8 +462,8 @@ void MenuStateMods::simpleTask(BaseThread *callingThread) {
|
|||
|
||||
if(curlResult != CURLE_OK) {
|
||||
string curlError = curl_easy_strerror(curlResult);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
console.addLine(string("#3 ") + szBuf,true);
|
||||
}
|
||||
|
||||
|
@ -472,8 +472,8 @@ void MenuStateMods::simpleTask(BaseThread *callingThread) {
|
|||
|
||||
if(curlResult != CURLE_OK) {
|
||||
string curlError = curl_easy_strerror(curlResult);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModErrorGettingServerData").c_str(),curlError.c_str());
|
||||
console.addLine(string("#4 ") + szBuf,true);
|
||||
}
|
||||
}
|
||||
|
@ -1253,8 +1253,8 @@ void MenuStateMods::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||
if(fileFTPProgressList.empty() == false) {
|
||||
mainMessageBoxState = ftpmsg_Quit;
|
||||
mainMessageBox.init(lang.get("Yes"),lang.get("No"),450);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModDownloadInProgressCancelQuestion").c_str(),fileFTPProgressList.size());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModDownloadInProgressCancelQuestion").c_str(),fileFTPProgressList.size());
|
||||
showMessageBox(szBuf, lang.get("Question"), true);
|
||||
}
|
||||
else {
|
||||
|
@ -1544,15 +1544,15 @@ void MenuStateMods::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||
|
||||
mainMessageBoxState = ftpmsg_ReplaceTechtree;
|
||||
mainMessageBox.init(lang.get("Yes"),lang.get("No"),450);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModLocalRemoteMismatch").c_str(),selectedTechName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModLocalRemoteMismatch").c_str(),selectedTechName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Notice"), true);
|
||||
}
|
||||
else {
|
||||
mainMessageBoxState = ftpmsg_None;
|
||||
mainMessageBox.init(lang.get("Ok"),450);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModTechAlreadyInstalled").c_str(),selectedTechName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModTechAlreadyInstalled").c_str(),selectedTechName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Notice"), true);
|
||||
}
|
||||
mapCRCUpdateList[itemPath] = true;
|
||||
|
@ -1584,16 +1584,16 @@ void MenuStateMods::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||
if(alreadyHasTech == true) {
|
||||
mainMessageBoxState = ftpmsg_GetTechtree;
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModRemoveTechConfirm").c_str(),selectedTechName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModRemoveTechConfirm").c_str(),selectedTechName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Question"), true);
|
||||
}
|
||||
else {
|
||||
mainMessageBoxState = ftpmsg_None;
|
||||
mainMessageBox.init(lang.get("Ok"),450);
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModCannotRemoveTechNotInstalled").c_str(),selectedTechName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModCannotRemoveTechNotInstalled").c_str(),selectedTechName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Notice"), true);
|
||||
}
|
||||
}
|
||||
|
@ -1625,15 +1625,15 @@ void MenuStateMods::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||
|
||||
mainMessageBoxState = ftpmsg_ReplaceTileset;
|
||||
mainMessageBox.init(lang.get("Yes"),lang.get("No"),450);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModLocalRemoteMismatch").c_str(),selectedTilesetName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModLocalRemoteMismatch").c_str(),selectedTilesetName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Notice"), true);
|
||||
}
|
||||
else {
|
||||
mainMessageBoxState = ftpmsg_None;
|
||||
mainMessageBox.init(lang.get("Ok"),450);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModTilesetAlreadyInstalled").c_str(),selectedTilesetName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModTilesetAlreadyInstalled").c_str(),selectedTilesetName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Notice"), true);
|
||||
}
|
||||
}
|
||||
|
@ -1664,16 +1664,16 @@ void MenuStateMods::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||
if(alreadyHasTileset == true) {
|
||||
mainMessageBoxState = ftpmsg_GetTileset;
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModRemoveTilesetConfirm").c_str(),selectedTilesetName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModRemoveTilesetConfirm").c_str(),selectedTilesetName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Question"), true);
|
||||
}
|
||||
else {
|
||||
mainMessageBoxState = ftpmsg_None;
|
||||
mainMessageBox.init(lang.get("Ok"),450);
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModCannotRemoveTilesetNotInstalled").c_str(),selectedTilesetName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModCannotRemoveTilesetNotInstalled").c_str(),selectedTilesetName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Notice"), true);
|
||||
}
|
||||
}
|
||||
|
@ -1695,15 +1695,15 @@ void MenuStateMods::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||
if( modInfo.crc != modInfo.localCRC ) {
|
||||
mainMessageBoxState = ftpmsg_ReplaceMap;
|
||||
mainMessageBox.init(lang.get("Yes"),lang.get("No"),450);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModLocalRemoteMismatch").c_str(),selectedMapName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModLocalRemoteMismatch").c_str(),selectedMapName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Notice"), true);
|
||||
}
|
||||
else {
|
||||
mainMessageBoxState = ftpmsg_None;
|
||||
mainMessageBox.init(lang.get("Ok"),450);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModMapAlreadyInstalled").c_str(),selectedMapName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModMapAlreadyInstalled").c_str(),selectedMapName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Notice"), true);
|
||||
}
|
||||
}
|
||||
|
@ -1734,16 +1734,16 @@ void MenuStateMods::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||
if(alreadyHasMap == true) {
|
||||
mainMessageBoxState = ftpmsg_GetMap;
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModRemoveMapConfirm").c_str(),selectedMapName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModRemoveMapConfirm").c_str(),selectedMapName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Question"), true);
|
||||
}
|
||||
else {
|
||||
mainMessageBoxState = ftpmsg_None;
|
||||
mainMessageBox.init(lang.get("Ok"),450);
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModCannotRemoveMapNotInstalled").c_str(),selectedMapName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModCannotRemoveMapNotInstalled").c_str(),selectedMapName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Notice"), true);
|
||||
}
|
||||
}
|
||||
|
@ -1774,15 +1774,15 @@ void MenuStateMods::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||
|
||||
mainMessageBoxState = ftpmsg_ReplaceScenario;
|
||||
mainMessageBox.init(lang.get("Yes"),lang.get("No"),450);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModLocalRemoteMismatch").c_str(),selectedScenarioName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModLocalRemoteMismatch").c_str(),selectedScenarioName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Notice"), true);
|
||||
}
|
||||
else {
|
||||
mainMessageBoxState = ftpmsg_None;
|
||||
mainMessageBox.init(lang.get("Ok"),450);
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModScenarioAlreadyInstalled").c_str(),selectedScenarioName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModScenarioAlreadyInstalled").c_str(),selectedScenarioName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Notice"), true);
|
||||
}
|
||||
}
|
||||
|
@ -1815,16 +1815,16 @@ void MenuStateMods::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||
if(alreadyHasScenario == true) {
|
||||
mainMessageBoxState = ftpmsg_GetScenario;
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModRemoveScenarioConfirm").c_str(),selectedScenarioName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModRemoveScenarioConfirm").c_str(),selectedScenarioName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Question"), true);
|
||||
}
|
||||
else {
|
||||
mainMessageBoxState = ftpmsg_None;
|
||||
mainMessageBox.init(lang.get("Ok"),450);
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModCannotRemoveScenarioNotInstalled").c_str(),selectedScenarioName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModCannotRemoveScenarioNotInstalled").c_str(),selectedScenarioName.c_str());
|
||||
showMessageBox(szBuf, lang.get("Notice"), true);
|
||||
}
|
||||
}
|
||||
|
@ -2299,8 +2299,8 @@ void MenuStateMods::render() {
|
|||
for(int i = keyScenarioScrollBar.getVisibleStart();
|
||||
i <= keyScenarioScrollBar.getVisibleEnd(); ++i) {
|
||||
if(i >= keyScenarioButtons.size()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"i >= keyScenarioButtons.size(), i = %d keyScenarioButtons.size() = %d",i,(int)keyScenarioButtons.size());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"i >= keyScenarioButtons.size(), i = %d keyScenarioButtons.size() = %d",i,(int)keyScenarioButtons.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
bool alreadyHasScenario = (std::find(scenarioFiles.begin(),scenarioFiles.end(),keyScenarioButtons[i]->getText()) != scenarioFiles.end());
|
||||
|
@ -2422,8 +2422,8 @@ void MenuStateMods::render() {
|
|||
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
@ -2440,8 +2440,8 @@ void MenuStateMods::update() {
|
|||
for (int i = keyTechScrollBar.getVisibleStart();
|
||||
i <= keyTechScrollBar.getVisibleEnd(); ++i) {
|
||||
if(i >= keyTechButtons.size()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"i >= keyTechButtons.size(), i = %d, keyTechButtons.size() = %d",i,(int)keyTechButtons.size());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"i >= keyTechButtons.size(), i = %d, keyTechButtons.size() = %d",i,(int)keyTechButtons.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2457,8 +2457,8 @@ void MenuStateMods::update() {
|
|||
for (int i = keyTilesetScrollBar.getVisibleStart();
|
||||
i <= keyTilesetScrollBar.getVisibleEnd(); ++i) {
|
||||
if(i >= keyTilesetButtons.size()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"i >= keyTilesetButtons.size(), i = %d, keyTilesetButtons.size() = %d",i,(int)keyTilesetButtons.size());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"i >= keyTilesetButtons.size(), i = %d, keyTilesetButtons.size() = %d",i,(int)keyTilesetButtons.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2473,8 +2473,8 @@ void MenuStateMods::update() {
|
|||
for (int i = keyMapScrollBar.getVisibleStart();
|
||||
i <= keyMapScrollBar.getVisibleEnd(); ++i) {
|
||||
if(i >= keyMapButtons.size()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"i >= keyMapButtons.size(), i = %d, keyMapButtons.size() = %d",i,(int)keyMapButtons.size());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"i >= keyMapButtons.size(), i = %d, keyMapButtons.size() = %d",i,(int)keyMapButtons.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2490,8 +2490,8 @@ void MenuStateMods::update() {
|
|||
for (int i = keyScenarioScrollBar.getVisibleStart();
|
||||
i <= keyScenarioScrollBar.getVisibleEnd(); ++i) {
|
||||
if(i >= keyScenarioButtons.size()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"i >= keyScenarioButtons.size(), i = %d, keyScenarioButtons.size() = %d",i,(int)keyScenarioButtons.size());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"i >= keyScenarioButtons.size(), i = %d, keyScenarioButtons.size() = %d",i,(int)keyScenarioButtons.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2566,7 +2566,7 @@ void MenuStateMods::FTPClient_CallbackEvent(string itemName,
|
|||
|
||||
if(userdata == NULL) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,lang.get("DataMissingExtractDownloadMod").c_str(),itemName.c_str());
|
||||
snprintf(szBuf,8096,lang.get("DataMissingExtractDownloadMod").c_str(),itemName.c_str());
|
||||
//printf("%s\n",szBuf);
|
||||
console.addLine(szBuf,true);
|
||||
}
|
||||
|
@ -2588,16 +2588,8 @@ void MenuStateMods::FTPClient_CallbackEvent(string itemName,
|
|||
//printf("### downloaded file [%s] result = %d\n",itemName.c_str(),result.first);
|
||||
|
||||
if(result.first == ftp_crt_SUCCESS) {
|
||||
//displayModPreviewImage = true;
|
||||
displayModPreviewImage[itemName] = true;
|
||||
}
|
||||
// else {
|
||||
// curl_version_info_data *curlVersion= curl_version_info(CURLVERSION_NOW);
|
||||
//
|
||||
// char szBuf[1024]="";
|
||||
// sprintf(szBuf,lang.get("ModDownloadMapFail").c_str(),itemName.c_str(),curlVersion->version,result.second.c_str());
|
||||
// console.addLine(szBuf,true);
|
||||
// }
|
||||
}
|
||||
|
||||
else if(type == ftp_cct_Map) {
|
||||
|
@ -2613,15 +2605,15 @@ void MenuStateMods::FTPClient_CallbackEvent(string itemName,
|
|||
|
||||
if(result.first == ftp_crt_SUCCESS) {
|
||||
refreshMaps();
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModDownloadMapSuccess").c_str(),itemName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModDownloadMapSuccess").c_str(),itemName.c_str());
|
||||
console.addLine(szBuf,true);
|
||||
}
|
||||
else {
|
||||
curl_version_info_data *curlVersion= curl_version_info(CURLVERSION_NOW);
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModDownloadMapFail").c_str(),itemName.c_str(),curlVersion->version,result.second.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModDownloadMapFail").c_str(),itemName.c_str(),curlVersion->version,result.second.c_str());
|
||||
console.addLine(szBuf,true);
|
||||
}
|
||||
}
|
||||
|
@ -2640,16 +2632,16 @@ void MenuStateMods::FTPClient_CallbackEvent(string itemName,
|
|||
if(result.first == ftp_crt_SUCCESS) {
|
||||
refreshTilesets();
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModDownloadTilesetSuccess").c_str(),itemName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModDownloadTilesetSuccess").c_str(),itemName.c_str());
|
||||
console.addLine(szBuf,true);
|
||||
// END
|
||||
}
|
||||
else {
|
||||
curl_version_info_data *curlVersion= curl_version_info(CURLVERSION_NOW);
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModDownloadTilesetFail").c_str(),itemName.c_str(),curlVersion->version,result.second.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModDownloadTilesetFail").c_str(),itemName.c_str(),curlVersion->version,result.second.c_str());
|
||||
console.addLine(szBuf,true);
|
||||
}
|
||||
}
|
||||
|
@ -2667,8 +2659,8 @@ void MenuStateMods::FTPClient_CallbackEvent(string itemName,
|
|||
|
||||
if(result.first == ftp_crt_SUCCESS) {
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModDownloadTechSuccess").c_str(),itemName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModDownloadTechSuccess").c_str(),itemName.c_str());
|
||||
console.addLine(szBuf,true);
|
||||
|
||||
// START
|
||||
|
@ -2693,8 +2685,8 @@ void MenuStateMods::FTPClient_CallbackEvent(string itemName,
|
|||
else {
|
||||
curl_version_info_data *curlVersion= curl_version_info(CURLVERSION_NOW);
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModDownloadTechFail").c_str(),itemName.c_str(),curlVersion->version,result.second.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModDownloadTechFail").c_str(),itemName.c_str(),curlVersion->version,result.second.c_str());
|
||||
console.addLine(szBuf,true);
|
||||
}
|
||||
}
|
||||
|
@ -2711,8 +2703,8 @@ void MenuStateMods::FTPClient_CallbackEvent(string itemName,
|
|||
buttonInstallScenario.setEnabled(true);
|
||||
|
||||
if(result.first == ftp_crt_SUCCESS) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModDownloadScenarioSuccess").c_str(),itemName.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModDownloadScenarioSuccess").c_str(),itemName.c_str());
|
||||
console.addLine(szBuf,true);
|
||||
|
||||
// START
|
||||
|
@ -2739,8 +2731,8 @@ void MenuStateMods::FTPClient_CallbackEvent(string itemName,
|
|||
else {
|
||||
curl_version_info_data *curlVersion= curl_version_info(CURLVERSION_NOW);
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,lang.get("ModDownloadScenarioFail").c_str(),itemName.c_str(),curlVersion->version,result.second.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,lang.get("ModDownloadScenarioFail").c_str(),itemName.c_str(),curlVersion->version,result.second.c_str());
|
||||
console.addLine(szBuf,true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -532,8 +532,8 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu):
|
|||
labelFTPServerDataPortsLabel.init(currentLabelStart ,currentLine );
|
||||
labelFTPServerDataPortsLabel.setText(lang.get("FTPServerDataPort"));
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"%d - %d",FTPPort + 1, FTPPort + GameConstants::maxPlayers);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"%d - %d",FTPPort + 1, FTPPort + GameConstants::maxPlayers);
|
||||
|
||||
labelFTPServerDataPorts.registerGraphicComponent(containerName,"labelFTPServerDataPorts");
|
||||
labelFTPServerDataPorts.init(currentColumnStart,currentLine );
|
||||
|
@ -932,8 +932,8 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
|
|||
selectedPort=GameConstants::serverPort;
|
||||
}
|
||||
// use the following ports for ftp
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"%d - %d",selectedPort + 2, selectedPort + 1 + GameConstants::maxPlayers);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"%d - %d",selectedPort + 2, selectedPort + 1 + GameConstants::maxPlayers);
|
||||
labelFTPServerPort.setText(intToStr(selectedPort+1));
|
||||
labelFTPServerDataPorts.setText(szBuf);
|
||||
}
|
||||
|
@ -1047,31 +1047,6 @@ void MenuStateOptions::keyPress(SDL_KeyboardEvent c) {
|
|||
if(activeInputLabel != NULL) {
|
||||
//printf("[%d]\n",c); fflush(stdout);
|
||||
if(&labelPlayerName == activeInputLabel) {
|
||||
/*
|
||||
SDLKey key = extractKeyPressed(c);
|
||||
if((key>='0' && key<='9')||(key>='a' && key<='z')||(key>='A' && key<='Z')||
|
||||
(key>=(192-256) && key<=(255-256))||
|
||||
(key=='-')||(key=='_')||(key=='(')||(key==')')){
|
||||
//if(isAllowedInputTextKey(key)) {
|
||||
const int maxTextSize= activeInputLabel->getMaxEditWidth();
|
||||
if(activeInputLabel->getText().size()<maxTextSize){
|
||||
string text= activeInputLabel->getText();
|
||||
//text.insert(text.end()-1, key);
|
||||
char szCharText[20]="";
|
||||
sprintf(szCharText,"%c",key);
|
||||
char *utfStr = String::ConvertToUTF8(&szCharText[0]);
|
||||
if(text.size() > 0) {
|
||||
text.insert(text.end() -1, utfStr[0]);
|
||||
}
|
||||
else {
|
||||
text = utfStr[0];
|
||||
}
|
||||
delete [] utfStr;
|
||||
|
||||
activeInputLabel->setText(text);
|
||||
}
|
||||
}
|
||||
*/
|
||||
keyPressEditLabel(c, &activeInputLabel);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,8 +189,8 @@ void MenuStateRoot::mouseClick(int x, int y, MouseButton mouseButton){
|
|||
}
|
||||
}
|
||||
catch(exception &e) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d]\nError in menu event:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nError in menu event:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
showErrorMessageBox(szBuf, "", true);
|
||||
}
|
||||
|
|
|
@ -49,8 +49,8 @@ MenuStateScenario::MenuStateScenario(Program *program, MainMenu *mainMenu,
|
|||
networkManager.init(nrServer);
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d] Error detected:\n%s\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s %d] Error detected:\n%s\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -128,8 +128,8 @@ MenuStateScenario::MenuStateScenario(Program *program, MainMenu *mainMenu,
|
|||
GraphicComponent::applyAllCustomProperties(containerName);
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d] Error detected:\n%s\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s %d] Error detected:\n%s\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -205,8 +205,8 @@ void MenuStateScenario::mouseClick(int x, int y, MouseButton mouseButton) {
|
|||
}
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d] Error detected:\n%s\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s %d] Error detected:\n%s\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -340,13 +340,13 @@ void MenuStateScenario::loadScenarioPreviewTexture(){
|
|||
|
||||
void MenuStateScenario::loadGameSettings(const ScenarioInfo *scenarioInfo, GameSettings *gameSettings){
|
||||
if(listBoxScenario.getSelectedItemIndex() < 0) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"listBoxScenario.getSelectedItemIndex() < 0, = %d",listBoxScenario.getSelectedItemIndex());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"listBoxScenario.getSelectedItemIndex() < 0, = %d",listBoxScenario.getSelectedItemIndex());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
else if(listBoxScenario.getSelectedItemIndex() >= scenarioFiles.size()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"listBoxScenario.getSelectedItemIndex() >= scenarioFiles.size(), = [%d][%d]",listBoxScenario.getSelectedItemIndex(),(int)scenarioFiles.size());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"listBoxScenario.getSelectedItemIndex() >= scenarioFiles.size(), = [%d][%d]",listBoxScenario.getSelectedItemIndex(),(int)scenarioFiles.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -1037,7 +1037,7 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
|||
if(chrono.getMillis() % 100 == 0) {
|
||||
lastMillisCheck = (chrono.getMillis() / 1000);
|
||||
|
||||
char szBuf[1024]="";
|
||||
char szBuf[8096]="";
|
||||
string updateTextFormat = "Waiting for network: %lld seconds elapsed (maximum wait time: %d seconds)";
|
||||
if(lang.hasString("NetworkGameClientLoadStatus") == true) {
|
||||
updateTextFormat = lang.get("NetworkGameClientLoadStatus");
|
||||
|
@ -1112,14 +1112,14 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
|||
if(waitForHosts == "") {
|
||||
waitForHosts = lang.get("Server");
|
||||
}
|
||||
sprintf(szBuf,updateTextFormat.c_str(),(long long int)lastMillisCheck,int(readyWaitTimeout / 1000));
|
||||
snprintf(szBuf,8096,updateTextFormat.c_str(),(long long int)lastMillisCheck,int(readyWaitTimeout / 1000));
|
||||
|
||||
char szBuf1[1024]="";
|
||||
char szBuf1[8096]="";
|
||||
string statusTextFormat = "Waiting for players: %s";
|
||||
if(lang.hasString("NetworkGameStatusWaiting") == true) {
|
||||
statusTextFormat = lang.get("NetworkGameStatusWaiting");
|
||||
}
|
||||
sprintf(szBuf1,statusTextFormat.c_str(),waitForHosts.c_str());
|
||||
snprintf(szBuf1,8096,statusTextFormat.c_str(),waitForHosts.c_str());
|
||||
|
||||
logger.add(szBuf, true, szBuf1);
|
||||
|
||||
|
@ -1288,9 +1288,8 @@ void ClientInterface::sendPingMessage(int32 pingFrequency, int64 pingTime) {
|
|||
string ClientInterface::getNetworkStatus() {
|
||||
std::string label = Lang::getInstance().get("Server") + ": " + serverName;
|
||||
//float pingTime = getThreadedPingMS(getServerIpAddress().c_str());
|
||||
char szBuf[1024]="";
|
||||
//sprintf(szBuf,"%s, ping = %.2fms",label.c_str(),pingTime);
|
||||
sprintf(szBuf,"%s",label.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"%s",label.c_str());
|
||||
|
||||
return szBuf;
|
||||
}
|
||||
|
|
|
@ -67,8 +67,8 @@ void NetworkMessage::send(Socket* socket, const void* data, int dataSize) const
|
|||
int sendResult = socket->send(data, dataSize);
|
||||
if(sendResult != dataSize) {
|
||||
if(socket != NULL && socket->getSocketId() > 0) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Error sending NetworkMessage, sendResult = %d, dataSize = %d",sendResult,dataSize);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Error sending NetworkMessage, sendResult = %d, dataSize = %d",sendResult,dataSize);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -88,8 +88,8 @@ void NetworkCommand::preprocessNetworkCommand(World *world) {
|
|||
|
||||
|
||||
string NetworkCommand::toString() const {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"networkCommandType = %d\nunitId = %d\ncommandTypeId = %d\npositionX = %d\npositionY = %d\nunitTypeId = %d\ntargetId = %d\nwantQueue= %d\nfromFactionIndex = %d\nunitFactionUnitCount = %d\nunitFactionIndex = %d, commandStateType = %d, commandStateValue = %d, unitCommandGroupId = %d",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"networkCommandType = %d\nunitId = %d\ncommandTypeId = %d\npositionX = %d\npositionY = %d\nunitTypeId = %d\ntargetId = %d\nwantQueue= %d\nfromFactionIndex = %d\nunitFactionUnitCount = %d\nunitFactionIndex = %d, commandStateType = %d, commandStateValue = %d, unitCommandGroupId = %d",
|
||||
networkCommandType,unitId,commandTypeId,positionX,positionY,unitTypeId,targetId,wantQueue,
|
||||
fromFactionIndex,unitFactionUnitCount,unitFactionIndex,commandStateType,commandStateValue,
|
||||
unitCommandGroupId);
|
||||
|
|
|
@ -1674,19 +1674,19 @@ void ServerInterface::waitUntilReady(Checksum *checksum) {
|
|||
waitForHosts += waitingForHosts[i];
|
||||
}
|
||||
|
||||
char szBuf[1024]="";
|
||||
char szBuf[8096]="";
|
||||
string updateTextFormat = lang.get("NetworkGameServerLoadStatus");
|
||||
if(updateTextFormat == "" || updateTextFormat[0] == '?') {
|
||||
updateTextFormat = "Waiting for network: %lld seconds elapsed (maximum wait time: %d seconds)";
|
||||
}
|
||||
sprintf(szBuf,updateTextFormat.c_str(),(long long int)(chrono.getMillis() / 1000),int(readyWaitTimeout / 1000));
|
||||
snprintf(szBuf,8096,updateTextFormat.c_str(),(long long int)(chrono.getMillis() / 1000),int(readyWaitTimeout / 1000));
|
||||
|
||||
char szBuf1[1024]="";
|
||||
char szBuf1[8096]="";
|
||||
string statusTextFormat = lang.get("NetworkGameStatusWaiting");
|
||||
if(statusTextFormat == "" || statusTextFormat[0] == '?') {
|
||||
statusTextFormat = "Waiting for players: %s";
|
||||
}
|
||||
sprintf(szBuf1,statusTextFormat.c_str(),waitForHosts.c_str());
|
||||
snprintf(szBuf1,8096,statusTextFormat.c_str(),waitForHosts.c_str());
|
||||
|
||||
logger.add(szBuf, true, szBuf1);
|
||||
|
||||
|
@ -1943,9 +1943,8 @@ string ServerInterface::getNetworkStatus() {
|
|||
int clientLagCount = connectionSlot->getCurrentLagCount();
|
||||
double lastClientCommandListTimeLag = difftime((long int)time(NULL),connectionSlot->getLastReceiveCommandListTime());
|
||||
//float pingTime = connectionSlot->getThreadedPingMS(connectionSlot->getIpAddress().c_str());
|
||||
char szBuf[1024]="";
|
||||
//sprintf(szBuf,", lag = %d [%.2f], ping = %.2fms",clientLagCount,lastClientCommandListTimeLag,pingTime);
|
||||
sprintf(szBuf,", lag = %d [%.2f]",clientLagCount,lastClientCommandListTimeLag);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,", lag = %d [%.2f]",clientLagCount,lastClientCommandListTimeLag);
|
||||
str+= connectionSlot->getName() + string(szBuf);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -777,15 +777,15 @@ bool Faction::applyCosts(const ProducibleType *p,const CommandType *ct) {
|
|||
for(int i=0; i<p->getCostCount(); ++i) {
|
||||
const Resource *r= p->getCost(i);
|
||||
if(r == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"cannot apply costs for p [%s] %d of %d costs resource is null",p->getName().c_str(),i,p->getCostCount());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"cannot apply costs for p [%s] %d of %d costs resource is null",p->getName().c_str(),i,p->getCostCount());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
const ResourceType *rt= r->getType();
|
||||
if(rt == NULL) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"cannot apply costs for p [%s] %d of %d costs resourcetype [%s] is null",p->getName().c_str(),i,p->getCostCount(),r->getDescription().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"cannot apply costs for p [%s] %d of %d costs resourcetype [%s] is null",p->getName().c_str(),i,p->getCostCount(),r->getDescription().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
int cost= r->getAmount();
|
||||
|
@ -1179,8 +1179,8 @@ void Faction::addResourceTargetToCache(const Vec2i &pos,bool incrementUseCounter
|
|||
cacheResourceTargetList[pos] = 1;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[addResourceTargetToCache] pos [%s]cacheResourceTargetList.size() [%ld]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[addResourceTargetToCache] pos [%s]cacheResourceTargetList.size() [%ld]",
|
||||
pos.getString().c_str(),cacheResourceTargetList.size());
|
||||
|
||||
//unit->logSynchData(szBuf);
|
||||
|
@ -1202,8 +1202,8 @@ void Faction::removeResourceTargetFromCache(const Vec2i &pos) {
|
|||
cacheResourceTargetList.erase(pos);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[removeResourceTargetFromCache] pos [%s]cacheResourceTargetList.size() [%ld]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[removeResourceTargetFromCache] pos [%s]cacheResourceTargetList.size() [%ld]",
|
||||
pos.getString().c_str(),cacheResourceTargetList.size());
|
||||
|
||||
//unit->logSynchData(szBuf);
|
||||
|
@ -1346,8 +1346,8 @@ Vec2i Faction::getClosestResourceTypeTargetFromCache(Unit *unit, const ResourceT
|
|||
|
||||
if(deleteList.empty() == false) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[cleaning old resource targets] deleteList.size() [%ld] cacheResourceTargetList.size() [%ld] result [%s]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[cleaning old resource targets] deleteList.size() [%ld] cacheResourceTargetList.size() [%ld] result [%s]",
|
||||
deleteList.size(),cacheResourceTargetList.size(),result.getString().c_str());
|
||||
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
|
@ -1456,19 +1456,6 @@ Vec2i Faction::getClosestResourceTypeTargetFromCache(const Vec2i &pos, const Res
|
|||
//}
|
||||
}
|
||||
}
|
||||
|
||||
//char szBuf[4096]="";
|
||||
//sprintf(szBuf,"[%s::%s Line: %d] [looking for resource targets] result [%s] deleteList.size() [%ld] cacheResourceTargetList.size() [%ld] foundCloseResource [%d]",
|
||||
// __FILE__,__FUNCTION__,__LINE__,result.getString().c_str(),deleteList.size(),cacheResourceTargetList.size(),foundCloseResource);
|
||||
|
||||
//unit->logSynchData(szBuf);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugWorldSynch,"----------------------------------- START [%d] ------------------------------------------------\n",getFrameCount());
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugWorldSynch,"%s",szBuf);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugWorldSynch,"------------------------------------ END [%d] -------------------------------------------------\n",getFrameCount());
|
||||
|
||||
//if(deleteList.empty() == false) {
|
||||
// cleanupResourceTypeTargetCache(&deleteList);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1506,8 +1493,8 @@ void Faction::cleanupResourceTypeTargetCache(std::vector<Vec2i> *deleteListPtr)
|
|||
|
||||
if(deleteList.empty() == false) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[cleaning old resource targets] deleteList.size() [%ld] cacheResourceTargetList.size() [%ld], needToCleanup [%d]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[cleaning old resource targets] deleteList.size() [%ld] cacheResourceTargetList.size() [%ld], needToCleanup [%d]",
|
||||
deleteList.size(),cacheResourceTargetList.size(),needToCleanup);
|
||||
//unit->logSynchData(szBuf);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugWorldSynch,"----------------------------------- START [%d] ------------------------------------------------\n",getFrameCount());
|
||||
|
@ -1863,8 +1850,8 @@ string Faction::getCacheStats() {
|
|||
|
||||
totalBytes /= 1000;
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"cache1Count [%d] cache2Count [%d] total KB: %s",cache1Count,cache2Count,formatNumber(totalBytes).c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"cache1Count [%d] cache2Count [%d] total KB: %s",cache1Count,cache2Count,formatNumber(totalBytes).c_str());
|
||||
result = szBuf;
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -253,8 +253,8 @@ void UnitReference::loadGame(const XmlNode *rootNode,World *world) {
|
|||
if(unitRefNode->hasAttribute("factionIndex") == true) {
|
||||
int factionIndex = unitRefNode->getAttribute("factionIndex")->getIntValue();
|
||||
if(factionIndex >= world->getFactionCount()) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"factionIndex >= world->getFactionCount() [%d] : [%d]",factionIndex,world->getFactionCount());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"factionIndex >= world->getFactionCount() [%d] : [%d]",factionIndex,world->getFactionCount());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
faction = world->getFaction(factionIndex);
|
||||
|
@ -595,8 +595,8 @@ void Unit::setModelFacing(CardinalDir value) {
|
|||
|
||||
Vec2i Unit::getCenteredPos() const {
|
||||
if(type == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -605,8 +605,8 @@ Vec2i Unit::getCenteredPos() const {
|
|||
|
||||
Vec2f Unit::getFloatCenteredPos() const {
|
||||
if(type == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -615,8 +615,8 @@ Vec2f Unit::getFloatCenteredPos() const {
|
|||
|
||||
Vec2i Unit::getCellPos() const {
|
||||
if(type == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -746,8 +746,8 @@ float Unit::getProgressRatio() const{
|
|||
|
||||
float Unit::getHpRatio() const {
|
||||
if(type == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -756,8 +756,8 @@ float Unit::getHpRatio() const {
|
|||
|
||||
float Unit::getEpRatio() const {
|
||||
if(type == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -771,8 +771,8 @@ float Unit::getEpRatio() const {
|
|||
|
||||
const Level *Unit::getNextLevel() const{
|
||||
if(type == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -809,8 +809,8 @@ bool Unit::isOperative() const{
|
|||
|
||||
bool Unit::isAnimProgressBound() const{
|
||||
if(currSkill == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -844,8 +844,8 @@ bool Unit::isAnimProgressBound() const{
|
|||
|
||||
bool Unit::isBeingBuilt() const{
|
||||
if(currSkill == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -891,8 +891,8 @@ UnitBuildInfo Unit::getBuildCommandPendingInfo() const {
|
|||
|
||||
bool Unit::isAlly(const Unit *unit) const {
|
||||
if(unit == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: unit == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: unit == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -901,8 +901,8 @@ bool Unit::isAlly(const Unit *unit) const {
|
|||
|
||||
bool Unit::isDamaged() const {
|
||||
if(type == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -911,8 +911,8 @@ bool Unit::isDamaged() const {
|
|||
|
||||
bool Unit::isInteresting(InterestingUnitType iut) const {
|
||||
if(type == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -945,13 +945,13 @@ bool Unit::isInteresting(InterestingUnitType iut) const {
|
|||
|
||||
void Unit::setCurrSkill(const SkillType *currSkill) {
|
||||
if(currSkill == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
if(this->currSkill == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: this->currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: this->currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1013,8 +1013,8 @@ void Unit::setCurrSkill(const SkillType *currSkill) {
|
|||
|
||||
void Unit::setCurrSkill(SkillClass sc) {
|
||||
if(getType() == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: getType() == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: getType() == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1024,8 +1024,8 @@ void Unit::setCurrSkill(SkillClass sc) {
|
|||
void Unit::setTarget(const Unit *unit){
|
||||
|
||||
if(unit == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: unit == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: unit == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1170,8 +1170,8 @@ void Unit::setVisible(const bool visible) {
|
|||
|
||||
Model *Unit::getCurrentModelPtr() {
|
||||
if(currSkill == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1188,8 +1188,8 @@ Model *Unit::getCurrentModelPtr() {
|
|||
|
||||
const Model *Unit::getCurrentModel() {
|
||||
if(currSkill == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1231,8 +1231,8 @@ bool Unit::checkModelStateInfoForNewHpValue() {
|
|||
|
||||
Vec3f Unit::getCurrVector() const{
|
||||
if(type == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1570,8 +1570,8 @@ void Unit::create(bool startingUnit) {
|
|||
|
||||
void Unit::born(const CommandType *ct) {
|
||||
if(type == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1670,8 +1670,8 @@ const CommandType *Unit::computeCommandType(const Vec2i &pos, const Unit *target
|
|||
SurfaceCell *sc= map->getSurfaceCell(Map::toSurfCoords(pos));
|
||||
|
||||
if(type == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1706,8 +1706,8 @@ const CommandType *Unit::computeCommandType(const Vec2i &pos, const Unit *target
|
|||
bool Unit::needToUpdate() {
|
||||
assert(progress <= 1.f);
|
||||
if(currSkill == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -1806,8 +1806,8 @@ bool Unit::update() {
|
|||
}
|
||||
|
||||
if(currSkill == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2114,8 +2114,8 @@ bool Unit::unitHasAttackBoost(const AttackBoost *boost, const Unit *source) cons
|
|||
|
||||
bool Unit::applyAttackBoost(const AttackBoost *boost, const Unit *source) {
|
||||
if(boost == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: boost == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: boost == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2228,8 +2228,8 @@ bool Unit::applyAttackBoost(const AttackBoost *boost, const Unit *source) {
|
|||
|
||||
void Unit::deapplyAttackBoost(const AttackBoost *boost, const Unit *source) {
|
||||
if(boost == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: boost == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: boost == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2320,8 +2320,8 @@ void Unit::tick() {
|
|||
|
||||
if(isAlive()) {
|
||||
if(type == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2425,8 +2425,8 @@ int Unit::update2() {
|
|||
bool Unit::computeEp() {
|
||||
|
||||
if(currSkill == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2441,8 +2441,8 @@ bool Unit::computeEp() {
|
|||
addItemToVault(&this->ep,this->ep);
|
||||
|
||||
if(getType() == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: getType() == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: getType() == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2454,47 +2454,11 @@ bool Unit::computeEp() {
|
|||
return false;
|
||||
}
|
||||
|
||||
//bool Unit::computeHp() {
|
||||
//
|
||||
// if(currSkill == NULL) {
|
||||
// char szBuf[4096]="";
|
||||
// sprintf(szBuf,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
// throw megaglest_runtime_error(szBuf);
|
||||
// }
|
||||
//
|
||||
// if(isBeingBuilt() == false) {
|
||||
// //cost hp
|
||||
// if(currSkill->getHpCost() > 0) {
|
||||
// bool decHpResult = decHp(currSkill->getHpCost());
|
||||
// if(decHpResult) {
|
||||
//
|
||||
// this->setCauseOfDeath(???);
|
||||
//
|
||||
// Unit::game->getWorld()->getStats()->die(getFactionIndex());
|
||||
// game->getScriptManager()->onUnitDied(this);
|
||||
// }
|
||||
// }
|
||||
// // If we have negative costs then add life
|
||||
// else {
|
||||
// checkItemInVault(&this->hp,this->hp);
|
||||
// hp += -currSkill->getHpCost();
|
||||
// if(hp > type->getTotalMaxHp(&totalUpgrade)) {
|
||||
// hp = type->getTotalMaxHp(&totalUpgrade);
|
||||
// }
|
||||
// addItemToVault(&this->hp,this->hp);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// return true;
|
||||
//}
|
||||
|
||||
bool Unit::repair(){
|
||||
|
||||
if(type == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2529,8 +2493,8 @@ bool Unit::decHp(int i) {
|
|||
checkModelStateInfoForNewHpValue();
|
||||
|
||||
if(type == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2669,8 +2633,8 @@ string Unit::getDesc() const {
|
|||
|
||||
void Unit::applyUpgrade(const UpgradeType *upgradeType){
|
||||
if(upgradeType == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: upgradeType == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: upgradeType == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2717,16 +2681,16 @@ void Unit::checkUnitLevel() {
|
|||
bool Unit::morph(const MorphCommandType *mct){
|
||||
|
||||
if(mct == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: mct == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: mct == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
const UnitType *morphUnitType= mct->getMorphUnit();
|
||||
|
||||
if(morphUnitType == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: morphUnitType == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: morphUnitType == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2849,8 +2813,8 @@ void Unit::deleteQueuedCommand(Command *command) {
|
|||
|
||||
CommandResult Unit::checkCommand(Command *command) const {
|
||||
if(command == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: command == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: command == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2880,8 +2844,8 @@ CommandResult Unit::checkCommand(Command *command) const {
|
|||
|
||||
//check produced
|
||||
if(command->getCommandType() == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: command->getCommandType() == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: command->getCommandType() == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2902,8 +2866,8 @@ CommandResult Unit::checkCommand(Command *command) const {
|
|||
const UnitType *builtUnit= command->getUnitType();
|
||||
|
||||
if(builtUnit == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: builtUnit == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: builtUnit == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2919,8 +2883,8 @@ CommandResult Unit::checkCommand(Command *command) const {
|
|||
const UpgradeCommandType *uct= static_cast<const UpgradeCommandType*>(command->getCommandType());
|
||||
|
||||
if(uct == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: uct == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: uct == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2935,13 +2899,13 @@ CommandResult Unit::checkCommand(Command *command) const {
|
|||
|
||||
void Unit::applyCommand(Command *command){
|
||||
if(command == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: command == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: command == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
else if(command->getCommandType() == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: command->getCommandType() == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: command->getCommandType() == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2960,8 +2924,8 @@ void Unit::applyCommand(Command *command){
|
|||
const UpgradeCommandType *uct= static_cast<const UpgradeCommandType*>(command->getCommandType());
|
||||
|
||||
if(uct == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: uct == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: uct == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -2972,13 +2936,13 @@ void Unit::applyCommand(Command *command){
|
|||
CommandResult Unit::undoCommand(Command *command){
|
||||
|
||||
if(command == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: command == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: command == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
else if(command->getCommandType() == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: command->getCommandType() == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: command->getCommandType() == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -3005,8 +2969,8 @@ CommandResult Unit::undoCommand(Command *command){
|
|||
if(command->getCommandType()->getClass() == ccUpgrade){
|
||||
const UpgradeCommandType *uct= static_cast<const UpgradeCommandType*>(command->getCommandType());
|
||||
if(uct == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] ERROR: uct == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: uct == NULL, Unit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,this->toString().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -3287,9 +3251,9 @@ void Unit::exploreCells() {
|
|||
void Unit::logSynchData(string file,int line,string source) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
|
||||
|
||||
char szBuf[4096]="";
|
||||
char szBuf[8096]="";
|
||||
|
||||
sprintf(szBuf,
|
||||
snprintf(szBuf,8096,
|
||||
"FrameCount [%d] Unit = %d [%s][%s] pos = %s, lastPos = %s, targetPos = %s, targetVec = %s, meetingPos = %s, progress [%f], progress2 [%d]\nUnit Path [%s]\n",
|
||||
getFrameCount(),
|
||||
id,
|
||||
|
@ -3308,26 +3272,6 @@ void Unit::logSynchData(string file,int line,string source) {
|
|||
progress2,
|
||||
(unitPath != NULL ? unitPath->toString().c_str() : "NULL"));
|
||||
|
||||
/*
|
||||
sprintf(szBuf,
|
||||
"FrameCount [%d] Unit = %d [%s][%s] pos = %s, lastPos = %s, targetPos = %s, targetVec = %s, meetingPos = %s, lastRotation [%f], targetRotation [%f], rotation [%f], progress [%f], progress2 [%d]\nUnit Path [%s]\n",
|
||||
getFrameCount(),
|
||||
id,
|
||||
getFullName().c_str(),
|
||||
faction->getType()->getName().c_str(),
|
||||
//getDesc().c_str(),
|
||||
pos.getString().c_str(),
|
||||
lastPos.getString().c_str(),
|
||||
targetPos.getString().c_str(),
|
||||
targetVec.getString().c_str(),
|
||||
meetingPos.getString().c_str(),
|
||||
lastRotation,
|
||||
targetRotation,
|
||||
rotation,
|
||||
progress,
|
||||
progress2,
|
||||
(unitPath != NULL ? unitPath->toString().c_str() : "NULL"));
|
||||
*/
|
||||
if( lastSynchDataString != string(szBuf) ||
|
||||
lastFile != file ||
|
||||
lastLine != line ||
|
||||
|
@ -3380,8 +3324,8 @@ void Unit::cleanupOldBadHarvestPos() {
|
|||
}
|
||||
|
||||
if(purgeList.empty() == false) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[cleaning old bad harvest targets] purgeList.size() [%ld]",purgeList.size());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[cleaning old bad harvest targets] purgeList.size() [%ld]",purgeList.size());
|
||||
logSynchData(__FILE__,__LINE__,szBuf);
|
||||
|
||||
for(int i = 0; i < purgeList.size(); ++i) {
|
||||
|
|
|
@ -115,8 +115,8 @@ void UpgradeManager::cancelUpgrade(const UpgradeType *upgradeType) {
|
|||
map<const UpgradeType *,int>::iterator iterFind = upgradesLookup.find(upgradeType);
|
||||
if(iterFind != upgradesLookup.end()) {
|
||||
if(iterFind->second >= upgrades.size()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Error canceling upgrade, iterFind->second >= upgrades.size() - [%d] : [%d]",iterFind->second,(int)upgrades.size());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Error canceling upgrade, iterFind->second >= upgrades.size() - [%d] : [%d]",iterFind->second,(int)upgrades.size());
|
||||
throw megaglest_runtime_error("Error canceling upgrade, upgrade not found in upgrade manager");
|
||||
}
|
||||
int eraseIndex = iterFind->second;
|
||||
|
|
|
@ -115,8 +115,8 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
|||
}
|
||||
}
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,Lang::getInstance().get("LogScreenGameLoadingFactionType","",true).c_str(),formatString(name).c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,Lang::getInstance().get("LogScreenGameLoadingFactionType","",true).c_str(),formatString(name).c_str());
|
||||
Logger::getInstance().add(szBuf, true);
|
||||
|
||||
if(personalityType == fpt_Normal) {
|
||||
|
@ -345,8 +345,8 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
const uint32 MAX_BITRATE_WARNING = 200000;
|
||||
StrSound *factionMusic = getMusic();
|
||||
if(factionMusic != NULL && factionMusic->getInfo()->getBitRate() > MAX_BITRATE_WARNING) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Faction [%s] has the music [%s]\nwhich has a bitrate of [%u] which may cause some sound drivers to crash, please use a bitrate of %d or less!",this->getName().c_str(),factionMusic->getFileName().c_str(),factionMusic->getInfo()->getBitRate(),MAX_BITRATE_WARNING);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Faction [%s] has the music [%s]\nwhich has a bitrate of [%u] which may cause some sound drivers to crash, please use a bitrate of %d or less!",this->getName().c_str(),factionMusic->getFileName().c_str(),factionMusic->getInfo()->getBitRate(),MAX_BITRATE_WARNING);
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
|
||||
|
@ -356,16 +356,16 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
for(int i = 0; i < unitType.getSelectionSounds().getSounds().size(); ++i) {
|
||||
StaticSound *sound = unitType.getSelectionSounds().getSounds()[i];
|
||||
if(sound != NULL && sound->getInfo()->getBitRate() > MAX_BITRATE_WARNING) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has the sound [%s]\nwhich has a bitrate of [%u] which may cause some sound drivers to crash, please use a bitrate of %d or less!",unitType.getName().c_str(),this->getName().c_str(),sound->getFileName().c_str(),sound->getInfo()->getBitRate(),MAX_BITRATE_WARNING);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has the sound [%s]\nwhich has a bitrate of [%u] which may cause some sound drivers to crash, please use a bitrate of %d or less!",unitType.getName().c_str(),this->getName().c_str(),sound->getFileName().c_str(),sound->getInfo()->getBitRate(),MAX_BITRATE_WARNING);
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < unitType.getCommandSounds().getSounds().size(); ++i) {
|
||||
StaticSound *sound = unitType.getCommandSounds().getSounds()[i];
|
||||
if(sound != NULL && sound->getInfo()->getBitRate() > MAX_BITRATE_WARNING) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has the sound [%s]\nwhich has a bitrate of [%u] which may cause some sound drivers to crash, please use a bitrate of %d or less!",unitType.getName().c_str(),this->getName().c_str(),sound->getFileName().c_str(),sound->getInfo()->getBitRate(),MAX_BITRATE_WARNING);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has the sound [%s]\nwhich has a bitrate of [%u] which may cause some sound drivers to crash, please use a bitrate of %d or less!",unitType.getName().c_str(),this->getName().c_str(),sound->getFileName().c_str(),sound->getInfo()->getBitRate(),MAX_BITRATE_WARNING);
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -398,8 +398,8 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
}
|
||||
|
||||
if(foundUpgraderUnit == false) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has the command [%s]\nwhich has upgrade requirement [%s] but there are no units able to perform the upgrade!",unitType.getName().c_str(),this->getName().c_str(),cmdType->getName().c_str(),upgradeType->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has the command [%s]\nwhich has upgrade requirement [%s] but there are no units able to perform the upgrade!",unitType.getName().c_str(),this->getName().c_str(),cmdType->getName().c_str(),upgradeType->getName().c_str());
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -422,8 +422,8 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
// Now also validate the the unit to be built
|
||||
// has a be_built_skill
|
||||
if(buildUnit->hasSkillClass(scBeBuilt) == false) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has the command [%s]\nwhich can build the Unit [%s] but the Unit to be built\ndoes not have the skill class [be_built_skill] in this faction!",unitType.getName().c_str(),this->getName().c_str(),cmdType->getName().c_str(),buildUnit->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has the command [%s]\nwhich can build the Unit [%s] but the Unit to be built\ndoes not have the skill class [be_built_skill] in this faction!",unitType.getName().c_str(),this->getName().c_str(),cmdType->getName().c_str(),buildUnit->getName().c_str());
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
|
||||
|
@ -432,8 +432,8 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
}
|
||||
|
||||
if(foundUnit == false) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has the command [%s]\nwhich can build the Unit [%s] but the Unit to be built does not exist in this faction!",unitType.getName().c_str(),this->getName().c_str(),cmdType->getName().c_str(),buildUnit->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has the command [%s]\nwhich can build the Unit [%s] but the Unit to be built does not exist in this faction!",unitType.getName().c_str(),this->getName().c_str(),cmdType->getName().c_str(),buildUnit->getName().c_str());
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -456,8 +456,8 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
}
|
||||
|
||||
if(foundUnit == false) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has the command [%s]\nwhich can repair the Unit [%s] but the Unit to be repaired does not exist in this faction!",unitType.getName().c_str(),this->getName().c_str(),cmdType->getName().c_str(),repairUnit->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has the command [%s]\nwhich can repair the Unit [%s] but the Unit to be repaired does not exist in this faction!",unitType.getName().c_str(),this->getName().c_str(),cmdType->getName().c_str(),repairUnit->getName().c_str());
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -482,8 +482,8 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
}
|
||||
|
||||
if(foundUnit == false) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has the command [%s]\nwhich can morph into the Unit [%s] but the Unit to be morphed to does not exist in this faction!",unitType.getName().c_str(),this->getName().c_str(),cmdType->getName().c_str(),morphUnit->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has the command [%s]\nwhich can morph into the Unit [%s] but the Unit to be morphed to does not exist in this faction!",unitType.getName().c_str(),this->getName().c_str(),cmdType->getName().c_str(),morphUnit->getName().c_str());
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -493,8 +493,8 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
|
||||
const int maxMorphsAllowed = 6;
|
||||
if(morphCommandCount > maxMorphsAllowed) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has more than %d morph commands which is too many to display in the UI!",unitType.getName().c_str(),this->getName().c_str(),maxMorphsAllowed);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has more than %d morph commands which is too many to display in the UI!",unitType.getName().c_str(),this->getName().c_str(),maxMorphsAllowed);
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
|
||||
|
@ -515,8 +515,8 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
}
|
||||
|
||||
if(foundUnit == false) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has the required Unit [%s]\nbut the required unit does not exist in this faction!",unitType.getName().c_str(),this->getName().c_str(),unitType2->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has the required Unit [%s]\nbut the required unit does not exist in this faction!",unitType.getName().c_str(),this->getName().c_str(),unitType2->getName().c_str());
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -594,8 +594,8 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
if(foundUnit == false) {
|
||||
//printf("Problem for unit [%s] unitTypes.size() = %lu\n",unitType.getName().c_str(),unitTypes.size());
|
||||
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has no other units that can produce, build or morph into it in this faction!",unitType.getName().c_str(),this->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has no other units that can produce, build or morph into it in this faction!",unitType.getName().c_str(),this->getName().c_str());
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
|
||||
|
@ -606,8 +606,8 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
if(st != NULL && dynamic_cast<const AttackSkillType *>(st) != NULL) {
|
||||
const AttackSkillType *ast = dynamic_cast<const AttackSkillType *>(st);
|
||||
if(ast->getAttackVar() < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has the skill [%s] with an INVALID attack var value which is < 0 [%d]!",unitType.getName().c_str(),this->getName().c_str(),ast->getName().c_str(),ast->getAttackVar());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has the skill [%s] with an INVALID attack var value which is < 0 [%d]!",unitType.getName().c_str(),this->getName().c_str(),ast->getName().c_str(),ast->getAttackVar());
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -618,8 +618,8 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
// Check if the unit has both be_built and harvest skills, this may cause issues
|
||||
// with the AI
|
||||
if(unitType.hasSkillClass(scBeBuilt) == true && unitType.hasSkillClass(scHarvest) == true) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has both a bebuilt and harvest skill which will cause AI problems for CPU players!",unitType.getName().c_str(),this->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has both a bebuilt and harvest skill which will cause AI problems for CPU players!",unitType.getName().c_str(),this->getName().c_str());
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
// end
|
||||
|
@ -627,8 +627,8 @@ std::vector<std::string> FactionType::validateFactionType() {
|
|||
// Check if the unit has harvest skills but not move, meaning they cannot
|
||||
// harvest the resource
|
||||
if(unitType.hasSkillClass(scHarvest) == true && unitType.hasSkillClass(scMove) == false) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has a harvest skill but no move skill so it cannot harvest!",unitType.getName().c_str(),this->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has a harvest skill but no move skill so it cannot harvest!",unitType.getName().c_str(),this->getName().c_str());
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
// end
|
||||
|
@ -661,8 +661,8 @@ std::vector<std::string> FactionType::validateFactionTypeResourceTypes(vector<Re
|
|||
}
|
||||
|
||||
if(foundResourceType == false) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has the resource req [%s]\nbut there are no such resources in this tech!",unitType.getName().c_str(),this->getName().c_str(),r->getType()->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has the resource req [%s]\nbut there are no such resources in this tech!",unitType.getName().c_str(),this->getName().c_str(),r->getType()->getName().c_str());
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -685,8 +685,8 @@ std::vector<std::string> FactionType::validateFactionTypeResourceTypes(vector<Re
|
|||
}
|
||||
|
||||
if(foundResourceType == false) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has the stored resource [%s]\nbut there are no such resources in this tech!",unitType.getName().c_str(),this->getName().c_str(),r->getType()->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has the stored resource [%s]\nbut there are no such resources in this tech!",unitType.getName().c_str(),this->getName().c_str(),r->getType()->getName().c_str());
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -714,8 +714,8 @@ std::vector<std::string> FactionType::validateFactionTypeResourceTypes(vector<Re
|
|||
}
|
||||
|
||||
if(foundResourceType == false) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Unit [%s] in Faction [%s] has the command [%s] which can harvest the resource [%s]\nbut there are no such resources in this tech!",unitType.getName().c_str(),this->getName().c_str(),cmdType->getName().c_str(),harvestResource->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Unit [%s] in Faction [%s] has the command [%s] which can harvest the resource [%s]\nbut there are no such resources in this tech!",unitType.getName().c_str(),this->getName().c_str(),cmdType->getName().c_str(),harvestResource->getName().c_str());
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -760,8 +760,8 @@ std::vector<std::string> FactionType::validateFactionTypeUpgradeTypes() {
|
|||
}
|
||||
|
||||
if(foundUnit == false) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Upgrade Type [%s] in Faction [%s] has no Unit able to produce this upgrade in this faction!",upgradeType.getName().c_str(),this->getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Upgrade Type [%s] in Faction [%s] has no Unit able to produce this upgrade in this faction!",upgradeType.getName().c_str(),this->getName().c_str());
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtre
|
|||
|
||||
name= lastDir(dir);
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,Lang::getInstance().get("LogScreenGameLoadingResourceType","",true).c_str(),formatString(name).c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,Lang::getInstance().get("LogScreenGameLoadingResourceType","",true).c_str(),formatString(name).c_str());
|
||||
Logger::getInstance().add(szBuf, true);
|
||||
|
||||
string currentPath = dir;
|
||||
|
|
|
@ -331,8 +331,8 @@ void SkillType::loadAttackBoost(const XmlNode *attackBoostsNode, const XmlNode *
|
|||
}
|
||||
}
|
||||
else {
|
||||
char szBuf[4096] = "";
|
||||
sprintf(szBuf, "Unsupported target [%s] specified for attack boost for skill [%s] in [%s]", targetType.c_str(), name.c_str(), parentLoader.c_str());
|
||||
char szBuf[8096] = "";
|
||||
snprintf(szBuf, 8096,"Unsupported target [%s] specified for attack boost for skill [%s] in [%s]", targetType.c_str(), name.c_str(), parentLoader.c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -417,8 +417,8 @@ void SkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
|
|||
}
|
||||
}
|
||||
if(animations.empty() == true) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"Error no animations found for skill [%s] for parentLoader [%s]",name.c_str(),parentLoader.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Error no animations found for skill [%s] for parentLoader [%s]",name.c_str(),parentLoader.c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -733,8 +733,8 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
|
|||
attackVar= sn->getChild("attack-var")->getAttribute("value")->getIntValue();
|
||||
|
||||
if(attackVar < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The attack skill has an INVALID attack var value which is < 0 [%d] in file [%s]!",attackVar,dir.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The attack skill has an INVALID attack var value which is < 0 [%d] in file [%s]!",attackVar,dir.c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -90,8 +90,8 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||
treePath = currentPath;
|
||||
name= lastDir(currentPath);
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,Lang::getInstance().get("LogScreenGameLoadingTechtree","",true).c_str(),formatString(name).c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,Lang::getInstance().get("LogScreenGameLoadingTechtree","",true).c_str(),formatString(name).c_str());
|
||||
Logger::getInstance().add(szBuf, true);
|
||||
|
||||
vector<string> filenames;
|
||||
|
@ -201,8 +201,8 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||
for ( set<string>::iterator it = factions.begin(); it != factions.end(); ++it ) {
|
||||
string factionName = *it;
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"%s %s [%d / %d] - %s",Lang::getInstance().get("Loading").c_str(),
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"%s %s [%d / %d] - %s",Lang::getInstance().get("Loading").c_str(),
|
||||
Lang::getInstance().get("Faction").c_str(),
|
||||
i+1,
|
||||
(int)factions.size(),
|
||||
|
@ -293,8 +293,8 @@ std::vector<std::string> TechTree::validateResourceTypes() {
|
|||
|
||||
for (unsigned int i = 0; i < resourceTypesNotUsed.size(); ++i) {
|
||||
const ResourceType &rt = resourceTypesNotUsed[i];
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"The Resource type [%s] is not used by any units in this techtree!",rt.getName().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"The Resource type [%s] is not used by any units in this techtree!",rt.getName().c_str());
|
||||
results.push_back(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ const ResourceType *TechTree::getFirstTechResourceType() const{
|
|||
}
|
||||
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"The referenced tech tree [%s] is either missing or has no resources defined but at least one resource is required.",this->name.c_str());
|
||||
snprintf(szBuf,8096,"The referenced tech tree [%s] is either missing or has no resources defined but at least one resource is required.",this->name.c_str());
|
||||
//throw megaglest_runtime_error("This tech tree has no resources defined, at least one is required");
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
|
|
@ -167,8 +167,8 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const
|
|||
try {
|
||||
//Lang &lang= Lang::getInstance();
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,Lang::getInstance().get("LogScreenGameLoadingUnitType","",true).c_str(),formatString(name).c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,Lang::getInstance().get("LogScreenGameLoadingUnitType","",true).c_str(),formatString(name).c_str());
|
||||
Logger::getInstance().add(szBuf, true);
|
||||
|
||||
//file load
|
||||
|
@ -600,7 +600,7 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const
|
|||
const XmlNode *skillsNode= unitNode->getChild("skills");
|
||||
skillTypes.resize(skillsNode->getChildCount());
|
||||
|
||||
sprintf(szBuf,Lang::getInstance().get("LogScreenGameLoadingUnitTypeSkills","",true).c_str(),formatString(name).c_str(),skillTypes.size());
|
||||
snprintf(szBuf,8096,Lang::getInstance().get("LogScreenGameLoadingUnitTypeSkills","",true).c_str(),formatString(name).c_str(),skillTypes.size());
|
||||
Logger::getInstance().add(szBuf, true);
|
||||
|
||||
for(int i = 0; i < skillTypes.size(); ++i) {
|
||||
|
@ -612,8 +612,6 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, const
|
|||
skillType->load(sn, attackBoostsNode, dir, techTree, factionType, loadedFileList,sourceXMLFile);
|
||||
skillTypes[i]= skillType;
|
||||
|
||||
//sprintf(szBuf,Lang::getInstance().get("LogScreenGameLoadingUnitTypeSkills","",true).c_str(),formatString(name).c_str(),i+1,skillTypes.size());
|
||||
//Logger::getInstance().add(szBuf, true);
|
||||
}
|
||||
|
||||
//commands
|
||||
|
@ -980,8 +978,8 @@ const CommandType* UnitType::findCommandTypeById(int id) const{
|
|||
|
||||
const CommandType *UnitType::getCommandType(int i) const {
|
||||
if(i >= commandTypes.size()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] i >= commandTypes.size(), i = %d, commandTypes.size() = %lu",__FILE__,__FUNCTION__,__LINE__,i,(unsigned long)commandTypes.size());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] i >= commandTypes.size(), i = %d, commandTypes.size() = %lu",__FILE__,__FUNCTION__,__LINE__,i,(unsigned long)commandTypes.size());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
return commandTypes[i];
|
||||
|
|
|
@ -509,8 +509,8 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
|
|||
Checksum* techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,Lang::getInstance().get("LogScreenGameLoadingUpgradeType","",true).c_str(),formatString(name).c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,Lang::getInstance().get("LogScreenGameLoadingUpgradeType","",true).c_str(),formatString(name).c_str());
|
||||
Logger::getInstance().add(szBuf, true);
|
||||
|
||||
string currentPath = dir;
|
||||
|
|
|
@ -327,8 +327,8 @@ void Map::end(){
|
|||
|
||||
Vec2i Map::getStartLocation(int locationIndex) const {
|
||||
if(locationIndex >= maxPlayers) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"locationIndex >= maxPlayers [%d] [%d]",locationIndex, maxPlayers);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"locationIndex >= maxPlayers [%d] [%d]",locationIndex, maxPlayers);
|
||||
printf("%s\n",szBuf);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
//assert(locationIndex < maxPlayers);
|
||||
|
@ -574,8 +574,8 @@ bool Map::isResourceNear(const Vec2i &pos, const ResourceType *rt, Vec2i &resour
|
|||
resourcePos = result;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[found peer harvest pos] pos [%s] resourcePos [%s] unit->getFaction()->getCacheResourceTargetListSize() [%d]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[found peer harvest pos] pos [%s] resourcePos [%s] unit->getFaction()->getCacheResourceTargetListSize() [%d]",
|
||||
pos.getString().c_str(),resourcePos.getString().c_str(),unit->getFaction()->getCacheResourceTargetListSize());
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
}
|
||||
|
@ -1295,7 +1295,7 @@ void Map::putUnitCellsPrivate(Unit *unit, const Vec2i &pos, const UnitType *ut,
|
|||
}
|
||||
else {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"Trying to move unit [%d - %s] into occupied cell [%s] and field = %d, unit already in cell [%d - %s] ",unit->getId(),unit->getType()->getName().c_str(),pos.getString().c_str(),field,getCell(currPos)->getUnit(field)->getId(),getCell(currPos)->getUnit(field)->getType()->getName().c_str());
|
||||
snprintf(szBuf,8096,"Trying to move unit [%d - %s] into occupied cell [%s] and field = %d, unit already in cell [%d - %s] ",unit->getId(),unit->getType()->getName().c_str(),pos.getString().c_str(),field,getCell(currPos)->getUnit(field)->getId(),getCell(currPos)->getUnit(field)->getType()->getName().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@ Checksum Scenario::load(const string &path) {
|
|||
|
||||
string name= cutLastExt(lastDir(path));
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,Lang::getInstance().get("LogScreenGameLoadingScenario","",true).c_str(),formatString(name).c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,Lang::getInstance().get("LogScreenGameLoadingScenario","",true).c_str(),formatString(name).c_str());
|
||||
Logger::getInstance().add(szBuf, true);
|
||||
|
||||
Scenario::loadScenarioInfo(path, &info);
|
||||
|
@ -71,7 +71,7 @@ Checksum Scenario::load(const string &path) {
|
|||
//Exception handling (conversions and so on);
|
||||
catch(const exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s %d]\nError loading scenario [%s]:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s %d]\nError loading scenario [%s]:\n%s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf);
|
||||
|
||||
|
@ -165,28 +165,28 @@ void Scenario::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo) {
|
|||
|
||||
const XmlNode *scenarioNode= xmlTree.getRootNode();
|
||||
if(scenarioNode == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"scenarioNode == NULL for file [%s]\n",file.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"scenarioNode == NULL for file [%s]\n",file.c_str());
|
||||
throw std::runtime_error(szBuf);
|
||||
}
|
||||
const XmlNode *difficultyNode= scenarioNode->getChild("difficulty");
|
||||
if(difficultyNode == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"difficultyNode == NULL for file [%s]\n",file.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"difficultyNode == NULL for file [%s]\n",file.c_str());
|
||||
throw std::runtime_error(szBuf);
|
||||
}
|
||||
|
||||
scenarioInfo->difficulty = difficultyNode->getAttribute("value")->getIntValue();
|
||||
if( scenarioInfo->difficulty < dVeryEasy || scenarioInfo->difficulty > dInsane ) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"Invalid difficulty value specified in scenario: %d must be between %d and %d",scenarioInfo->difficulty,dVeryEasy,dInsane);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Invalid difficulty value specified in scenario: %d must be between %d and %d",scenarioInfo->difficulty,dVeryEasy,dInsane);
|
||||
throw std::runtime_error(szBuf);
|
||||
}
|
||||
|
||||
const XmlNode *playersNode= scenarioNode->getChild("players");
|
||||
if(playersNode == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"playersNode == NULL for file [%s]\n",file.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"playersNode == NULL for file [%s]\n",file.c_str());
|
||||
throw std::runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -198,8 +198,8 @@ void Scenario::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo) {
|
|||
if(playersNode->hasChildAtIndex("player",i)) {
|
||||
playerNode = playersNode->getChild("player", i);
|
||||
if(playerNode == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"playerNode == NULL for index = %d for file [%s]\n",i,file.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"playerNode == NULL for index = %d for file [%s]\n",i,file.c_str());
|
||||
throw std::runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -234,8 +234,8 @@ void Scenario::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo) {
|
|||
int teamIndex = playerNode->getAttribute("team")->getIntValue();
|
||||
|
||||
if( teamIndex < 1 || teamIndex > GameConstants::maxPlayers + GameConstants::specialFactions) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"Invalid team value specified in scenario: %d must be between %d and %d",teamIndex,1,GameConstants::maxPlayers);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Invalid team value specified in scenario: %d must be between %d and %d",teamIndex,1,GameConstants::maxPlayers);
|
||||
throw std::runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -248,33 +248,33 @@ void Scenario::loadScenarioInfo(string file, ScenarioInfo *scenarioInfo) {
|
|||
}
|
||||
|
||||
if(scenarioNode->getChild("map") == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"map == NULL for file [%s]\n",file.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"map == NULL for file [%s]\n",file.c_str());
|
||||
throw std::runtime_error(szBuf);
|
||||
}
|
||||
if(scenarioNode->getChild("tileset") == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"tileset == NULL for file [%s]\n",file.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"tileset == NULL for file [%s]\n",file.c_str());
|
||||
throw std::runtime_error(szBuf);
|
||||
}
|
||||
if(scenarioNode->getChild("tech-tree") == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"tech-tree == NULL for file [%s]\n",file.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"tech-tree == NULL for file [%s]\n",file.c_str());
|
||||
throw std::runtime_error(szBuf);
|
||||
}
|
||||
if(scenarioNode->getChild("default-units") == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"default-units == NULL for file [%s]\n",file.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"default-units == NULL for file [%s]\n",file.c_str());
|
||||
throw std::runtime_error(szBuf);
|
||||
}
|
||||
if(scenarioNode->getChild("default-resources") == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"default-resources == NULL for file [%s]\n",file.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"default-resources == NULL for file [%s]\n",file.c_str());
|
||||
throw std::runtime_error(szBuf);
|
||||
}
|
||||
if(scenarioNode->getChild("default-victory-conditions") == NULL) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"default-victory-conditions == NULL for file [%s]\n",file.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"default-victory-conditions == NULL for file [%s]\n",file.c_str());
|
||||
throw std::runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -353,8 +353,8 @@ ControlType Scenario::strToControllerType(const string &str) {
|
|||
return ctNetwork;
|
||||
}
|
||||
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"Invalid controller value specified in scenario: [%s] must be one of the following: closed, cpu-easy, cpu, cpu-ultra, cpu-mega, human",str.c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Invalid controller value specified in scenario: [%s] must be one of the following: closed, cpu-easy, cpu, cpu-ultra, cpu-mega, human",str.c_str());
|
||||
throw std::runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -134,8 +134,8 @@ void SurfaceAtlas::checkDimensions(const Pixmap2D *p) {
|
|||
//printf("Setting surfaceSize = %d for pixmap [%s]\n",surfaceSize,p->getPath().c_str());
|
||||
}
|
||||
else if(p->getW() != surfaceSize || p->getH() != surfaceSize) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Bad surface texture dimensions, expected surfaceSize = %d, texture w = %d, h = %d",surfaceSize,p->getW(),p->getH());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Bad surface texture dimensions, expected surfaceSize = %d, texture w = %d, h = %d",surfaceSize,p->getW(),p->getH());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,8 +161,8 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
|
|||
checksumValue.addFile(path);
|
||||
|
||||
try {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,Lang::getInstance().get("LogScreenGameLoadingTileset","",true).c_str(),formatString(name).c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,Lang::getInstance().get("LogScreenGameLoadingTileset","",true).c_str(),formatString(name).c_str());
|
||||
Logger::getInstance().add(szBuf, true);
|
||||
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
|
|
|
@ -418,8 +418,8 @@ void UnitUpdater::updateMove(Unit *unit, int frameIndex) {
|
|||
Vec2i pos= command->getUnit()!=NULL? command->getUnit()->getCenteredPos(): command->getPos();
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[updateMove] pos [%s] unit [%d - %s] cmd [%s]",pos.getString().c_str(),unit->getId(),unit->getFullName().c_str(),command->toString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[updateMove] pos [%s] unit [%d - %s] cmd [%s]",pos.getString().c_str(),unit->getId(),unit->getFullName().c_str(),command->toString().c_str());
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
}
|
||||
|
||||
|
@ -505,8 +505,8 @@ void UnitUpdater::updateAttack(Unit *unit, int frameIndex) {
|
|||
}
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[updateAttack] pos [%s] unit->getPos() [%s]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[updateAttack] pos [%s] unit->getPos() [%s]",
|
||||
pos.getString().c_str(),unit->getPos().getString().c_str());
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
}
|
||||
|
@ -715,8 +715,8 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) {
|
|||
//Vec2i buildPos = (command->getPos() + Vec2i(ut->getSize() / 2));
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[updateBuild] unit->getPos() [%s] command->getPos() [%s] buildPos [%s]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[updateBuild] unit->getPos() [%s] command->getPos() [%s] buildPos [%s]",
|
||||
unit->getPos().getString().c_str(),command->getPos().getString().c_str(),buildPos.getString().c_str());
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
}
|
||||
|
@ -986,8 +986,8 @@ void UnitUpdater::updateHarvest(Unit *unit, int frameIndex) {
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[updateHarvest] unit->getPos() [%s] command->getPos() [%s]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[updateHarvest] unit->getPos() [%s] command->getPos() [%s]",
|
||||
unit->getPos().getString().c_str(),command->getPos().getString().c_str());
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
}
|
||||
|
@ -1063,8 +1063,8 @@ void UnitUpdater::updateHarvest(Unit *unit, int frameIndex) {
|
|||
//if not continue walking
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[updateHarvest #2] unit->getPos() [%s] command->getPos() [%s] targetPos [%s]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[updateHarvest #2] unit->getPos() [%s] command->getPos() [%s] targetPos [%s]",
|
||||
unit->getPos().getString().c_str(),command->getPos().getString().c_str(),targetPos.getString().c_str());
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
}
|
||||
|
@ -1117,8 +1117,8 @@ void UnitUpdater::updateHarvest(Unit *unit, int frameIndex) {
|
|||
Unit *store= world->nearestStore(unit->getPos(), unit->getFaction()->getIndex(), unit->getLoadType());
|
||||
if(store != NULL) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[updateHarvest #3] unit->getPos() [%s] store->getCenteredPos() [%s]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[updateHarvest #3] unit->getPos() [%s] store->getCenteredPos() [%s]",
|
||||
unit->getPos().getString().c_str(),store->getCenteredPos().getString().c_str());
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
}
|
||||
|
@ -1580,8 +1580,8 @@ void UnitUpdater::updateRepair(Unit *unit, int frameIndex) {
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"[updateRepair] unit->getPos() [%s] command->getPos()() [%s] repairPos [%s]",unit->getPos().getString().c_str(),command->getPos().getString().c_str(),repairPos.getString().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"[updateRepair] unit->getPos() [%s] command->getPos()() [%s] repairPos [%s]",unit->getPos().getString().c_str(),command->getPos().getString().c_str(),repairPos.getString().c_str());
|
||||
unit->logSynchData(__FILE__,__LINE__,szBuf);
|
||||
}
|
||||
|
||||
|
@ -2476,8 +2476,8 @@ string UnitUpdater::getUnitRangeCellsLookupItemCacheStats() {
|
|||
uint64 totalBytes = rangeCountCellCount * sizeof(Cell *);
|
||||
totalBytes /= 1000;
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"pos [%d] size [%d] range [%d][%d] total KB: %s",posCount,sizeCount,rangeCount,rangeCountCellCount,formatNumber(totalBytes).c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"pos [%d] size [%d] range [%d][%d] total KB: %s",posCount,sizeCount,rangeCount,rangeCountCellCount,formatNumber(totalBytes).c_str());
|
||||
result = szBuf;
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -257,7 +257,7 @@ void World::init(Game *game, bool createUnits, bool initFactions){
|
|||
gotError = true;
|
||||
if(ex.wantStackTrace() == true) {
|
||||
char szErrBuf[8096]="";
|
||||
sprintf(szErrBuf,"In [%s::%s %d]",__FILE__,__FUNCTION__,__LINE__);
|
||||
snprintf(szErrBuf,8096,"In [%s::%s %d]",__FILE__,__FUNCTION__,__LINE__);
|
||||
sErrBuf = string(szErrBuf) + string("\nerror [") + string(ex.what()) + string("]\n");
|
||||
}
|
||||
else {
|
||||
|
@ -269,7 +269,7 @@ void World::init(Game *game, bool createUnits, bool initFactions){
|
|||
catch(const std::exception &ex) {
|
||||
gotError = true;
|
||||
char szErrBuf[8096]="";
|
||||
sprintf(szErrBuf,"In [%s::%s %d]",__FILE__,__FUNCTION__,__LINE__);
|
||||
snprintf(szErrBuf,8096,"In [%s::%s %d]",__FILE__,__FUNCTION__,__LINE__);
|
||||
sErrBuf = string(szErrBuf) + string("\nerror [") + string(ex.what()) + string("]\n");
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,sErrBuf.c_str());
|
||||
}
|
||||
|
@ -1746,8 +1746,8 @@ void World::placeUnitAtLocation(const Vec2i &location, int radius, Unit *unit, b
|
|||
delete unit;
|
||||
unit = NULL;
|
||||
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"Unit: [%s] can't be placed, this error is caused because there\nis not enough room to put all units near their start location.\nmake a better/larger map. Faction: #%d name: [%s]",
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Unit: [%s] can't be placed, this error is caused because there\nis not enough room to put all units near their start location.\nmake a better/larger map. Faction: #%d name: [%s]",
|
||||
unitName.c_str(),unitFactionIndex,unitFactionName.c_str());
|
||||
throw megaglest_runtime_error(szBuf,false);
|
||||
}
|
||||
|
@ -1802,7 +1802,7 @@ void World::initUnits() {
|
|||
gotError = true;
|
||||
if(ex.wantStackTrace() == true) {
|
||||
char szErrBuf[8096]="";
|
||||
sprintf(szErrBuf,"In [%s::%s %d]",__FILE__,__FUNCTION__,__LINE__);
|
||||
snprintf(szErrBuf,8096,"In [%s::%s %d]",__FILE__,__FUNCTION__,__LINE__);
|
||||
sErrBuf = string(szErrBuf) + string("\nerror [") + string(ex.what()) + string("]\n");
|
||||
}
|
||||
else {
|
||||
|
@ -1814,7 +1814,7 @@ void World::initUnits() {
|
|||
catch(const std::exception &ex) {
|
||||
gotError = true;
|
||||
char szErrBuf[8096]="";
|
||||
sprintf(szErrBuf,"In [%s::%s %d]",__FILE__,__FUNCTION__,__LINE__);
|
||||
snprintf(szErrBuf,8096,"In [%s::%s %d]",__FILE__,__FUNCTION__,__LINE__);
|
||||
sErrBuf = string(szErrBuf) + string("\nerror [") + string(ex.what()) + string("]\n");
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,sErrBuf.c_str());
|
||||
}
|
||||
|
@ -2259,8 +2259,8 @@ string World::getExploredCellsLookupItemCacheStats() {
|
|||
|
||||
totalBytes /= 1000;
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"pos [%d] sight [%d] [%d][%d] total KB: %s",posCount,sightCount,exploredCellCount,visibleCellCount,formatNumber(totalBytes).c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"pos [%d] sight [%d] [%d][%d] total KB: %s",posCount,sightCount,exploredCellCount,visibleCellCount,formatNumber(totalBytes).c_str());
|
||||
result = szBuf;
|
||||
return result;
|
||||
}
|
||||
|
@ -2292,8 +2292,8 @@ string World::getFowAlphaCellsLookupItemCacheStats() {
|
|||
|
||||
totalBytes /= 1000;
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"pos [%d] sight [%d] [%d][%d] total KB: %s",posCount,sightCount,surfPosCount,alphaListCount,formatNumber(totalBytes).c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"pos [%d] sight [%d] [%d][%d] total KB: %s",posCount,sightCount,surfPosCount,alphaListCount,formatNumber(totalBytes).c_str());
|
||||
result = szBuf;
|
||||
return result;
|
||||
}
|
||||
|
@ -2312,8 +2312,8 @@ string World::getAllFactionsCacheStats() {
|
|||
totalCache2Size += cache2Size;
|
||||
}
|
||||
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"totalCache1Size [%lu] totalCache1Size [%lu] total KB: %s",totalCache1Size,totalCache2Size,formatNumber(totalBytes).c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"totalCache1Size [%lu] totalCache1Size [%lu] total KB: %s",totalCache1Size,totalCache2Size,formatNumber(totalBytes).c_str());
|
||||
result = szBuf;
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -61,8 +61,8 @@ void inline _assertGl(const char *file, int line, GLenum *forceErrorNumber = NUL
|
|||
|
||||
//if(error != GL_INVALID_ENUM) {
|
||||
const char *errorString= reinterpret_cast<const char*>(gluErrorString(error));
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"OpenGL error #%d [0x%X] : [%s] at file: [%s], line: %d",error,error,errorString,file,line);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"OpenGL error #%d [0x%X] : [%s] at file: [%s], line: %d",error,error,errorString,file,line);
|
||||
//throw megaglest_runtime_error("OpenGL error #" + intToStr(error) + " : " + string(errorString) + " at file: " + string(file) + ", line " + intToStr(line));
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
//}
|
||||
|
|
|
@ -487,8 +487,8 @@ int mainSetup(int argc, char **argv) {
|
|||
|
||||
const int knownArgCount = sizeof(GAME_ARGS) / sizeof(GAME_ARGS[0]);
|
||||
if(knownArgCount != GAME_ARG_END) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Internal arg count mismatch knownArgCount = %d, GAME_ARG_END = %d",knownArgCount,GAME_ARG_END);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Internal arg count mismatch knownArgCount = %d, GAME_ARG_END = %d",knownArgCount,GAME_ARG_END);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
// prepare command to be executed
|
||||
// our program need to be passed after the -e parameter
|
||||
//sprintf (buf, "/usr/bin/addr2line -C -e ./a.out -f -i %lx", addr);
|
||||
sprintf(buf, "addr2line -C -e %s -f -i %p",AllocInfo::get_application_binary().c_str(),address);
|
||||
snprintf(buf, 8096,"addr2line -C -e %s -f -i %p",AllocInfo::get_application_binary().c_str(),address);
|
||||
|
||||
FILE* f = popen (buf, "r");
|
||||
if (f == NULL) {
|
||||
|
@ -231,12 +231,12 @@ public:
|
|||
}
|
||||
//fprintf(out, " %s:%s\n", stack.strings[i], function);
|
||||
|
||||
sprintf(szBuf,"%s:%s address [%p]",stack_strings[i],function,lineAddress);
|
||||
snprintf(szBuf,8096,"%s:%s address [%p]",stack_strings[i],function,lineAddress);
|
||||
}
|
||||
else {
|
||||
// didn't find the mangled name, just print the whole line
|
||||
//fprintf(out, " %s\n", stack.strings[i]);
|
||||
sprintf(szBuf,"%s address [%p]",stack_strings[i],lineAddress);
|
||||
snprintf(szBuf,8096,"%s address [%p]",stack_strings[i],lineAddress);
|
||||
}
|
||||
|
||||
errMsg += string(szBuf);
|
||||
|
@ -246,7 +246,7 @@ public:
|
|||
int line = getFileAndLine(function, lineAddress, file, 8096);
|
||||
if(line >= 0) {
|
||||
char lineBuf[1024]="";
|
||||
sprintf(lineBuf,"%d",line);
|
||||
snprintf(lineBuf,1024,"%d",line);
|
||||
errMsg += " line: " + string(lineBuf);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,14 +65,14 @@ int ftpSendMsg(msgmode_E mode, int sessionId, int ret, const char* msg)
|
|||
|
||||
if(mode == MSG_QUOTE)
|
||||
{
|
||||
sprintf((char*)buf, "%03d \"", ret);
|
||||
snprintf((char*)buf, 6,"%03d \"", ret);
|
||||
sentlen += ftpSend(ftpGetSession(sessionId)->ctrlSocket, buf, 5);
|
||||
sentlen += ftpSend(ftpGetSession(sessionId)->ctrlSocket, msg, len);
|
||||
sentlen += ftpSend(ftpGetSession(sessionId)->ctrlSocket, "\"\r\n", 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf((char*)buf, "%03d ", ret);
|
||||
snprintf((char*)buf, 6,"%03d ", ret);
|
||||
sentlen += ftpSend(ftpGetSession(sessionId)->ctrlSocket, buf, 4);
|
||||
sentlen += ftpSend(ftpGetSession(sessionId)->ctrlSocket, msg, len);
|
||||
sentlen += ftpSend(ftpGetSession(sessionId)->ctrlSocket, "\r\n", 2);
|
||||
|
@ -330,7 +330,7 @@ LOCAL int sendListing(socket_t dataSocket, int sessionId, const char* path, int
|
|||
|
||||
if(currTime.year == fileInfo.mTime.year)
|
||||
{
|
||||
len = sprintf((char*)&scratchBuf[1], "rwxrwxrwx %4u %-8s %-8s %8u %s %02d %02d:%02d %s\r\n",
|
||||
len = snprintf((char*)&scratchBuf[1], LEN_SCRATCHBUF-1,"rwxrwxrwx %4u %-8s %-8s %8u %s %02d %02d:%02d %s\r\n",
|
||||
fileInfo.links,
|
||||
fileInfo.user,
|
||||
fileInfo.group,
|
||||
|
@ -343,7 +343,7 @@ LOCAL int sendListing(socket_t dataSocket, int sessionId, const char* path, int
|
|||
}
|
||||
else
|
||||
{
|
||||
len = sprintf((char*)&scratchBuf[1], "rwxrwxrwx %4u %-8s %-8s %8u %s %02d %5d %s\r\n",
|
||||
len = snprintf((char*)&scratchBuf[1], LEN_SCRATCHBUF-1,"rwxrwxrwx %4u %-8s %-8s %8u %s %02d %5d %s\r\n",
|
||||
fileInfo.links,
|
||||
fileInfo.user,
|
||||
fileInfo.group,
|
||||
|
@ -358,32 +358,32 @@ LOCAL int sendListing(socket_t dataSocket, int sessionId, const char* path, int
|
|||
}
|
||||
else if(format & NLST)
|
||||
{
|
||||
len = sprintf((char*)scratchBuf, "%s\r\n", dirEntry);
|
||||
len = snprintf((char*)scratchBuf, LEN_SCRATCHBUF,"%s\r\n", dirEntry);
|
||||
ftpSend(dataSocket, scratchBuf, len);
|
||||
haveAnySuccessfulFiles = 1;
|
||||
}
|
||||
else if(format & MLSD)
|
||||
{
|
||||
if(!strcmp("..", dirEntry))
|
||||
len = sprintf((char*)scratchBuf, "Type=pdir");
|
||||
len = snprintf((char*)scratchBuf, LEN_SCRATCHBUF,"Type=pdir");
|
||||
else
|
||||
{
|
||||
switch(fileInfo.type)
|
||||
{
|
||||
default:
|
||||
case TYPE_FILE:
|
||||
len = sprintf((char*)scratchBuf, "Type=file");
|
||||
len = snprintf((char*)scratchBuf, LEN_SCRATCHBUF,"Type=file");
|
||||
break;
|
||||
case TYPE_DIR:
|
||||
len = sprintf((char*)scratchBuf, "Type=dir");
|
||||
len = snprintf((char*)scratchBuf, LEN_SCRATCHBUF,"Type=dir");
|
||||
break;
|
||||
case TYPE_LINK:
|
||||
len = sprintf((char*)scratchBuf, "Type=OS.unix=slink");
|
||||
len = snprintf((char*)scratchBuf, LEN_SCRATCHBUF,"Type=OS.unix=slink");
|
||||
break;
|
||||
}
|
||||
}
|
||||
ftpSend(dataSocket, scratchBuf, len);
|
||||
len = sprintf((char*)scratchBuf, ";Size=%u;Modify=%04d%02d%02d%02d%02d%02d;Perm=r; %s\r\n",
|
||||
len = snprintf((char*)scratchBuf, LEN_SCRATCHBUF,";Size=%u;Modify=%04d%02d%02d%02d%02d%02d;Perm=r; %s\r\n",
|
||||
fileInfo.size,
|
||||
fileInfo.mTime.year,
|
||||
fileInfo.mTime.month,
|
||||
|
@ -756,7 +756,7 @@ LOCAL int ftpCmdPasv(int sessionId, const char* args, int len)
|
|||
|
||||
remoteFTPServerIp = ftpFindExternalFTPServerIp(ftpGetSession(sessionId)->remoteIp);
|
||||
|
||||
sprintf(str, "%s (%d,%d,%d,%d,%d,%d)",
|
||||
snprintf(str, 50,"%s (%d,%d,%d,%d,%d,%d)",
|
||||
ftpMsg029,
|
||||
(remoteFTPServerIp >> 24) & 0xFF,
|
||||
(remoteFTPServerIp >> 16) & 0xFF,
|
||||
|
@ -770,7 +770,7 @@ LOCAL int ftpCmdPasv(int sessionId, const char* args, int len)
|
|||
}
|
||||
else
|
||||
{
|
||||
sprintf(str, "%s (%d,%d,%d,%d,%d,%d)",
|
||||
snprintf(str, 50,"%s (%d,%d,%d,%d,%d,%d)",
|
||||
ftpMsg029,
|
||||
(ip >> 24) & 0xFF,
|
||||
(ip >> 16) & 0xFF,
|
||||
|
@ -820,7 +820,7 @@ LOCAL int ftpCmdSize(int sessionId, const char* args, int len)
|
|||
return 2;
|
||||
}
|
||||
|
||||
sprintf(str, "%d", fileInfo.size);
|
||||
snprintf(str, 12,"%d", fileInfo.size);
|
||||
ftpSendMsg(MSG_NORMAL, sessionId, 213, str);
|
||||
|
||||
|
||||
|
@ -841,7 +841,7 @@ LOCAL int ftpCmdMdtm(int sessionId, const char* args, int len)
|
|||
return 2;
|
||||
}
|
||||
|
||||
sprintf(str, "%04d%02d%02d%02d%02d%02d", fileInfo.mTime.year,
|
||||
snprintf(str, 15,"%04d%02d%02d%02d%02d%02d", fileInfo.mTime.year,
|
||||
fileInfo.mTime.month,
|
||||
fileInfo.mTime.day,
|
||||
fileInfo.mTime.hour,
|
||||
|
|
|
@ -160,13 +160,13 @@ int ftpStat(const char* path, ftpPathInfo_S *info)
|
|||
if(pw)
|
||||
strncpy(info->user, pw->pw_name, sizeof(info->user));
|
||||
else
|
||||
sprintf(info->user, "%04d", fileInfo.st_uid);
|
||||
snprintf(info->user, 20,"%04d", fileInfo.st_uid);
|
||||
|
||||
gr = getgrgid(fileInfo.st_gid);
|
||||
if(gr)
|
||||
strncpy(info->group, gr->gr_name, sizeof(info->group));
|
||||
else
|
||||
sprintf(info->group, "%04d", fileInfo.st_gid);
|
||||
snprintf(info->group, 20,"%04d", fileInfo.st_gid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -93,8 +93,8 @@ TextFTGL::TextFTGL(FontTextHandlerType type) : Text(type) {
|
|||
}
|
||||
|
||||
if(ftFont->Error()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"FTGL: error setting face size, #%d",ftFont->Error());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"FTGL: error setting face size, #%d",ftFont->Error());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
//ftFont->UseDisplayList(false);
|
||||
|
@ -105,8 +105,8 @@ TextFTGL::TextFTGL(FontTextHandlerType type) : Text(type) {
|
|||
}
|
||||
|
||||
if(ftFont->Error()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"FTGL: error setting encoding, #%d",ftFont->Error());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"FTGL: error setting encoding, #%d",ftFont->Error());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -172,8 +172,8 @@ void TextFTGL::init(string fontName, string fontFamilyName, int fontSize) {
|
|||
}
|
||||
|
||||
if(ftFont->Error()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"FTGL: error setting face size, #%d",ftFont->Error());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"FTGL: error setting face size, #%d",ftFont->Error());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -184,8 +184,8 @@ void TextFTGL::init(string fontName, string fontFamilyName, int fontSize) {
|
|||
throw megaglest_runtime_error("FTGL: error setting encoding");
|
||||
}
|
||||
if(ftFont->Error()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"FTGL: error setting encoding, #%d",ftFont->Error());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"FTGL: error setting encoding, #%d",ftFont->Error());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -201,8 +201,8 @@ void TextFTGL::init(string fontName, string fontFamilyName, int fontSize) {
|
|||
}
|
||||
|
||||
if(ftFont->Error()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"FTGL: error advancing(a), #%d",ftFont->Error());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"FTGL: error advancing(a), #%d",ftFont->Error());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -217,8 +217,8 @@ void TextFTGL::SetFaceSize(int value) {
|
|||
}
|
||||
|
||||
if(ftFont->Error()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"FTGL: error setting face size, #%d",ftFont->Error());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"FTGL: error setting face size, #%d",ftFont->Error());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -247,8 +247,8 @@ void TextFTGL::Render(const char* str, const int len) {
|
|||
}
|
||||
|
||||
if(ftFont->Error()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"FTGL: error trying to render, #%d",ftFont->Error());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"FTGL: error trying to render, #%d",ftFont->Error());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -264,8 +264,8 @@ float TextFTGL::Advance(const char* str, const int len) {
|
|||
}
|
||||
|
||||
if(ftFont->Error()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"FTGL: error trying to advance(b), #%d",ftFont->Error());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"FTGL: error trying to advance(b), #%d",ftFont->Error());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
return result;
|
||||
|
@ -349,8 +349,8 @@ float TextFTGL::LineHeight(const char* str, const int len) {
|
|||
// printf("Height for [%s] result [%d] [%d]\n",str,result,newresult);
|
||||
// }
|
||||
if(ftFont->Error()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"FTGL: error trying to get lineheight, #%d",ftFont->Error());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"FTGL: error trying to get lineheight, #%d",ftFont->Error());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -394,8 +394,8 @@ float TextFTGL::LineHeight(const wchar_t* str, const int len) {
|
|||
//printf("ftFont->BBox(''yW'')%f\n",result);
|
||||
}
|
||||
if(ftFont->Error()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"FTGL: error trying to get lineheight, #%d",ftFont->Error());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"FTGL: error trying to get lineheight, #%d",ftFont->Error());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -411,8 +411,8 @@ void TextFTGL::Render(const wchar_t* str, const int len) {
|
|||
ftFont->Render(str, len);
|
||||
|
||||
if(ftFont->Error()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"FTGL: error trying to render, #%d",ftFont->Error());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"FTGL: error trying to render, #%d",ftFont->Error());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -421,8 +421,8 @@ void TextFTGL::Render(const wchar_t* str, const int len) {
|
|||
float TextFTGL::Advance(const wchar_t* str, const int len) {
|
||||
float result = ftFont->Advance(str, len);
|
||||
if(ftFont->Error()) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"FTGL: error trying to advance(c), #%d",ftFont->Error());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"FTGL: error trying to advance(c), #%d",ftFont->Error());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -176,11 +176,11 @@ void TextRenderer2DGl::render(const string &text, float x, float y, bool centere
|
|||
else {
|
||||
bool lastCharacterWasSpecial = true;
|
||||
vector<string> parts;
|
||||
char szBuf[4096]="";
|
||||
char szBuf[8096]="";
|
||||
|
||||
for (int i=0; renderText[i] != '\0'; ++i) {
|
||||
szBuf[0] = '\0';
|
||||
sprintf(szBuf,"%c",renderText[i]);
|
||||
snprintf(szBuf,8096,"%c",renderText[i]);
|
||||
|
||||
switch(renderText[i]) {
|
||||
case '\t':
|
||||
|
@ -272,11 +272,11 @@ void TextRenderer2DGl::render(const string &text, float x, float y, bool centere
|
|||
else {
|
||||
bool lastCharacterWasSpecial = true;
|
||||
vector<string> parts;
|
||||
char szBuf[4096]="";
|
||||
char szBuf[8096]="";
|
||||
|
||||
for (int i=0; renderText[i] != '\0'; ++i) {
|
||||
szBuf[0] = '\0';
|
||||
sprintf(szBuf,"%c",renderText[i]);
|
||||
snprintf(szBuf,8096,"%c",renderText[i]);
|
||||
|
||||
switch(renderText[i]) {
|
||||
case '\t':
|
||||
|
@ -571,11 +571,11 @@ void TextRenderer3DGl::internalRender(const string &text, float x, float y, boo
|
|||
int line=0;
|
||||
bool lastCharacterWasSpecial = true;
|
||||
vector<string> parts;
|
||||
char szBuf[4096]="";
|
||||
char szBuf[8096]="";
|
||||
|
||||
for (int i=0; renderText[i] != '\0'; ++i) {
|
||||
szBuf[0] = '\0';
|
||||
sprintf(szBuf,"%c",renderText[i]);
|
||||
snprintf(szBuf,8096,"%c",renderText[i]);
|
||||
|
||||
switch(renderText[i]) {
|
||||
case '\t':
|
||||
|
|
|
@ -691,8 +691,8 @@ void Texture1DGl::init(Filter filter, int maxAnisotropy) {
|
|||
if(error != 0) {
|
||||
//throw megaglest_runtime_error("Error building texture 1D mipmaps");
|
||||
const char *errorString= reinterpret_cast<const char*>(gluErrorString(error));
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Error building texture 1D mipmaps, returned: %d [%s] for [%s] w = %d, glCompressionFormat = %d",error,errorString,pixmap.getPath().c_str(),pixmap.getW(),glCompressionFormat);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Error building texture 1D mipmaps, returned: %d [%s] for [%s] w = %d, glCompressionFormat = %d",error,errorString,pixmap.getPath().c_str(),pixmap.getW(),glCompressionFormat);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -724,8 +724,8 @@ void Texture1DGl::init(Filter filter, int maxAnisotropy) {
|
|||
if(error != GL_NO_ERROR) {
|
||||
//throw megaglest_runtime_error("Error creating texture 1D");
|
||||
const char *errorString= reinterpret_cast<const char*>(gluErrorString(error));
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Error creating texture 1D, returned: %d [%s] (%X) [%s] w = %d, glCompressionFormat = %d",error,errorString,error,pixmap.getPath().c_str(),pixmap.getW(),glCompressionFormat);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Error creating texture 1D, returned: %d [%s] (%X) [%s] w = %d, glCompressionFormat = %d",error,errorString,error,pixmap.getPath().c_str(),pixmap.getW(),glCompressionFormat);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -860,8 +860,8 @@ void Texture2DGl::init(Filter filter, int maxAnisotropy) {
|
|||
if(error != GL_NO_ERROR) {
|
||||
//throw megaglest_runtime_error("Error building texture 2D mipmaps");
|
||||
const char *errorString= reinterpret_cast<const char*>(gluErrorString(error));
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Error building texture 2D mipmaps [%s], returned: %d [%s] for [%s] w = %d, h = %d, glCompressionFormat = %d",this->path.c_str(),error,errorString,(pixmap.getPath() != "" ? pixmap.getPath().c_str() : this->path.c_str()),pixmap.getW(),pixmap.getH(),glCompressionFormat);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Error building texture 2D mipmaps [%s], returned: %d [%s] for [%s] w = %d, h = %d, glCompressionFormat = %d",this->path.c_str(),error,errorString,(pixmap.getPath() != "" ? pixmap.getPath().c_str() : this->path.c_str()),pixmap.getW(),pixmap.getH(),glCompressionFormat);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -929,8 +929,8 @@ void Texture2DGl::init(Filter filter, int maxAnisotropy) {
|
|||
|
||||
if(error != GL_NO_ERROR) {
|
||||
const char *errorString= reinterpret_cast<const char*>(gluErrorString(error));
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Error creating texture 2D [%s], returned: %d [%s] (%X) [%s] w = %d, h = %d, glInternalFormat = %d, glFormat = %d, glCompressionFormat = %d",this->path.c_str(),error,errorString,error,pixmap.getPath().c_str(),pixmap.getW(),pixmap.getH(),glInternalFormat,glFormat,glCompressionFormat);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Error creating texture 2D [%s], returned: %d [%s] (%X) [%s] w = %d, h = %d, glInternalFormat = %d, glFormat = %d, glCompressionFormat = %d",this->path.c_str(),error,errorString,error,pixmap.getPath().c_str(),pixmap.getW(),pixmap.getH(),glInternalFormat,glFormat,glCompressionFormat);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -1039,8 +1039,8 @@ void Texture3DGl::init(Filter filter, int maxAnisotropy) {
|
|||
if(error != GL_NO_ERROR) {
|
||||
//throw megaglest_runtime_error("Error creating texture 3D");
|
||||
const char *errorString= reinterpret_cast<const char*>(gluErrorString(error));
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Error creating texture 3D, returned: %d [%s] (%X) [%s] w = %d, h = %d, d = %d, glCompressionFormat = %d",error,errorString,error,pixmap.getPath().c_str(),pixmap.getW(),pixmap.getH(),pixmap.getD(),glCompressionFormat);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Error creating texture 3D, returned: %d [%s] (%X) [%s] w = %d, h = %d, d = %d, glCompressionFormat = %d",error,errorString,error,pixmap.getPath().c_str(),pixmap.getW(),pixmap.getH(),pixmap.getD(),glCompressionFormat);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
inited= true;
|
||||
|
@ -1180,8 +1180,8 @@ void TextureCubeGl::init(Filter filter, int maxAnisotropy) {
|
|||
if(error != GL_NO_ERROR) {
|
||||
//throw megaglest_runtime_error("Error building texture cube mipmaps");
|
||||
const char *errorString= reinterpret_cast<const char*>(gluErrorString(error));
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Error building texture cube mipmaps, returned: %d [%s] for [%s] w = %d, h = %d, glCompressionFormat = %d",error,errorString,currentPixmap->getPath().c_str(),currentPixmap->getW(),currentPixmap->getH(),glCompressionFormat);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Error building texture cube mipmaps, returned: %d [%s] for [%s] w = %d, h = %d, glCompressionFormat = %d",error,errorString,currentPixmap->getPath().c_str(),currentPixmap->getW(),currentPixmap->getH(),glCompressionFormat);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -1233,8 +1233,8 @@ void TextureCubeGl::init(Filter filter, int maxAnisotropy) {
|
|||
if(error != GL_NO_ERROR) {
|
||||
//throw megaglest_runtime_error("Error creating texture cube");
|
||||
const char *errorString= reinterpret_cast<const char*>(gluErrorString(error));
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Error creating texture cube, returned: %d [%s] (%X) [%s] w = %d, h = %d, glCompressionFormat = %d",error,errorString,error,currentPixmap->getPath().c_str(),currentPixmap->getW(),currentPixmap->getH(),glCompressionFormat);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Error creating texture cube, returned: %d [%s] (%X) [%s] w = %d, h = %d, glCompressionFormat = %d",error,errorString,error,currentPixmap->getPath().c_str(),currentPixmap->getW(),currentPixmap->getH(),glCompressionFormat);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1194,9 +1194,7 @@ void BaseColorPickEntity::init(int bufferSize) {
|
|||
}
|
||||
|
||||
string BaseColorPickEntity::getColorDescription() const {
|
||||
//string result = "";
|
||||
char szBuf[100]="";
|
||||
//sprintf(szBuf,"%d.%d.%d.%d",uniqueColorID[0],uniqueColorID[1],uniqueColorID[2],uniqueColorID[3]);
|
||||
snprintf(szBuf,100,"%d.%d.%d",uniqueColorID[0],uniqueColorID[1],uniqueColorID[2]);
|
||||
string result = szBuf;
|
||||
return result;
|
||||
|
|
|
@ -481,8 +481,8 @@ void ParticleSystem::fade(){
|
|||
|
||||
if(particleObserver != NULL){
|
||||
if(state != sPlay) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"state != sPlay, state = [%d]",state);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"state != sPlay, state = [%d]",state);
|
||||
//throw megaglest_runtime_error(szBuf);
|
||||
//printf(szBuf);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"%s",szBuf);
|
||||
|
|
|
@ -915,8 +915,8 @@ void Pixmap2D::init(int w, int h, int components) {
|
|||
deletePixels();
|
||||
|
||||
if(getPixelByteCount() <= 0 || (h <= 0 || w <= 0 || components <= 0)) {
|
||||
char szBuf[1024];
|
||||
sprintf(szBuf,"Invalid pixmap dimensions for [%s], h = %d, w = %d, components = %d\n",path.c_str(),h,w,components);
|
||||
char szBuf[8096];
|
||||
snprintf(szBuf,8096,"Invalid pixmap dimensions for [%s], h = %d, w = %d, components = %d\n",path.c_str(),h,w,components);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
pixels= new uint8[(std::size_t)getPixelByteCount()];
|
||||
|
|
|
@ -325,7 +325,7 @@ void LuaScript::saveGame(XmlNode *rootNode) {
|
|||
value_string += "|||";
|
||||
}
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"[%s] [%s]",key.c_str(),value.c_str());
|
||||
snprintf(szBuf,8096,"[%s] [%s]",key.c_str(),value.c_str());
|
||||
//value_string += szBuf;
|
||||
//vector<pair<pair<int,string>, pair<int,string>> > tableList;
|
||||
tableList.push_back(make_pair(make_pair(tableKeyType,key),make_pair(tableValueType,value)));
|
||||
|
|
|
@ -526,27 +526,27 @@ bool MapPreview::inside(int x, int y) {
|
|||
|
||||
void MapPreview::reset(int w, int h, float alt, MapSurfaceType surf) {
|
||||
if (w < MIN_MAP_CELL_DIMENSION || h < MIN_MAP_CELL_DIMENSION) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Size of map must be at least %dx%d",MIN_MAP_CELL_DIMENSION,MIN_MAP_CELL_DIMENSION);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Size of map must be at least %dx%d",MIN_MAP_CELL_DIMENSION,MIN_MAP_CELL_DIMENSION);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
//return;
|
||||
}
|
||||
|
||||
if (w > MAX_MAP_CELL_DIMENSION || h > MAX_MAP_CELL_DIMENSION) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Size of map can be at most %dx%d",MAX_MAP_CELL_DIMENSION,MAX_MAP_CELL_DIMENSION);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Size of map can be at most %dx%d",MAX_MAP_CELL_DIMENSION,MAX_MAP_CELL_DIMENSION);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
if (alt < MIN_MAP_CELL_HEIGHT || alt > MAX_MAP_CELL_HEIGHT) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Height must be in the range %d-%d",MIN_MAP_CELL_HEIGHT,MAX_MAP_CELL_HEIGHT);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Height must be in the range %d-%d",MIN_MAP_CELL_HEIGHT,MAX_MAP_CELL_HEIGHT);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
if (surf < st_Grass || surf > st_Ground) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Surface must be in the range %d-%d",st_Grass,st_Ground);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Surface must be in the range %d-%d",st_Grass,st_Ground);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -579,27 +579,27 @@ void MapPreview::reset(int w, int h, float alt, MapSurfaceType surf) {
|
|||
|
||||
void MapPreview::resize(int w, int h, float alt, MapSurfaceType surf) {
|
||||
if (w < MIN_MAP_CELL_DIMENSION || h < MIN_MAP_CELL_DIMENSION) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Size of map must be at least %dx%d",MIN_MAP_CELL_DIMENSION,MIN_MAP_CELL_DIMENSION);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Size of map must be at least %dx%d",MIN_MAP_CELL_DIMENSION,MIN_MAP_CELL_DIMENSION);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
//return;
|
||||
}
|
||||
|
||||
if (w > MAX_MAP_CELL_DIMENSION || h > MAX_MAP_CELL_DIMENSION) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Size of map can be at most %dx%d",MAX_MAP_CELL_DIMENSION,MAX_MAP_CELL_DIMENSION);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Size of map can be at most %dx%d",MAX_MAP_CELL_DIMENSION,MAX_MAP_CELL_DIMENSION);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
if (alt < MIN_MAP_CELL_HEIGHT || alt > MAX_MAP_CELL_HEIGHT) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Height must be in the range %d-%d",MIN_MAP_CELL_HEIGHT,MAX_MAP_CELL_HEIGHT);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Height must be in the range %d-%d",MIN_MAP_CELL_HEIGHT,MAX_MAP_CELL_HEIGHT);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
if (surf < st_Grass || surf > st_Ground) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Surface must be in the range %d-%d",st_Grass,st_Ground);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Surface must be in the range %d-%d",st_Grass,st_Ground);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -656,8 +656,8 @@ void MapPreview::resize(int w, int h, float alt, MapSurfaceType surf) {
|
|||
|
||||
void MapPreview::resetFactions(int maxPlayers) {
|
||||
if (maxPlayers < MIN_MAP_FACTIONCOUNT || maxPlayers > MAX_MAP_FACTIONCOUNT) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"Max Players must be in the range %d-%d",MIN_MAP_FACTIONCOUNT,MAX_MAP_FACTIONCOUNT);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"Max Players must be in the range %d-%d",MIN_MAP_FACTIONCOUNT,MAX_MAP_FACTIONCOUNT);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -987,8 +987,8 @@ bool MapPreview::loadMapInfo(string file, MapInfo *mapInfo, string i18nMaxMapPla
|
|||
validMap = false;
|
||||
|
||||
if(errorOnInvalidMap == true) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d]\nfile [%s]\nreadBytes != sizeof(MapFileHeader) [%lu] [%lu]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,file.c_str(),readBytes,sizeof(MapFileHeader));
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nfile [%s]\nreadBytes != sizeof(MapFileHeader) [%lu] [%lu]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,file.c_str(),readBytes,sizeof(MapFileHeader));
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"%s",szBuf);
|
||||
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
|
|
@ -51,8 +51,8 @@ BaseThread::~BaseThread() {
|
|||
|
||||
MutexSafeWrapper safeMutexMasterList(&mutexMasterThreadList);
|
||||
if(masterThreadList.find(this) == masterThreadList.end()) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"invalid thread delete for ptr: %p",this);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"invalid thread delete for ptr: %p",this);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
masterThreadList[this]--;
|
||||
|
|
|
@ -656,8 +656,8 @@ void LogFileThread::saveToDisk(bool forceSaveAll,bool logListAlreadyLocked) {
|
|||
safeMutex.Lock();
|
||||
if(logList.size() > 0) {
|
||||
if(logList.size() < logCount) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"logList.size() <= logCount [%lld][%lld]",(long long int)logList.size(),(long long int)logCount);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"logList.size() <= logCount [%lld][%lld]",(long long int)logList.size(),(long long int)logCount);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
logList.erase(logList.begin(),logList.begin() + logCount);
|
||||
|
|
|
@ -304,13 +304,13 @@ pair<FTP_Client_ResultType,string> FTPClientThread::getMapFromServer(pair<string
|
|||
if(curl) {
|
||||
ftpfile.stream = NULL;
|
||||
|
||||
char szBuf[1024]="";
|
||||
char szBuf[8096]="";
|
||||
if(mapFileName.second != "") {
|
||||
sprintf(szBuf,"%s",mapFileName.second.c_str());
|
||||
snprintf(szBuf,8096,"%s",mapFileName.second.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
|
||||
}
|
||||
else {
|
||||
sprintf(szBuf,"ftp://%s:%s@%s:%d/%s%s",ftpUser.c_str(),ftpUserPassword.c_str(),serverUrl.c_str(),portNumber,mapFileName.first.c_str(),destFileExt.c_str());
|
||||
snprintf(szBuf,8096,"ftp://%s:%s@%s:%d/%s%s",ftpUser.c_str(),ftpUserPassword.c_str(),serverUrl.c_str(),portNumber,mapFileName.first.c_str(),destFileExt.c_str());
|
||||
}
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL,szBuf);
|
||||
|
@ -511,8 +511,6 @@ pair<FTP_Client_ResultType,string> FTPClientThread::getTilesetFromServer(
|
|||
else {
|
||||
remotePath = tileSetName.first + this->fileArchiveExtension;
|
||||
}
|
||||
//sprintf(szBuf,"ftp://%s:%s@%s:%d/%s%s",ftpUser.c_str(),ftpUserPassword.c_str(),serverUrl.c_str(),portNumber,
|
||||
// tileSetName.c_str(),this->fileArchiveExtension.c_str());
|
||||
}
|
||||
else {
|
||||
getFolderContents = true;
|
||||
|
@ -523,8 +521,6 @@ pair<FTP_Client_ResultType,string> FTPClientThread::getTilesetFromServer(
|
|||
destFileSaveAsNewFile = destFileSaveAs;
|
||||
endPathWithSlash(destFileSaveAsNewFile);
|
||||
destFileSaveAs += ".tmp";
|
||||
|
||||
//sprintf(szBuf,"ftp://%s:%s@%s:%d/%s/*",ftpUser.c_str(),ftpUserPassword.c_str(),serverUrl.c_str(),portNumber,tileSetName.c_str());
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -539,9 +535,6 @@ pair<FTP_Client_ResultType,string> FTPClientThread::getTilesetFromServer(
|
|||
destFileSaveAsNewFile = destFileSaveAs;
|
||||
endPathWithSlash(destFileSaveAsNewFile);
|
||||
destFileSaveAs += ".tmp";
|
||||
|
||||
//sprintf(szBuf,"ftp://%s:%s@%s:%d/%s/%s/*",ftpUser.c_str(),ftpUserPassword.c_str(),serverUrl.c_str(),portNumber,
|
||||
// tileSetName.c_str(),tileSetNameSubfolder.c_str());
|
||||
}
|
||||
|
||||
vector <string> *pWantDirListOnly = NULL;
|
||||
|
@ -882,13 +875,13 @@ pair<FTP_Client_ResultType,string> FTPClientThread::getFileFromServer(FTP_Clien
|
|||
if(curl) {
|
||||
ftpfile.stream = NULL;
|
||||
|
||||
char szBuf[1024]="";
|
||||
char szBuf[8096]="";
|
||||
if(fileNameTitle.second != "") {
|
||||
sprintf(szBuf,"%s",fileNameTitle.second.c_str());
|
||||
snprintf(szBuf,8096,"%s",fileNameTitle.second.c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
|
||||
}
|
||||
else {
|
||||
sprintf(szBuf,"ftp://%s:%s@%s:%d/%s",ftpUser.c_str(),ftpUserPassword.c_str(),serverUrl.c_str(),portNumber,remotePath.c_str());
|
||||
snprintf(szBuf,8096,"ftp://%s:%s@%s:%d/%s",ftpUser.c_str(),ftpUserPassword.c_str(),serverUrl.c_str(),portNumber,remotePath.c_str());
|
||||
}
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL,szBuf);
|
||||
|
|
|
@ -477,7 +477,7 @@ static void PrintNetworkInterfaceInfos()
|
|||
char buf[128];
|
||||
if (name == NULL)
|
||||
{
|
||||
sprintf(buf, "unnamed-%i", i);
|
||||
snprintf(buf, 128,"unnamed-%i", i);
|
||||
name = buf;
|
||||
}
|
||||
|
||||
|
@ -617,10 +617,8 @@ string getNetworkInterfaceBroadcastAddress(string ipAddress)
|
|||
next = next->Next;
|
||||
}
|
||||
}
|
||||
//char buf[128]="";
|
||||
if (name == NULL)
|
||||
{
|
||||
//sprintf(buf, "unnamed-%i", i);
|
||||
name = "";
|
||||
}
|
||||
|
||||
|
@ -678,11 +676,6 @@ std::vector<std::string> Socket::getLocalIPAddressList() {
|
|||
//int ipIdx = 0;
|
||||
//while (myhostent->h_addr_list[ipIdx] != 0) {
|
||||
for(int ipIdx = 0; myhostent->h_addr_list[ipIdx] != NULL; ++ipIdx) {
|
||||
//sprintf(myhostaddr, "%s",inet_ntoa(*(struct in_addr *)myhostent->h_addr_list[ipIdx]));
|
||||
//struct sockaddr_in SockAddr;
|
||||
//memcpy(&(SockAddr.sin_addr),&myhostent->h_addr[ipIdx],myhostent->h_length);
|
||||
//SockAddr.sin_family = myhostent->h_addrtype;
|
||||
//Inet_NtoA(SockAddrToUint32((sockaddr *)&SockAddr), myhostaddr);
|
||||
Ip::Inet_NtoA(SockAddrToUint32((struct in_addr *)myhostent->h_addr_list[ipIdx]), myhostaddr);
|
||||
|
||||
//printf("ipIdx = %d [%s]\n",ipIdx,myhostaddr);
|
||||
|
@ -723,7 +716,7 @@ std::vector<std::string> Socket::getLocalIPAddressList() {
|
|||
|
||||
/* I want IP address attached to "eth0" */
|
||||
char szBuf[100]="";
|
||||
sprintf(szBuf,"%s%d",intfName.c_str(),idx);
|
||||
snprintf(szBuf,100,"%s%d",intfName.c_str(),idx);
|
||||
int maxIfNameLength = std::min((int)strlen(szBuf),IFNAMSIZ-1);
|
||||
|
||||
strncpy(ifr.ifr_name, szBuf, maxIfNameLength);
|
||||
|
@ -738,7 +731,7 @@ std::vector<std::string> Socket::getLocalIPAddressList() {
|
|||
if(result_ifaddrr >= 0) {
|
||||
struct sockaddr_in *pSockAddr = (struct sockaddr_in *)&ifr.ifr_addr;
|
||||
if(pSockAddr != NULL) {
|
||||
//sprintf(myhostaddr, "%s",inet_ntoa(pSockAddr->sin_addr));
|
||||
|
||||
Ip::Inet_NtoA(SockAddrToUint32(&pSockAddr->sin_addr), myhostaddr);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] szBuf [%s], myhostaddr = [%s], ifr.ifr_flags = %d, ifrA.ifr_flags = %d, ifr.ifr_name [%s]\n",__FILE__,__FUNCTION__,__LINE__,szBuf,myhostaddr,ifr.ifr_flags,ifrA.ifr_flags,ifr.ifr_name);
|
||||
|
||||
|
@ -2219,11 +2212,11 @@ void ServerSocket::bind(int port) {
|
|||
|
||||
int err= ::bind(sock, reinterpret_cast<sockaddr*>(&addr), sizeof(addr));
|
||||
if(err < 0) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf, "In [%s::%s] Error binding socket sock = %d, err = %d, error = %s\n",__FILE__,__FUNCTION__,sock,err,getLastSocketErrorFormattedText().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf, 8096,"In [%s::%s] Error binding socket sock = %d, err = %d, error = %s\n",__FILE__,__FUNCTION__,sock,err,getLastSocketErrorFormattedText().c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"%s",szBuf);
|
||||
|
||||
sprintf(szBuf, "Error binding socket sock = %d, err = %d, error = %s\n",sock,err,getLastSocketErrorFormattedText().c_str());
|
||||
snprintf(szBuf, 8096,"Error binding socket sock = %d, err = %d, error = %s\n",sock,err,getLastSocketErrorFormattedText().c_str());
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
portBound = true;
|
||||
|
@ -2256,8 +2249,8 @@ void ServerSocket::listen(int connectionQueueSize) {
|
|||
|
||||
int err= ::listen(sock, connectionQueueSize);
|
||||
if(err < 0) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf, "In [%s::%s] Error listening socket sock = %d, err = %d, error = %s\n",__FILE__,__FUNCTION__,sock,err,getLastSocketErrorFormattedText().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf, 8096,"In [%s::%s] Error listening socket sock = %d, err = %d, error = %s\n",__FILE__,__FUNCTION__,sock,err,getLastSocketErrorFormattedText().c_str());
|
||||
throwException(szBuf);
|
||||
}
|
||||
}
|
||||
|
@ -2303,8 +2296,8 @@ Socket *ServerSocket::accept(bool errorOnFail) {
|
|||
safeMutex.ReleaseLock();
|
||||
|
||||
if(isSocketValid(&newSock) == false) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf, "In [%s::%s Line: %d] Error accepting socket connection sock = %d, err = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,sock,newSock,getLastSocketErrorFormattedText().c_str());
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf, 8096,"In [%s::%s Line: %d] Error accepting socket connection sock = %d, err = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,sock,newSock,getLastSocketErrorFormattedText().c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,szBuf);
|
||||
|
||||
int lastSocketError = getLastSocketError();
|
||||
|
@ -2326,8 +2319,6 @@ Socket *ServerSocket::accept(bool errorOnFail) {
|
|||
}
|
||||
else {
|
||||
Ip::Inet_NtoA(SockAddrToUint32((struct sockaddr *)&cli_addr), client_host);
|
||||
//printf("client_host [%s]\n",client_host);
|
||||
//sprintf(client_host, "%s",inet_ntoa(cli_addr.sin_addr));
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got connection, newSock = %d client_host [%s]\n",__FILE__,__FUNCTION__,__LINE__,newSock,client_host);
|
||||
}
|
||||
if(isIPAddressBlocked((client_host[0] != '\0' ? client_host : "")) == true) {
|
||||
|
@ -2495,14 +2486,14 @@ int UPNP_Tools::upnp_init(void *param) {
|
|||
free (descXML); descXML = 0;
|
||||
GetUPNPUrls (&urls, &data, dev->descURL);
|
||||
}
|
||||
sprintf(buf, "UPnP device found: %s %s LAN address %s", dev->descURL, dev->st, lanaddr);
|
||||
snprintf(buf, 255,"UPnP device found: %s %s LAN address %s", dev->descURL, dev->st, lanaddr);
|
||||
|
||||
freeUPNPDevlist(devlist);
|
||||
devlist = NULL;
|
||||
}
|
||||
|
||||
if (!urls.controlURL || urls.controlURL[0] == '\0') {
|
||||
sprintf(buf, "controlURL not available, UPnP disabled");
|
||||
snprintf(buf, 255,"controlURL not available, UPnP disabled");
|
||||
if(callback) {
|
||||
safeMutexUPNP.ReleaseLock();
|
||||
callback->UPNPInitStatus(false);
|
||||
|
@ -2531,7 +2522,7 @@ int UPNP_Tools::upnp_init(void *param) {
|
|||
}
|
||||
|
||||
if(result == -1) {
|
||||
sprintf(buf, "UPnP device not found.");
|
||||
snprintf(buf, 255,"UPnP device not found.");
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"No UPnP devices found.\n");
|
||||
|
||||
|
@ -2543,7 +2534,7 @@ int UPNP_Tools::upnp_init(void *param) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
sprintf(buf, "UPnP detection routine disabled by user.");
|
||||
snprintf(buf, 255,"UPnP detection routine disabled by user.");
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"UPnP detection routine disabled by user.\n");
|
||||
|
||||
if(callback) {
|
||||
|
@ -2798,9 +2789,8 @@ void BroadCastSocketThread::execute() {
|
|||
if( Socket::isSocketValid(&bcfd[idx]) == true ) {
|
||||
try {
|
||||
// Send this machine's host name and address in hostname:n.n.n.n format
|
||||
sprintf(buff,"%s",myhostname);
|
||||
snprintf(buff,1024,"%s",myhostname);
|
||||
for(unsigned int idx1 = 0; idx1 < ipList.size(); idx1++) {
|
||||
//sprintf(buff,"%s:%s",buff,ipList[idx1].c_str());
|
||||
strcat(buff,":");
|
||||
strcat(buff,ipList[idx1].c_str());
|
||||
strcat(buff,":");
|
||||
|
|
|
@ -36,9 +36,8 @@ bool PlatformExceptionHandler::disableBacktrace = false;
|
|||
|
||||
// This was the simplest, most portable solution i could find in 5 mins for linux
|
||||
int MessageBox(int handle, const char *msg, const char *title, int buttons) {
|
||||
char cmd[1024]="";
|
||||
//sprintf(cmd, "xmessage -center \"%s\"", msg);
|
||||
sprintf(cmd, "gdialog --title \"%s\" --msgbox \"%s\"", title, msg);
|
||||
char cmd[8096]="";
|
||||
snprintf(cmd, 8096,"gdialog --title \"%s\" --msgbox \"%s\"", title, msg);
|
||||
|
||||
//if(fork()==0){
|
||||
//close(1); close(2);
|
||||
|
@ -72,14 +71,13 @@ void exceptionMessage(const exception &excp) {
|
|||
static int getFileAndLine(char *function, void *address, char *file, size_t flen) {
|
||||
int line=-1;
|
||||
if(PlatformExceptionHandler::application_binary != "") {
|
||||
const int maxbufSize = 8094;
|
||||
const int maxbufSize = 8096;
|
||||
char buf[maxbufSize+1]="";
|
||||
//char *p=NULL;
|
||||
|
||||
// prepare command to be executed
|
||||
// our program need to be passed after the -e parameter
|
||||
//sprintf (buf, "/usr/bin/addr2line -C -e ./a.out -f -i %lx", addr);
|
||||
sprintf(buf, "addr2line -C -e %s -f -i %p",PlatformExceptionHandler::application_binary.c_str(),address);
|
||||
snprintf(buf, 8096,"addr2line -C -e %s -f -i %p",PlatformExceptionHandler::application_binary.c_str(),address);
|
||||
|
||||
FILE* f = popen (buf, "r");
|
||||
if (f == NULL) {
|
||||
|
@ -224,17 +222,15 @@ string PlatformExceptionHandler::getStackTrace() {
|
|||
}
|
||||
//fprintf(out, " %s:%s\n", stack.strings[i], function);
|
||||
|
||||
//sprintf(szBuf,"%s:%s address [%p]",stack_strings[i],function,lineAddress);
|
||||
strBuf = string(stack_strings[i]) + ":" + string(function);
|
||||
sprintf(szBuf,"address [%p]",lineAddress);
|
||||
snprintf(szBuf,8096,"address [%p]",lineAddress);
|
||||
strBuf += szBuf;
|
||||
}
|
||||
else {
|
||||
// didn't find the mangled name, just print the whole line
|
||||
//fprintf(out, " %s\n", stack.strings[i]);
|
||||
//sprintf(szBuf,"%s address [%p]",stack_strings[i],lineAddress);
|
||||
strBuf = stack_strings[i];
|
||||
sprintf(szBuf,"address [%p]",lineAddress);
|
||||
snprintf(szBuf,8096,"address [%p]",lineAddress);
|
||||
strBuf += szBuf;
|
||||
}
|
||||
|
||||
|
|
|
@ -158,47 +158,6 @@ string PlatformExceptionHandler::getStackTrace() {
|
|||
return result;
|
||||
}
|
||||
#ifndef __MINGW32__
|
||||
/*
|
||||
unsigned int i;
|
||||
const int max_stack_count = 25;
|
||||
void * stack[ max_stack_count ];
|
||||
unsigned short frames;
|
||||
SYMBOL_INFO * symbol;
|
||||
HANDLE process;
|
||||
|
||||
process = GetCurrentProcess();
|
||||
|
||||
SymInitialize( process, NULL, TRUE );
|
||||
|
||||
frames = CaptureStackBackTrace( 0, max_stack_count, stack, NULL );
|
||||
symbol = ( SYMBOL_INFO * )calloc( sizeof( SYMBOL_INFO ) + 256 * sizeof( char ), 1 );
|
||||
symbol->MaxNameLen = 255;
|
||||
symbol->SizeOfStruct = sizeof( SYMBOL_INFO );
|
||||
|
||||
IMAGEHLP_LINE li = { sizeof( IMAGEHLP_LINE ) };
|
||||
|
||||
char szBuf[8096]="";
|
||||
for( i = 0; i < frames; i++ ) {
|
||||
DWORD off=0;
|
||||
DWORD dwDisp=0;
|
||||
|
||||
SymFromAddr( process, ( DWORD64 )( stack[ i ] ), 0, symbol );
|
||||
SymGetLineFromAddr(process, ( DWORD64 )( stack[ i ] ), &dwDisp, &li);
|
||||
|
||||
//if( SymGetSymFromAddr(GetCurrentProcess(), (DWORD)sf.AddrPC.Offset, &off, &si.sym) &&
|
||||
// SymGetLineFromAddr(GetCurrentProcess(), (DWORD)sf.AddrPC.Offset, &dwDisp, &li)) {
|
||||
char *del = strrchr(li.FileName, '\\');
|
||||
//formatstring(t)("%s - %s [%d]\n", symbol.sym.Name, del ? del + 1 : li.FileName, li.LineNumber+dwDisp);
|
||||
//concatstring(out, t);
|
||||
|
||||
|
||||
//sprintf(szBuf,"%i: %s - 0x%0X\n", frames - i - 1, symbol->Name, symbol->Address );
|
||||
sprintf(szBuf,"%s - %s [%d]\n", symbol->Name, del ? del + 1 : li.FileName, li.LineNumber+dwDisp);
|
||||
result += szBuf;
|
||||
}
|
||||
|
||||
free( symbol );
|
||||
*/
|
||||
|
||||
CONTEXT context = { 0 };
|
||||
context.ContextFlags = CONTEXT_FULL;
|
||||
|
@ -245,7 +204,7 @@ string PlatformExceptionHandler::getStackTrace() {
|
|||
// RetAddr Arg1 Arg2 Arg3 module!funtion FileName(line)+offset
|
||||
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"%08lx %08lx %08lx %08lx %s!%s %s(%lu) %+ld\n",
|
||||
snprintf(szBuf,8096,"%08lx %08lx %08lx %08lx %s!%s %s(%lu) %+ld\n",
|
||||
stackframe.AddrReturn.Offset,
|
||||
stackframe.Params[0],
|
||||
stackframe.Params[1],
|
||||
|
|
|
@ -622,8 +622,8 @@ StreamSoundSource* SoundPlayerOpenAL::findStreamSoundSource() {
|
|||
void SoundPlayerOpenAL::checkAlcError(string message) {
|
||||
int err = alcGetError(device);
|
||||
if(err != ALC_NO_ERROR) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"%s [%s]",message.c_str(),alcGetString(device, err));
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"%s [%s]",message.c_str(),alcGetString(device, err));
|
||||
|
||||
//std::stringstream msg;
|
||||
//msg << message.c_str() << alcGetString(device, err);
|
||||
|
@ -635,8 +635,8 @@ void SoundPlayerOpenAL::checkAlcError(string message) {
|
|||
void SoundPlayerOpenAL::checkAlError(string message) {
|
||||
int err = alGetError();
|
||||
if(err != AL_NO_ERROR) {
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"%s [%s]",message.c_str(),alGetString(err));
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"%s [%s]",message.c_str(),alGetString(err));
|
||||
//std::stringstream msg;
|
||||
//msg << message.c_str() << alGetString(err);
|
||||
printf("openal error [%s]\n",szBuf);
|
||||
|
|
|
@ -62,8 +62,8 @@ int RandomGen::rand() {
|
|||
int RandomGen::randRange(int min, int max){
|
||||
assert(min<=max);
|
||||
if(min > max) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] min > max, min = %d, max = %d",__FILE__,__FUNCTION__,__LINE__,min,max);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] min > max, min = %d, max = %d",__FILE__,__FUNCTION__,__LINE__,min,max);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -75,8 +75,8 @@ int RandomGen::randRange(int min, int max){
|
|||
//#endif
|
||||
assert(res>=min && res<=max);
|
||||
if(res < min || res > max) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] res < min || res > max, min = %d, max = %d, res = %d",__FILE__,__FUNCTION__,__LINE__,min,max,res);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] res < min || res > max, min = %d, max = %d, res = %d",__FILE__,__FUNCTION__,__LINE__,min,max,res);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -88,8 +88,8 @@ int RandomGen::randRange(int min, int max){
|
|||
float RandomGen::randRange(float min, float max){
|
||||
assert(min<=max);
|
||||
if(min > max) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] min > max, min = %f, max = %f",__FILE__,__FUNCTION__,__LINE__,min,max);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] min > max, min = %f, max = %f",__FILE__,__FUNCTION__,__LINE__,min,max);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
@ -102,8 +102,8 @@ float RandomGen::randRange(float min, float max){
|
|||
|
||||
assert(res>=min && res<=max);
|
||||
if(res < min || res > max) {
|
||||
char szBuf[1024]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] res < min || res > max, min = %f, max = %f, res = %f",__FILE__,__FUNCTION__,__LINE__,min,max,res);
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] res < min || res > max, min = %f, max = %f, res = %f",__FILE__,__FUNCTION__,__LINE__,min,max,res);
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ XmlNode *XmlIo::load(const string &path, std::map<string,string> mapTagReplaceme
|
|||
}
|
||||
catch(const DOMException &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Exception while loading: [%s], msg:\n%s",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),XMLString::transcode(ex.msg));
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Exception while loading: [%s], msg:\n%s",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),XMLString::transcode(ex.msg));
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"%s\n",szBuf);
|
||||
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
@ -310,7 +310,7 @@ XmlNode *XmlIoRapid::load(const string &path, std::map<string,string> mapTagRepl
|
|||
}
|
||||
catch(const exception &ex) {
|
||||
char szBuf[8096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Exception while loading: [%s], msg:\n%s",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),ex.what());
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d] Exception while loading: [%s], msg:\n%s",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),ex.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"%s\n",szBuf);
|
||||
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
|
|
Loading…
Reference in New Issue