From 8579dbb36ec649217f46c67ea5bf22076028554c Mon Sep 17 00:00:00 2001 From: James McCulloch Date: Sat, 17 Jul 2010 05:13:34 +0000 Subject: [PATCH] * fix for resource depletion updates to AnnotatedMap and Resource GoalMaps (cell to tile co-ord problem) --- source/glest_game/ai/cartographer.cpp | 1 + source/glest_game/graphics/debug_renderer.cpp | 6 +++--- source/glest_game/world/unit_updater.cpp | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/glest_game/ai/cartographer.cpp b/source/glest_game/ai/cartographer.cpp index b563ff32..fe197833 100644 --- a/source/glest_game/ai/cartographer.cpp +++ b/source/glest_game/ai/cartographer.cpp @@ -143,6 +143,7 @@ void Cartographer::initResourceMap(ResourceMapKey key, PatchMap<1> *pMap) { void Cartographer::onResourceDepleted(Vec2i pos, const ResourceType *rt) { PF_TRACE(); + pos = Map::toUnitCoords(pos); updateMapMetrics(pos, GameConstants::cellScale); resDirtyAreas[rt].push_back(pos); } diff --git a/source/glest_game/graphics/debug_renderer.cpp b/source/glest_game/graphics/debug_renderer.cpp index bda67ee4..c29fabb8 100644 --- a/source/glest_game/graphics/debug_renderer.cpp +++ b/source/glest_game/graphics/debug_renderer.cpp @@ -126,17 +126,17 @@ DebugRenderer::DebugRenderer() { showVisibleQuad = captureVisibleQuad = regionHilights = - resourceMapOverlay = storeMapOverlay = showFrustum = captureFrustum = gridTextures = influenceMap = - AAStarTextures = HAAStarOverlay = + buildSiteMaps = false; - buildSiteMaps = + AAStarTextures = + resourceMapOverlay = true; } diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index 598c708d..6b23d8d3 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -388,7 +388,7 @@ void UnitUpdater::updateHarvest(Unit *unit){ unit->setTargetPos(targetPos); command->setPos(targetPos); unit->setLoadCount(0); - unit->setLoadType(map->getSurfaceCell(Map::toSurfCoords(unit->getTargetPos()))->getResource()->getType()); + unit->setLoadType(r->getType()); } else{ //if not continue walking @@ -471,7 +471,7 @@ void UnitUpdater::updateHarvest(Unit *unit){ if (r->decAmount(1)) { const ResourceType *rt = r->getType(); sc->deleteResource(); - world->getCartographer()->onResourceDepleted(unit->getTargetPos(), rt); + world->getCartographer()->onResourceDepleted(Map::toSurfCoords(unit->getTargetPos()), rt); unit->setCurrSkill(hct->getStopLoadedSkillType()); } }