- commented out some debug statements and corrected stuck harvesting a bit
This commit is contained in:
parent
23135b5bab
commit
177531c376
|
@ -466,7 +466,7 @@ void Ai::massiveAttack(const Vec2i &pos, Field field, bool ultraAttack){
|
|||
|
||||
bool alreadyAttacking= (unit->getCurrSkill()->getClass() == scAttack);
|
||||
if(!alreadyAttacking && act!=NULL && (ultraAttack || isWarrior)) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
aiInterface->giveCommand(i, act, pos);
|
||||
}
|
||||
|
|
|
@ -113,11 +113,11 @@ CommandResult AiInterface::giveCommand(int unitIndex, CommandClass commandClass,
|
|||
|
||||
if(executeCommandOverNetwork() == true) {
|
||||
const Unit *unit = getMyUnit(unitIndex);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unitIndex = %d\nunit = [%s]\ncommandClass = [%d]\n",__FILE__,__FUNCTION__,__LINE__,unitIndex,unit->toString().c_str(),commandClass);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unitIndex = %d\nunit = [%s]\ncommandClass = [%d]\n",__FILE__,__FUNCTION__,__LINE__,unitIndex,unit->toString().c_str(),commandClass);
|
||||
|
||||
CommandResult result = commander->tryGiveCommand(unit, unit->getType()->getFirstCtOfClass(commandClass), pos, unit->getType(),CardinalDir::NORTH);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -162,11 +162,11 @@ CommandResult AiInterface::giveCommand(Unit *unit, const CommandType *commandTyp
|
|||
}
|
||||
|
||||
if(executeCommandOverNetwork() == true) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unit id = %d\nunit = [%s]\ncommandType = %d - [%s]\nCommand Type List:\n%s\n",__FILE__,__FUNCTION__,__LINE__,unit->getId(),unit->toString().c_str(),commandType->getId(),commandType->toString().c_str(),unit->getType()->getCommandTypeListDesc().c_str());
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unit id = %d\nunit = [%s]\ncommandType = %d - [%s]\nCommand Type List:\n%s\n",__FILE__,__FUNCTION__,__LINE__,unit->getId(),unit->toString().c_str(),commandType->getId(),commandType->toString().c_str(),unit->getType()->getCommandTypeListDesc().c_str());
|
||||
|
||||
CommandResult result = commander->tryGiveCommand(unit, commandType, pos, unit->getType(),CardinalDir::NORTH);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
|
@ -211,11 +211,11 @@ CommandResult AiInterface::giveCommand(int unitIndex, const CommandType *command
|
|||
|
||||
if(executeCommandOverNetwork() == true) {
|
||||
const Unit *unit = getMyUnit(unitIndex);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unitIndex = %d\nunit = [%s]\ncommandType = %d - [%s]\nCommand Type List:\n%s\n",__FILE__,__FUNCTION__,__LINE__,unitIndex,unit->toString().c_str(),commandType->getId(),commandType->toString().c_str(),unit->getType()->getCommandTypeListDesc().c_str());
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unitIndex = %d\nunit = [%s]\ncommandType = %d - [%s]\nCommand Type List:\n%s\n",__FILE__,__FUNCTION__,__LINE__,unitIndex,unit->toString().c_str(),commandType->getId(),commandType->toString().c_str(),unit->getType()->getCommandTypeListDesc().c_str());
|
||||
|
||||
CommandResult result = commander->tryGiveCommand(unit, commandType, pos, unit->getType(),CardinalDir::NORTH);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
|
@ -260,11 +260,11 @@ CommandResult AiInterface::giveCommand(int unitIndex, const CommandType *command
|
|||
|
||||
if(executeCommandOverNetwork() == true) {
|
||||
const Unit *unit = getMyUnit(unitIndex);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unitIndex = %d\nunit = [%s]\ncommandType = %d - [%s]\nut = %p\n",__FILE__,__FUNCTION__,__LINE__,unitIndex,unit->toString().c_str(),commandType->getId(),commandType->toString().c_str(),ut);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unitIndex = %d\nunit = [%s]\ncommandType = %d - [%s]\nut = %p\n",__FILE__,__FUNCTION__,__LINE__,unitIndex,unit->toString().c_str(),commandType->getId(),commandType->toString().c_str(),ut);
|
||||
|
||||
CommandResult result = commander->tryGiveCommand(unit, commandType, pos, ut,CardinalDir::NORTH);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -313,11 +313,11 @@ CommandResult AiInterface::giveCommand(int unitIndex, const CommandType *command
|
|||
if(executeCommandOverNetwork() == true) {
|
||||
Unit *targetUnit = u;
|
||||
const Unit *unit = getMyUnit(unitIndex);
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unitIndex = %d\nunit = [%s]\ncommandType = %d - [%s]\nTarget Unit Id= %d\nUnit Commands:\n%s\n",__FILE__,__FUNCTION__,__LINE__,unitIndex,unit->toString().c_str(),(commandType != NULL ? commandType->getId() : -1),(commandType != NULL ? commandType->toString().c_str() : "null"),(targetUnit != NULL ? targetUnit->getId() : -1),unit->getType()->getCommandTypeListDesc().c_str());
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unitIndex = %d\nunit = [%s]\ncommandType = %d - [%s]\nTarget Unit Id= %d\nUnit Commands:\n%s\n",__FILE__,__FUNCTION__,__LINE__,unitIndex,unit->toString().c_str(),(commandType != NULL ? commandType->getId() : -1),(commandType != NULL ? commandType->toString().c_str() : "null"),(targetUnit != NULL ? targetUnit->getId() : -1),unit->getType()->getCommandTypeListDesc().c_str());
|
||||
|
||||
CommandResult result = commander->tryGiveCommand(unit, commandType, Vec2i(0), unit->getType(),CardinalDir::NORTH,false,targetUnit);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -201,6 +201,7 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
|
|||
//printf("#1 BAILOUT test unitid [%d]\n",unit->getId());
|
||||
|
||||
bool useBailoutRadius = true;
|
||||
/*
|
||||
Command *command= unit->getCurrCommand();
|
||||
if(command != NULL) {
|
||||
const HarvestCommandType *hct= dynamic_cast<const HarvestCommandType*>(command->getCommandType());
|
||||
|
@ -231,6 +232,7 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if(useBailoutRadius == true) {
|
||||
//int tryRadius = random.randRange(-PathFinder::pathFindBailoutRadius, PathFinder::pathFindBailoutRadius);
|
||||
|
|
|
@ -251,7 +251,7 @@ CommandResult Commander::tryGiveCommand(const Unit* unit, const CommandType *com
|
|||
assert(commandType != NULL);
|
||||
assert(unitType != NULL);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
|
@ -262,7 +262,7 @@ CommandResult Commander::tryGiveCommand(const Unit* unit, const CommandType *com
|
|||
|
||||
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
CommandResult result = pushNetworkCommand(&networkCommand);
|
||||
|
||||
|
@ -340,7 +340,7 @@ CommandResult Commander::tryGiveCommand(const Selection *selection, const Vec2i
|
|||
|
||||
if(selection->isEmpty() == false){
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
Vec2i refPos, currPos;
|
||||
CommandResultContainer results;
|
||||
|
@ -357,11 +357,11 @@ CommandResult Commander::tryGiveCommand(const Selection *selection, const Vec2i
|
|||
//get command type
|
||||
const CommandType *commandType= unit->computeCommandType(pos, targetUnit);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unit = [%s] commandType = %p\n",__FILE__,__FUNCTION__,__LINE__,unit->getFullName().c_str(), commandType);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] unit = [%s] commandType = %p\n",__FILE__,__FUNCTION__,__LINE__,unit->getFullName().c_str(), commandType);
|
||||
|
||||
//give commands
|
||||
if(commandType!=NULL) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] commandType->toString() [%s]\n",__FILE__,__FUNCTION__,__LINE__,commandType->toString().c_str());
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] commandType->toString() [%s]\n",__FILE__,__FUNCTION__,__LINE__,commandType->toString().c_str());
|
||||
|
||||
int targetId= targetUnit==NULL? Unit::invalidId: targetUnit->getId();
|
||||
int unitId= unit->getId();
|
||||
|
@ -377,7 +377,7 @@ CommandResult Commander::tryGiveCommand(const Selection *selection, const Vec2i
|
|||
results.push_back(result);
|
||||
}
|
||||
else {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
results.push_back(crFailUndefined);
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const {
|
|||
const CommandType* ct= NULL;
|
||||
const Unit* unit= world->findUnitById(networkCommand->getUnitId());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//validate unit
|
||||
if(unit == NULL) {
|
||||
|
@ -727,7 +727,7 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const {
|
|||
throw runtime_error(sError);
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
CardinalDir facing;
|
||||
// get facing/target ... the target might be dead due to lag, cope with it
|
||||
|
@ -739,7 +739,7 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const {
|
|||
target= world->findUnitById(networkCommand->getTargetId());
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//create command
|
||||
Command *command= NULL;
|
||||
|
|
|
@ -221,8 +221,9 @@ void LogFileThread::addLogEntry(SystemFlags::DebugType type, string logEntry) {
|
|||
|
||||
bool LogFileThread::checkSaveCurrentLogBufferToDisk() {
|
||||
bool ret = false;
|
||||
if(difftime(time(NULL),lastSaveToDisk) >= 10 ||
|
||||
LogFileThread::getLogEntryBufferCount() >= 2000000) {
|
||||
if(difftime(time(NULL),lastSaveToDisk) >= 5 ||
|
||||
//LogFileThread::getLogEntryBufferCount() >= 2000000) {
|
||||
LogFileThread::getLogEntryBufferCount() >= 10000) {
|
||||
lastSaveToDisk = time(NULL);
|
||||
ret = true;
|
||||
}
|
||||
|
@ -247,7 +248,7 @@ void LogFileThread::execute() {
|
|||
saveToDisk(false,false);
|
||||
}
|
||||
if(this->getQuitStatus() == false) {
|
||||
sleep(50);
|
||||
sleep(25);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue