* oops, forgot to hook-up ClusterMap updates (causing units to get stuck)
This commit is contained in:
parent
3d482ca366
commit
52c37f0927
|
@ -16,11 +16,9 @@
|
||||||
#include "annotated_map.h"
|
#include "annotated_map.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
#include "pos_iterator.h"
|
#include "pos_iterator.h"
|
||||||
/*
|
|
||||||
#include "path_finder.h"
|
|
||||||
#include "cartographer.h"
|
#include "cartographer.h"
|
||||||
#include "cluster_map.h"
|
#include "cluster_map.h"
|
||||||
*/
|
|
||||||
#include "profiler.h"
|
#include "profiler.h"
|
||||||
|
|
||||||
namespace Glest { namespace Game {
|
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)
|
* @param master true if this is the master map, false for a foggy map (default true)
|
||||||
*/
|
*/
|
||||||
AnnotatedMap::AnnotatedMap(World *world)
|
AnnotatedMap::AnnotatedMap(World *world)
|
||||||
: cellMap(NULL) {
|
: world(world)
|
||||||
|
, cellMap(NULL) {
|
||||||
//_PROFILE_FUNCTION();
|
//_PROFILE_FUNCTION();
|
||||||
assert(world && world->getMap());
|
assert(world && world->getMap());
|
||||||
cellMap = world->getMap();
|
cellMap = world->getMap();
|
||||||
|
@ -72,10 +71,9 @@ void AnnotatedMap::initMapMetrics() {
|
||||||
//#define LOG_CLUSTER_DIRTYING(x) {cout << x;}
|
//#define LOG_CLUSTER_DIRTYING(x) {cout << x;}
|
||||||
|
|
||||||
struct MudFlinger {
|
struct MudFlinger {
|
||||||
//ClusterMap *cm;
|
ClusterMap *cm;
|
||||||
|
|
||||||
inline void setDirty(const Vec2i &pos) {
|
inline void setDirty(const Vec2i &pos) {
|
||||||
/*
|
|
||||||
Vec2i cluster = ClusterMap::cellToCluster(pos);
|
Vec2i cluster = ClusterMap::cellToCluster(pos);
|
||||||
cm->setClusterDirty(cluster);
|
cm->setClusterDirty(cluster);
|
||||||
LOG_CLUSTER_DIRTYING( "MapMetrics changed @ pos = " << pos << endl )
|
LOG_CLUSTER_DIRTYING( "MapMetrics changed @ pos = " << pos << endl )
|
||||||
|
@ -96,7 +94,6 @@ struct MudFlinger {
|
||||||
cm->setWestBorderDirty(Vec2i(cluster.x + 1, cluster.y));
|
cm->setWestBorderDirty(Vec2i(cluster.x + 1, cluster.y));
|
||||||
LOG_CLUSTER_DIRTYING( "\tEast border dirty\n" )
|
LOG_CLUSTER_DIRTYING( "\tEast border dirty\n" )
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
} mudFlinger;
|
} mudFlinger;
|
||||||
|
|
||||||
|
@ -109,7 +106,7 @@ void AnnotatedMap::updateMapMetrics(const Vec2i &pos, const int size) {
|
||||||
//_PROFILE_FUNCTION();
|
//_PROFILE_FUNCTION();
|
||||||
|
|
||||||
// need to throw mud on the ClusterMap
|
// 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)
|
// 1. re-evaluate the cells occupied (or formerly occupied)
|
||||||
for (int i = size - 1; i >= 0 ; --i) {
|
for (int i = size - 1; i >= 0 ; --i) {
|
||||||
|
|
|
@ -136,6 +136,7 @@ class AnnotatedMap {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int width, height;
|
int width, height;
|
||||||
|
World *world;
|
||||||
Map *cellMap;
|
Map *cellMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -630,9 +630,6 @@ bool TransitionNodeStore::setOpen(const Transition* pos, const Transition* prev,
|
||||||
assert(open.find(pos) == open.end());
|
assert(open.find(pos) == open.end());
|
||||||
assert(closed.find(pos) == closed.end());
|
assert(closed.find(pos) == closed.end());
|
||||||
|
|
||||||
//REMOVE
|
|
||||||
//assert(assertOpen());
|
|
||||||
|
|
||||||
TransitionAStarNode *node = getNode();
|
TransitionAStarNode *node = getNode();
|
||||||
if (!node) return false;
|
if (!node) return false;
|
||||||
node->pos = pos;
|
node->pos = pos;
|
||||||
|
@ -643,9 +640,6 @@ bool TransitionNodeStore::setOpen(const Transition* pos, const Transition* prev,
|
||||||
insertIntoOpen(node);
|
insertIntoOpen(node);
|
||||||
listed[pos] = node;
|
listed[pos] = node;
|
||||||
|
|
||||||
//REMOVE
|
|
||||||
//assert(assertOpen());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,9 +647,6 @@ void TransitionNodeStore::updateOpen(const Transition* pos, const Transition* &p
|
||||||
assert(open.find(pos) != open.end());
|
assert(open.find(pos) != open.end());
|
||||||
assert(closed.find(prev) != closed.end());
|
assert(closed.find(prev) != closed.end());
|
||||||
|
|
||||||
//REMOVE
|
|
||||||
//assert(assertOpen());
|
|
||||||
|
|
||||||
TransitionAStarNode *prevNode = listed[prev];
|
TransitionAStarNode *prevNode = listed[prev];
|
||||||
TransitionAStarNode *posNode = listed[pos];
|
TransitionAStarNode *posNode = listed[pos];
|
||||||
if (prevNode->distToHere + cost < posNode->distToHere) {
|
if (prevNode->distToHere + cost < posNode->distToHere) {
|
||||||
|
@ -664,9 +655,6 @@ void TransitionNodeStore::updateOpen(const Transition* pos, const Transition* &p
|
||||||
posNode->distToHere = prevNode->distToHere + cost;
|
posNode->distToHere = prevNode->distToHere + cost;
|
||||||
insertIntoOpen(posNode);
|
insertIntoOpen(posNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
//REMOVE
|
|
||||||
//assert(assertOpen());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Transition* TransitionNodeStore::getBestCandidate() {
|
const Transition* TransitionNodeStore::getBestCandidate() {
|
||||||
|
|
|
@ -131,12 +131,12 @@ DebugRenderer::DebugRenderer() {
|
||||||
captureFrustum =
|
captureFrustum =
|
||||||
gridTextures =
|
gridTextures =
|
||||||
influenceMap =
|
influenceMap =
|
||||||
HAAStarOverlay =
|
|
||||||
buildSiteMaps =
|
buildSiteMaps =
|
||||||
|
resourceMapOverlay =
|
||||||
false;
|
false;
|
||||||
|
|
||||||
AAStarTextures =
|
AAStarTextures =
|
||||||
resourceMapOverlay =
|
HAAStarOverlay =
|
||||||
true;
|
true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user