From 3227758d362ac444a8e120902d89bc4e8d1a9e89 Mon Sep 17 00:00:00 2001 From: danij Date: Thu, 8 Aug 2013 04:18:01 +0100 Subject: [PATCH] World|Map|DMU API: Segments are no longer addressable using DMU See: 5411643e7ac6bbc7d2e2a54ed5f5a384a04a7c4b --- doomsday/client/include/world/map.h | 8 -------- doomsday/client/src/world/api_map.cpp | 11 ---------- doomsday/client/src/world/bsp/partitioner.cpp | 4 ---- doomsday/client/src/world/map.cpp | 20 ++++--------------- doomsday/client/src/world/world.cpp | 1 - 5 files changed, 4 insertions(+), 40 deletions(-) diff --git a/doomsday/client/include/world/map.h b/doomsday/client/include/world/map.h index 6a6642e1d5..38b6a539c8 100644 --- a/doomsday/client/include/world/map.h +++ b/doomsday/client/include/world/map.h @@ -154,7 +154,6 @@ class Map typedef QList BspNodes; typedef QList BspLeafs; - typedef QList Segments; #ifdef __CLIENT__ typedef QSet PlaneSet; @@ -289,11 +288,6 @@ class Map */ BspLeafs const &bspLeafs() const; - /** - * Provides access to the list of line segments for efficient traversal. - */ - Segments const &segments() const; - inline int vertexCount() const { return vertexes().count(); } inline int lineCount() const { return lines().count(); } @@ -308,8 +302,6 @@ class Map inline int bspLeafCount() const { return bspLeafs().count(); } - inline int segmentCount() const { return segments().count(); } - /** * Helper function which returns the relevant side index given a @a lineIndex * and @a side identifier. diff --git a/doomsday/client/src/world/api_map.cpp b/doomsday/client/src/world/api_map.cpp index a6d41d69bc..db154beb3c 100644 --- a/doomsday/client/src/world/api_map.cpp +++ b/doomsday/client/src/world/api_map.cpp @@ -299,7 +299,6 @@ int P_ToIndex(void const *ptr) switch(elem->type()) { case DMU_VERTEX: - case DMU_SEGMENT: case DMU_LINE: case DMU_SIDE: case DMU_BSPLEAF: @@ -328,9 +327,6 @@ void *P_ToPtr(int type, int index) case DMU_VERTEX: return App_World().map().vertexes().at(index); - case DMU_SEGMENT: - return App_World().map().segments().at(index); - case DMU_LINE: return App_World().map().lines().at(index); @@ -372,7 +368,6 @@ int P_Count(int type) switch(type) { case DMU_VERTEX: return App_World().hasMap()? App_World().map().vertexCount() : 0; - case DMU_SEGMENT: return App_World().hasMap()? App_World().map().segmentCount() : 0; case DMU_LINE: return App_World().hasMap()? App_World().map().lineCount() : 0; case DMU_SIDE: return App_World().hasMap()? App_World().map().sideCount() : 0; case DMU_BSPNODE: return App_World().hasMap()? App_World().map().bspNodeCount() : 0; @@ -460,11 +455,6 @@ int P_Callback(int type, int index, void *context, int (*callback)(void *p, void return callback(App_World().map().vertexes().at(index), context); break; - case DMU_SEGMENT: - if(index >= 0 && index < App_World().map().segmentCount()) - return callback(App_World().map().segments().at(index), context); - break; - case DMU_LINE: if(index >= 0 && index < App_World().map().lineCount()) return callback(App_World().map().lines().at(index), context); @@ -531,7 +521,6 @@ int P_Callbackp(int type, void *elPtr, void *context, int (*callback)(void *p, v switch(type) { case DMU_VERTEX: - case DMU_SEGMENT: case DMU_LINE: case DMU_SIDE: case DMU_BSPNODE: diff --git a/doomsday/client/src/world/bsp/partitioner.cpp b/doomsday/client/src/world/bsp/partitioner.cpp index 59b4cb9266..5bca90ff0d 100644 --- a/doomsday/client/src/world/bsp/partitioner.cpp +++ b/doomsday/client/src/world/bsp/partitioner.cpp @@ -1367,10 +1367,6 @@ DENG2_PIMPL(Partitioner) { switch(elm->type()) { - case DMU_SEGMENT: - /// @todo fixme: Implement a mechanic for tracking Segment ownership. - return true; - case DMU_BSPLEAF: case DMU_BSPNODE: { BspTreeNode *treeNode = treeNodeForBspElement(elm); diff --git a/doomsday/client/src/world/map.cpp b/doomsday/client/src/world/map.cpp index 5dc6d31803..7602d8351b 100644 --- a/doomsday/client/src/world/map.cpp +++ b/doomsday/client/src/world/map.cpp @@ -143,7 +143,6 @@ DENG2_OBSERVES(bsp::Partitioner, UnclosedSectorFound) MapElement *bspRoot; /// BSP element LUTs: - Segments segments; BspNodes bspNodes; BspLeafs bspLeafs; @@ -223,9 +222,10 @@ DENG2_OBSERVES(bsp::Partitioner, UnclosedSectorFound) lightGrid.reset(); #endif + /// @todo fixme: What about Segments? + qDeleteAll(bspNodes); qDeleteAll(bspLeafs); - qDeleteAll(segments); qDeleteAll(sectors); foreach(Polyobj *polyobj, polyobjs) { @@ -467,13 +467,7 @@ DENG2_OBSERVES(bsp::Partitioner, UnclosedSectorFound) foreach(Segment *seg, leaf->allSegments()) { - // Take ownership of the Segment. - partitioner.take(seg); - - // Add this segment to the LUT. seg->setMap(thisPublic); - seg->setIndexInMap(segments.count()); - segments.append(seg); } return; @@ -499,7 +493,6 @@ DENG2_OBSERVES(bsp::Partitioner, UnclosedSectorFound) bool buildBsp() { DENG2_ASSERT(bspRoot == 0); - DENG2_ASSERT(segments.isEmpty()); DENG2_ASSERT(bspLeafs.isEmpty()); DENG2_ASSERT(bspNodes.isEmpty()); @@ -557,7 +550,6 @@ DENG2_OBSERVES(bsp::Partitioner, UnclosedSectorFound) bspRoot = rootNode->userData(); // We'll formally take ownership shortly... #ifdef DENG2_QT_4_7_OR_NEWER - segments.reserve(partitioner.numSegments()); bspNodes.reserve(partitioner.numNodes()); bspLeafs.reserve(partitioner.numLeafs()); #endif @@ -1203,7 +1195,8 @@ DENG2_OBSERVES(bsp::Partitioner, UnclosedSectorFound) */ bias.lastChangeOnFrame = frameCount; - foreach(Segment *seg, segments) + foreach(BspLeaf *bspLeaf, bspLeafs) + foreach(Segment *seg, bspLeaf->allSegments()) { seg->applyBiasDigest(allChanges); } @@ -1275,11 +1268,6 @@ Map::BspLeafs const &Map::bspLeafs() const return d->bspLeafs; } -Map::Segments const &Map::segments() const -{ - return d->segments; -} - #ifdef __CLIENT__ Map::SurfaceSet &Map::decoratedSurfaces() diff --git a/doomsday/client/src/world/world.cpp b/doomsday/client/src/world/world.cpp index f0f89c6948..ba3916fa30 100644 --- a/doomsday/client/src/world/world.cpp +++ b/doomsday/client/src/world/world.cpp @@ -493,7 +493,6 @@ DENG2_PIMPL(World) os << TABBED(map->sectorCount(), "Sectors"); os << TABBED(map->bspNodeCount(), "BSP Nodes"); os << TABBED(map->bspLeafCount(), "BSP Leafs"); - os << TABBED(map->segmentCount(), "Segments"); LOG_INFO("%s") << str.rightStrip();