* 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) {
PF_TRACE();
pos = Map::toUnitCoords(pos);
updateMapMetrics(pos, GameConstants::cellScale);
resDirtyAreas[rt].push_back(pos);
}

View File

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

View File

@ -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());
}
}