summaryrefslogtreecommitdiffstats
path: root/edit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'edit.cpp')
-rw-r--r--edit.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/edit.cpp b/edit.cpp
index e03f92c..96dce6e 100644
--- a/edit.cpp
+++ b/edit.cpp
@@ -75,28 +75,28 @@ ROOM *getHoveredRoom() {
return hoveredRoom;
}
-static bool isLineOk(LINE *l) {
+static bool isLineOk(Line *l) {
LEVEL *lvl = getLevel();
- LINE l2;
+ Line l2;
if(activeRoom) {
for(int i = 0; i+2 < activeRoom->polygon.size(); i++) {
- l2.v1 = activeRoom->polygon[i];
- l2.v2 = activeRoom->polygon[i+1];
+ l2.setVertex1(activeRoom->polygon[i]);
+ l2.setVertex2(activeRoom->polygon[i+1]);
- if(lineIntersection(l, &l2, NULL) == INTERSECTION_SEGMENT_SEGMENT) return false;
+ if(l->intersects(l2, NULL) == INTERSECTION_SEGMENT_SEGMENT) return false;
}
if(activeRoom->polygon.size() > 1) {
- l2.v1 = activeRoom->polygon[activeRoom->polygon.size()-2];
- l2.v2 = activeRoom->polygon.back();
- if(vertexOnLine(&l->v2, &l2)) return false;
+ l2.setVertex1(activeRoom->polygon[activeRoom->polygon.size()-2]);
+ l2.setVertex2(activeRoom->polygon.back());
+ if(l2.contains(l->getVertex2())) return false;
}
}
for(int i = 0; i < lvl->nRooms; i++) {
- if(lvl->rooms[i].polygon.intersects(l))
+ if(lvl->rooms[i].polygon.intersects(*l))
return false;
}
@@ -105,7 +105,7 @@ static bool isLineOk(LINE *l) {
bool isVertexOk(Vertex *v) {
LEVEL *lvl = getLevel();
- LINE l;
+ Line l;
int i;
@@ -116,8 +116,8 @@ bool isVertexOk(Vertex *v) {
if(!(getActiveRoom() && !getActiveRoom()->polygon.empty()))
return true;
- l.v1 = getActiveRoom()->polygon.back();
- l.v2 = *v;
+ l.setVertex1(getActiveRoom()->polygon.back());
+ l.setVertex2(*v);
return isLineOk(&l);
}
@@ -126,7 +126,7 @@ bool isVertexOk(Vertex *v) {
bool isPolygonOk(Polygon *polygon) {
LEVEL *lvl = getLevel();
- LINE l, l2;
+ Line l, l2;
if(polygon->empty()) return false;
@@ -147,11 +147,11 @@ bool isPolygonOk(Polygon *polygon) {
Polygon::const_iterator it2 = it+1;
if(it2 == polygon->end()) it2 = polygon->begin();
- l.v1 = *it;
- l.v2 = *it2;
+ l.setVertex1(*it);
+ l.setVertex2(*it2);
for(int i = 0; i < lvl->nRooms; i++) {
- if(lvl->rooms[i].polygon.intersects(&l))
+ if(lvl->rooms[i].polygon.intersects(l))
return false;
}
@@ -162,10 +162,10 @@ bool isPolygonOk(Polygon *polygon) {
if(it == polygon->begin() && it4 == polygon->begin()) continue;
- l2.v1 = *it3;
- l2.v2 = *it4;
+ l2.setVertex1(*it3);
+ l2.setVertex2(*it4);
- if(lineIntersection(&l, &l2, NULL) == INTERSECTION_SEGMENT_SEGMENT)
+ if(l.intersects(l2, NULL) == INTERSECTION_SEGMENT_SEGMENT)
return false;
}
}