From ca9cbc6e755ba985302670f5bb8d0bfb847b785d Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sun, 7 Nov 2010 02:37:00 +0000 Subject: [PATCH] - removed some debugging that created very large debug files and improved performance a little bit --- source/glest_game/type_instances/unit.cpp | 16 ++++++++-------- source/glest_game/types/unit_type.cpp | 2 +- source/glest_game/world/map.cpp | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 45edcd73..0f747f4f 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -233,9 +233,9 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos, const UnitType //starting skill this->currSkill = getType()->getFirstStOfClass(scStop); - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Unit ID = %d [%s], this->currSkill = %s\n",__FILE__,__FUNCTION__,__LINE__,this->getId(),this->getFullName().c_str(), (this->currSkill == NULL ? "" : this->currSkill->toString().c_str())); + //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Unit ID = %d [%s], this->currSkill = %s\n",__FILE__,__FUNCTION__,__LINE__,this->getId(),this->getFullName().c_str(), (this->currSkill == NULL ? "" : this->currSkill->toString().c_str())); - 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__); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] END\n",__FILE__,__FUNCTION__); livingUnits.insert(id); @@ -245,7 +245,7 @@ Unit::Unit(int id, UnitPathInterface *unitpath, const Vec2i &pos, const UnitType SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); } -Unit::~Unit(){ +Unit::~Unit() { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] delete unitid = %d\n",__FILE__,__FUNCTION__,__LINE__,id); badHarvestPosList.clear(); @@ -536,7 +536,7 @@ void Unit::setCurrSkill(const SkillType *currSkill) { throw runtime_error(szBuf); } - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Unit ID = %d [%s], this->currSkill = %s\n currSkill = %s\n",__FILE__,__FUNCTION__,__LINE__,this->getId(), this->getFullName().c_str(), this->currSkill->toString().c_str(),currSkill->toString().c_str()); + //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Unit ID = %d [%s], this->currSkill = %s\n currSkill = %s\n",__FILE__,__FUNCTION__,__LINE__,this->getId(), this->getFullName().c_str(), this->currSkill->toString().c_str(),currSkill->toString().c_str()); if(currSkill->getClass() != this->currSkill->getClass()) { animProgress= 0; @@ -753,8 +753,8 @@ CommandResult Unit::giveCommand(Command *command, bool tryQueue) { assert(command->getCommandType() != NULL); - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Unit id = %d name = %s, Command [%s] tryQueue = %d\n", - __FILE__,__FUNCTION__, __LINE__,this->id,(this->type != NULL ? this->type->getName().c_str() : "null"), (command != NULL ? command->toString().c_str() : "null"),tryQueue); + //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Unit id = %d name = %s, Command [%s] tryQueue = %d\n", + // __FILE__,__FUNCTION__, __LINE__,this->id,(this->type != NULL ? this->type->getName().c_str() : "null"), (command != NULL ? command->toString().c_str() : "null"),tryQueue); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); @@ -881,7 +881,7 @@ void Unit::born() { throw runtime_error(szBuf); } - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Unit ID = %d [%s], this->currSkill = %s\n",__FILE__,__FUNCTION__,__LINE__,this->getId(),this->getFullName().c_str(), (this->currSkill == NULL ? "" : this->currSkill->toString().c_str())); + //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Unit ID = %d [%s], this->currSkill = %s\n",__FILE__,__FUNCTION__,__LINE__,this->getId(),this->getFullName().c_str(), (this->currSkill == NULL ? "" : this->currSkill->toString().c_str())); faction->addStore(type); faction->applyStaticProduction(type); @@ -891,7 +891,7 @@ void Unit::born() { } void Unit::kill() { - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Unit ID = %d [%s], this->currSkill = %s\n",__FILE__,__FUNCTION__,__LINE__,this->getId(),this->getFullName().c_str(), (this->currSkill == NULL ? "" : this->currSkill->toString().c_str())); + //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Unit ID = %d [%s], this->currSkill = %s\n",__FILE__,__FUNCTION__,__LINE__,this->getId(),this->getFullName().c_str(), (this->currSkill == NULL ? "" : this->currSkill->toString().c_str())); //no longer needs static resources if(isBeingBuilt()) { diff --git a/source/glest_game/types/unit_type.cpp b/source/glest_game/types/unit_type.cpp index 39dea513..9f8fd316 100644 --- a/source/glest_game/types/unit_type.cpp +++ b/source/glest_game/types/unit_type.cpp @@ -487,7 +487,7 @@ const RepairCommandType *UnitType::getFirstRepairCommand(const UnitType *repaire bool UnitType::hasEmptyCellMap() const { bool result = (size > 0); - for(int i = 0; i < size; ++i) { + for(int i = 0; result == true && i < size; ++i) { for(int j = 0; j < size; ++j){ if(cellMap[i*size+j] == true) { result = false; diff --git a/source/glest_game/world/map.cpp b/source/glest_game/world/map.cpp index 48da1f25..001e3b82 100644 --- a/source/glest_game/world/map.cpp +++ b/source/glest_game/world/map.cpp @@ -777,7 +777,7 @@ void Map::putUnitCells(Unit *unit, const Vec2i &pos) { assert(getCell(currPos)->getUnit(unit->getCurrField()) == NULL); getCell(currPos)->setUnit(unit->getCurrField(), unit); - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] currPos = %s unit = %s\n",__FILE__,__FUNCTION__,__LINE__,currPos.getString().c_str(),unit->toString().c_str()); + //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] currPos = %s unit = %s\n",__FILE__,__FUNCTION__,__LINE__,currPos.getString().c_str(),unit->toString().c_str()); } else if(ut->hasCellMap() == true && ut->hasEmptyCellMap() == true && @@ -804,7 +804,7 @@ void Map::clearUnitCells(Unit *unit, const Vec2i &pos) { assert(getCell(currPos)->getUnit(unit->getCurrField())==unit); getCell(currPos)->setUnit(unit->getCurrField(), NULL); - SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] currPos = %s unit = %s\n",__FILE__,__FUNCTION__,__LINE__,currPos.getString().c_str(),unit->toString().c_str()); + //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] currPos = %s unit = %s\n",__FILE__,__FUNCTION__,__LINE__,currPos.getString().c_str(),unit->toString().c_str()); } else if(ut->hasCellMap() == true && ut->hasEmptyCellMap() == true &&