Skip to content

Commit 52c37f0

Browse files
author
James McCulloch
committed
* oops, forgot to hook-up ClusterMap updates (causing units to get stuck)
1 parent 3d482ca commit 52c37f0

File tree

4 files changed

+8
-22
lines changed

4 files changed

+8
-22
lines changed

source/glest_game/ai/annotated_map.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@
1616
#include "annotated_map.h"
1717
#include "world.h"
1818
#include "pos_iterator.h"
19-
/*
20-
#include "path_finder.h"
2119
#include "cartographer.h"
2220
#include "cluster_map.h"
23-
*/
21+
2422
#include "profiler.h"
2523

2624
namespace Glest { namespace Game {
@@ -29,7 +27,8 @@ namespace Glest { namespace Game {
2927
* @param master true if this is the master map, false for a foggy map (default true)
3028
*/
3129
AnnotatedMap::AnnotatedMap(World *world)
32-
: cellMap(NULL) {
30+
: world(world)
31+
, cellMap(NULL) {
3332
//_PROFILE_FUNCTION();
3433
assert(world && world->getMap());
3534
cellMap = world->getMap();
@@ -72,10 +71,9 @@ void AnnotatedMap::initMapMetrics() {
7271
//#define LOG_CLUSTER_DIRTYING(x) {cout << x;}
7372

7473
struct MudFlinger {
75-
//ClusterMap *cm;
74+
ClusterMap *cm;
7675

7776
inline void setDirty(const Vec2i &pos) {
78-
/*
7977
Vec2i cluster = ClusterMap::cellToCluster(pos);
8078
cm->setClusterDirty(cluster);
8179
LOG_CLUSTER_DIRTYING( "MapMetrics changed @ pos = " << pos << endl )
@@ -96,7 +94,6 @@ struct MudFlinger {
9694
cm->setWestBorderDirty(Vec2i(cluster.x + 1, cluster.y));
9795
LOG_CLUSTER_DIRTYING( "\tEast border dirty\n" )
9896
}
99-
*/
10097
}
10198
} mudFlinger;
10299

@@ -109,7 +106,7 @@ void AnnotatedMap::updateMapMetrics(const Vec2i &pos, const int size) {
109106
//_PROFILE_FUNCTION();
110107

111108
// need to throw mud on the ClusterMap
112-
// mudFlinger.cm = World::getInstance().getCartographer()->getClusterMap();
109+
mudFlinger.cm = world->getCartographer()->getClusterMap();
113110

114111
// 1. re-evaluate the cells occupied (or formerly occupied)
115112
for (int i = size - 1; i >= 0 ; --i) {

source/glest_game/ai/annotated_map.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class AnnotatedMap {
136136

137137
private:
138138
int width, height;
139+
World *world;
139140
Map *cellMap;
140141

141142
public:

source/glest_game/ai/cluster_map.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -630,9 +630,6 @@ bool TransitionNodeStore::setOpen(const Transition* pos, const Transition* prev,
630630
assert(open.find(pos) == open.end());
631631
assert(closed.find(pos) == closed.end());
632632

633-
//REMOVE
634-
//assert(assertOpen());
635-
636633
TransitionAStarNode *node = getNode();
637634
if (!node) return false;
638635
node->pos = pos;
@@ -643,19 +640,13 @@ bool TransitionNodeStore::setOpen(const Transition* pos, const Transition* prev,
643640
insertIntoOpen(node);
644641
listed[pos] = node;
645642

646-
//REMOVE
647-
//assert(assertOpen());
648-
649643
return true;
650644
}
651645

652646
void TransitionNodeStore::updateOpen(const Transition* pos, const Transition* &prev, const float cost) {
653647
assert(open.find(pos) != open.end());
654648
assert(closed.find(prev) != closed.end());
655649

656-
//REMOVE
657-
//assert(assertOpen());
658-
659650
TransitionAStarNode *prevNode = listed[prev];
660651
TransitionAStarNode *posNode = listed[pos];
661652
if (prevNode->distToHere + cost < posNode->distToHere) {
@@ -664,9 +655,6 @@ void TransitionNodeStore::updateOpen(const Transition* pos, const Transition* &p
664655
posNode->distToHere = prevNode->distToHere + cost;
665656
insertIntoOpen(posNode);
666657
}
667-
668-
//REMOVE
669-
//assert(assertOpen());
670658
}
671659

672660
const Transition* TransitionNodeStore::getBestCandidate() {

source/glest_game/graphics/debug_renderer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ DebugRenderer::DebugRenderer() {
131131
captureFrustum =
132132
gridTextures =
133133
influenceMap =
134-
HAAStarOverlay =
135134
buildSiteMaps =
135+
resourceMapOverlay =
136136
false;
137137

138138
AAStarTextures =
139-
resourceMapOverlay =
139+
HAAStarOverlay =
140140
true;
141141
}
142142

0 commit comments

Comments
 (0)