Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/mapview.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-02-21 03:41:40 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-02-21 03:41:40 (GMT)
commit2ff9cc16b223b38687a1c0c1c2798ce26aece7cf (patch)
treefe239d6f76d3ceca8067f78409371eeba013c024 /mapview.py
parentb68ae2d0c20fb38158380f3f488e08560832331d (diff)
Move the information of the doors in the walls to another array.
The doors have different properties than the other objects attached to the walls. The doors are present at the two sides of the wall, and the position is fixed. I have moved the doors to a 'doors' array, and the 'objects' array will be loaded with the other objects. I think the code will be simpler in this way. Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'mapview.py')
-rw-r--r--mapview.py12
1 files changed, 2 insertions, 10 deletions
diff --git a/mapview.py b/mapview.py
index 3c1b193..ed48a06 100644
--- a/mapview.py
+++ b/mapview.py
@@ -72,7 +72,7 @@ class TopMapView(gtk.DrawingArea):
x_pos = self.margin_x + x * self.cell_size
y_pos = self.margin_y + y * self.cell_size
if wall_info is not None:
- if self.have_door(wall_info):
+ if self._game_map.have_door(x, y, direction):
# draw door
ctx.move_to(x_pos, y_pos)
ctx.line_to(x_pos + self._door_width, y_pos)
@@ -88,7 +88,7 @@ class TopMapView(gtk.DrawingArea):
direction = 'W'
wall_info = self._game_map.get_wall_info(x, y, direction)
if wall_info is not None:
- if self.have_door(wall_info):
+ if self._game_map.have_door(x, y, direction):
# draw door
ctx.move_to(x_pos, y_pos)
ctx.line_to(x_pos, y_pos + self._door_width)
@@ -136,14 +136,6 @@ class TopMapView(gtk.DrawingArea):
ctx.set_source_rgb(*fill)
ctx.fill()
- def have_door(self, wall_info):
- _have_door = False
- for wall_object in wall_info:
- if wall_object.startswith('door'):
- _have_door = True
- break
- return _have_door
-
def main():
window = gtk.Window()