* fix for resource depletion updates to AnnotatedMap and Resource GoalMaps (cell to tile co-ord problem)

This commit is contained in:
James McCulloch 2010-07-17 05:13:34 +00:00
parent 15b9aebb9f
commit 8579dbb36e
3 changed files with 6 additions and 5 deletions

View File

@ -143,6 +143,7 @@ void Cartographer::initResourceMap(ResourceMapKey key, PatchMap<1> *pMap) {
void Cartographer::onResourceDepleted(Vec2i pos, const ResourceType *rt) { void Cartographer::onResourceDepleted(Vec2i pos, const ResourceType *rt) {
PF_TRACE(); PF_TRACE();
pos = Map::toUnitCoords(pos);
updateMapMetrics(pos, GameConstants::cellScale); updateMapMetrics(pos, GameConstants::cellScale);
resDirtyAreas[rt].push_back(pos); resDirtyAreas[rt].push_back(pos);
} }

View File

@ -126,17 +126,17 @@ DebugRenderer::DebugRenderer() {
showVisibleQuad = showVisibleQuad =
captureVisibleQuad = captureVisibleQuad =
regionHilights = regionHilights =
resourceMapOverlay =
storeMapOverlay = storeMapOverlay =
showFrustum = showFrustum =
captureFrustum = captureFrustum =
gridTextures = gridTextures =
influenceMap = influenceMap =
AAStarTextures =
HAAStarOverlay = HAAStarOverlay =
buildSiteMaps =
false; false;
buildSiteMaps = AAStarTextures =
resourceMapOverlay =
true; true;
} }

View File

@ -388,7 +388,7 @@ void UnitUpdater::updateHarvest(Unit *unit){
unit->setTargetPos(targetPos); unit->setTargetPos(targetPos);
command->setPos(targetPos); command->setPos(targetPos);
unit->setLoadCount(0); unit->setLoadCount(0);
unit->setLoadType(map->getSurfaceCell(Map::toSurfCoords(unit->getTargetPos()))->getResource()->getType()); unit->setLoadType(r->getType());
} }
else{ else{
//if not continue walking //if not continue walking
@ -471,7 +471,7 @@ void UnitUpdater::updateHarvest(Unit *unit){
if (r->decAmount(1)) { if (r->decAmount(1)) {
const ResourceType *rt = r->getType(); const ResourceType *rt = r->getType();
sc->deleteResource(); sc->deleteResource();
world->getCartographer()->onResourceDepleted(unit->getTargetPos(), rt); world->getCartographer()->onResourceDepleted(Map::toSurfCoords(unit->getTargetPos()), rt);
unit->setCurrSkill(hct->getStopLoadedSkillType()); unit->setCurrSkill(hct->getStopLoadedSkillType());
} }
} }