From 52c37f092775044a584bde3a357bd287b5bd62e2 Mon Sep 17 00:00:00 2001 From: James McCulloch Date: Sun, 8 Aug 2010 13:06:33 +0000 Subject: [PATCH] * oops, forgot to hook-up ClusterMap updates (causing units to get stuck) --- source/glest_game/ai/annotated_map.cpp | 13 +++++-------- source/glest_game/ai/annotated_map.h | 1 + source/glest_game/ai/cluster_map.cpp | 12 ------------ source/glest_game/graphics/debug_renderer.cpp | 4 ++-- 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/source/glest_game/ai/annotated_map.cpp b/source/glest_game/ai/annotated_map.cpp index d7a70f8e..f98ac6a9 100644 --- a/source/glest_game/ai/annotated_map.cpp +++ b/source/glest_game/ai/annotated_map.cpp @@ -16,11 +16,9 @@ #include "annotated_map.h" #include "world.h" #include "pos_iterator.h" -/* -#include "path_finder.h" #include "cartographer.h" #include "cluster_map.h" -*/ + #include "profiler.h" namespace Glest { namespace Game { @@ -29,7 +27,8 @@ namespace Glest { namespace Game { * @param master true if this is the master map, false for a foggy map (default true) */ AnnotatedMap::AnnotatedMap(World *world) - : cellMap(NULL) { + : world(world) + , cellMap(NULL) { //_PROFILE_FUNCTION(); assert(world && world->getMap()); cellMap = world->getMap(); @@ -72,10 +71,9 @@ void AnnotatedMap::initMapMetrics() { //#define LOG_CLUSTER_DIRTYING(x) {cout << x;} struct MudFlinger { - //ClusterMap *cm; + ClusterMap *cm; inline void setDirty(const Vec2i &pos) { - /* Vec2i cluster = ClusterMap::cellToCluster(pos); cm->setClusterDirty(cluster); LOG_CLUSTER_DIRTYING( "MapMetrics changed @ pos = " << pos << endl ) @@ -96,7 +94,6 @@ struct MudFlinger { cm->setWestBorderDirty(Vec2i(cluster.x + 1, cluster.y)); LOG_CLUSTER_DIRTYING( "\tEast border dirty\n" ) } - */ } } mudFlinger; @@ -109,7 +106,7 @@ void AnnotatedMap::updateMapMetrics(const Vec2i &pos, const int size) { //_PROFILE_FUNCTION(); // need to throw mud on the ClusterMap -// mudFlinger.cm = World::getInstance().getCartographer()->getClusterMap(); + mudFlinger.cm = world->getCartographer()->getClusterMap(); // 1. re-evaluate the cells occupied (or formerly occupied) for (int i = size - 1; i >= 0 ; --i) { diff --git a/source/glest_game/ai/annotated_map.h b/source/glest_game/ai/annotated_map.h index f3054dbb..8c0cf954 100644 --- a/source/glest_game/ai/annotated_map.h +++ b/source/glest_game/ai/annotated_map.h @@ -136,6 +136,7 @@ class AnnotatedMap { private: int width, height; + World *world; Map *cellMap; public: diff --git a/source/glest_game/ai/cluster_map.cpp b/source/glest_game/ai/cluster_map.cpp index 1e20b256..f9ba339e 100644 --- a/source/glest_game/ai/cluster_map.cpp +++ b/source/glest_game/ai/cluster_map.cpp @@ -630,9 +630,6 @@ bool TransitionNodeStore::setOpen(const Transition* pos, const Transition* prev, assert(open.find(pos) == open.end()); assert(closed.find(pos) == closed.end()); - //REMOVE - //assert(assertOpen()); - TransitionAStarNode *node = getNode(); if (!node) return false; node->pos = pos; @@ -643,9 +640,6 @@ bool TransitionNodeStore::setOpen(const Transition* pos, const Transition* prev, insertIntoOpen(node); listed[pos] = node; - //REMOVE - //assert(assertOpen()); - return true; } @@ -653,9 +647,6 @@ void TransitionNodeStore::updateOpen(const Transition* pos, const Transition* &p assert(open.find(pos) != open.end()); assert(closed.find(prev) != closed.end()); - //REMOVE - //assert(assertOpen()); - TransitionAStarNode *prevNode = listed[prev]; TransitionAStarNode *posNode = listed[pos]; if (prevNode->distToHere + cost < posNode->distToHere) { @@ -664,9 +655,6 @@ void TransitionNodeStore::updateOpen(const Transition* pos, const Transition* &p posNode->distToHere = prevNode->distToHere + cost; insertIntoOpen(posNode); } - - //REMOVE - //assert(assertOpen()); } const Transition* TransitionNodeStore::getBestCandidate() { diff --git a/source/glest_game/graphics/debug_renderer.cpp b/source/glest_game/graphics/debug_renderer.cpp index c29fabb8..02216723 100644 --- a/source/glest_game/graphics/debug_renderer.cpp +++ b/source/glest_game/graphics/debug_renderer.cpp @@ -131,12 +131,12 @@ DebugRenderer::DebugRenderer() { captureFrustum = gridTextures = influenceMap = - HAAStarOverlay = buildSiteMaps = + resourceMapOverlay = false; AAStarTextures = - resourceMapOverlay = + HAAStarOverlay = true; }