From badd795865af66d6394f3b843b0c3ae5be0c87aa Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 29 May 2010 09:04:22 +0000 Subject: [PATCH] More debug code to find unit mismatch --- source/glest_game/type_instances/faction.cpp | 4 +++- source/glest_game/world/unit_updater.cpp | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/glest_game/type_instances/faction.cpp b/source/glest_game/type_instances/faction.cpp index 107efac2d..b12185f62 100644 --- a/source/glest_game/type_instances/faction.cpp +++ b/source/glest_game/type_instances/faction.cpp @@ -487,7 +487,9 @@ std::string Faction::toString() const { result += "thisFaction = " + intToStr(this->thisFaction) + "\n"; result += "control = " + intToStr(this->control) + "\n"; - result += this->factionType->toString() + "\n"; + if(this->factionType != NULL) { + result += this->factionType->toString() + "\n"; + } result += this->upgradeManager.toString() + "\n"; diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index 35e8d445e..80ef4b5bc 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -587,8 +587,12 @@ void UnitUpdater::updateProduce(Unit *unit){ unit->setCurrSkill(scStop); produced= new Unit(world->getNextUnitId(), Vec2i(0), pct->getProducedUnit(), unit->getFaction(), world->getMap(), CardinalDir::NORTH); + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] about to place unit for unit [%s]\n",__FILE__,__FUNCTION__,__LINE__,produced->toString().c_str()); + //place unit creates the unit - if(!world->placeUnit(unit->getCenteredPos(), 10, produced)){ + if(!world->placeUnit(unit->getCenteredPos(), 10, produced)) { + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] COULD NOT PLACE UNIT for unitID [%d]\n",__FILE__,__FUNCTION__,__LINE__,produced->getId()); + delete produced; } else{