* oops, forgot to hook-up ClusterMap updates (causing units to get stuck)

This commit is contained in:
James McCulloch 2010-08-08 13:06:33 +00:00
parent 3d482ca366
commit 52c37f0927
4 changed files with 8 additions and 22 deletions

View File

@ -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) {

View File

@ -136,6 +136,7 @@ class AnnotatedMap {
private:
int width, height;
World *world;
Map *cellMap;
public:

View File

@ -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() {

View File

@ -131,12 +131,12 @@ DebugRenderer::DebugRenderer() {
captureFrustum =
gridTextures =
influenceMap =
HAAStarOverlay =
buildSiteMaps =
resourceMapOverlay =
false;
AAStarTextures =
resourceMapOverlay =
HAAStarOverlay =
true;
}