summaryrefslogtreecommitdiffstats
path: root/Room.h
diff options
context:
space:
mode:
Diffstat (limited to 'Room.h')
-rw-r--r--Room.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/Room.h b/Room.h
index e7e7ffb..7dde7d1 100644
--- a/Room.h
+++ b/Room.h
@@ -22,6 +22,8 @@ class Room : public LevelObject, private VertexProvider, private EdgeProvider {
virtual const Vertex& operator-=(const Vertex &v) {return **this;}
virtual void setLocation(float x, float y) {}
+
+ virtual bool isDirect() const = 0;
};
class RoomVertexDirect : public RoomVertex {
@@ -48,6 +50,8 @@ class Room : public LevelObject, private VertexProvider, private EdgeProvider {
virtual void setLocation(float x, float y) {
vertex.setLocation(x, y);
}
+
+ virtual bool isDirect() const {return true;}
};
class RoomVertexIndirect : public RoomVertex {
@@ -60,6 +64,8 @@ class Room : public LevelObject, private VertexProvider, private EdgeProvider {
virtual const Vertex& operator*() const {
return *vertex;
}
+
+ virtual bool isDirect() const {return false;}
};
@@ -132,8 +138,8 @@ class Room : public LevelObject, private VertexProvider, private EdgeProvider {
}
void close() {
- if(!edges.empty())
- edges.push_back(Edge(edges.back().getVertex2(), edges.front().getVertex1()));
+ if(vertices.size() >= 2)
+ edges.push_back(Edge(LevelVertex(this, vertices.size()-1, this), LevelVertex(this, 0, this)));
}
Polygon getPolygon() const {