diff options
author | neoraider <devnull@localhost> | 2007-12-25 04:27:03 +0100 |
---|---|---|
committer | neoraider <devnull@localhost> | 2007-12-25 04:27:03 +0100 |
commit | 052641637bd20ffde6ddb8919888e2af987bafff (patch) | |
tree | a3ad75e2271fd95337a9768df5fe452e2a63b0ce /EditManager.cpp | |
parent | 953a6ff48ac6c46a0d81bedb0fbdafe5d637666e (diff) | |
download | zoomedit-052641637bd20ffde6ddb8919888e2af987bafff.tar zoomedit-052641637bd20ffde6ddb8919888e2af987bafff.zip |
zoomedit: Added rectangular room tool.
Diffstat (limited to 'EditManager.cpp')
-rw-r--r-- | EditManager.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/EditManager.cpp b/EditManager.cpp index 2d743f5..9c44a27 100644 --- a/EditManager.cpp +++ b/EditManager.cpp @@ -46,7 +46,9 @@ bool EditManager::addRoom(const Room &newRoom) { room->setName(idManager.generate("room")); window->getLevel().push_back(SharedPtr<LevelObject>(room)); - selectedObject = &*window->getLevel().back(); + selectedObject = room; + + window->resetTool(); return true; } @@ -83,20 +85,23 @@ void EditManager::setHoveredVertex(Vertex *v) { window->update(); } -bool EditManager::vertexOk(const Room &newRoom, const Vertex &v) const { +bool EditManager::vertexOk(const Vertex &v, const Room *newRoom) const { Line l; for(Level::iterator room = window->getLevel().begin(); room != window->getLevel().end(); room++) { if((*room)->isOfType("Room") && ((Room*)&**room)->contains(v)) return false; } - if(newRoom.empty()) + if(!newRoom) + return true; + + if(newRoom->empty()) return true; - l.setVertex1(newRoom.back()); + l.setVertex1(newRoom->back()); l.setVertex2(v); - return lineOk(newRoom, l); + return lineOk(*newRoom, l); } bool EditManager::polygonOk(const Polygon& polygon) const { |