Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/game1
diff options
context:
space:
mode:
authorMateu Batle <mateu.batle@collabora.co.uk>2010-11-11 04:44:13 (GMT)
committer Mateu Batle <mateu.batle@collabora.co.uk>2010-11-11 04:44:13 (GMT)
commit990e43eb3517eac805e07e3895732ceb2ad291d0 (patch)
tree20c1d5ce03ee994b1d980582816ef15df0fd7c78 /game1
parent4c4108e32e3d6cc0d73fb6ebeeb43ef4cc755f22 (diff)
Checking correct index for map before access
Diffstat (limited to 'game1')
-rwxr-xr-xgame1/tracktmx.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/game1/tracktmx.py b/game1/tracktmx.py
index 0607319..30c666d 100755
--- a/game1/tracktmx.py
+++ b/game1/tracktmx.py
@@ -139,6 +139,14 @@ class Track():
for layer in self.world_map.layers[:]:
for tiley in range(ytilemin, ytilemax + 1):
for tilex in range(xtilemin, xtilemax + 1):
+ if tilex < 0 :
+ tilex = 0
+ if tilex >= self.world_map.width :
+ tilex = self.world_map.width - 1
+ if tiley < 0 :
+ tiley = 0
+ if tiley >= self.world_map.height :
+ tiley = self.world_map.height - 1
img_idx = layer.content2D[tilex][tiley]
material = self.world_map.indexed_tiles_tileset[img_idx]
if self.isGoal(material):