comparison gamelib/tiles.py @ 552:11c4cebfe4c5

Preparatory work for woodland biodiversity.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 28 Nov 2009 17:37:13 +0000
parents 3ed6c011106d
children 5cdf26bde2f2
comparison
equal deleted inserted replaced
551:dc8ff47371f2 552:11c4cebfe4c5
16 2: ("fence", "fence.png"), 16 2: ("fence", "fence.png"),
17 3: ("henhouse", "grassland.png"), 17 3: ("henhouse", "grassland.png"),
18 4: ("guardtower", "grassland.png"), 18 4: ("guardtower", "grassland.png"),
19 5: ("broken fence", "broken_fence.png"), 19 5: ("broken fence", "broken_fence.png"),
20 6: ("hendominium", "grassland.png"), 20 6: ("hendominium", "grassland.png"),
21
22 255: ("woodland", "woodland.png"),
23 254: ("woodland", "woodland2.png"),
24 253: ("woodland", "woodland3.png"),
21 } 25 }
22 26
23 def __init__(self, tiles=None): 27 def __init__(self, tiles=None):
24 if tiles is None: 28 if tiles is None:
25 tiles = self.DEFAULT_TILES.copy() 29 tiles = self.DEFAULT_TILES.copy()
26 self._tiles = tiles 30 self._tiles = tiles
27 self._reverse_map = dict((v[0], k) for k, v in self._tiles.iteritems()) 31 self._reverse_map = dict((v[0], k) for k, v in self._tiles.iteritems())
32 # Wood is different:
33 self._reverse_map["woodland"] = 0
28 34
29 def __getitem__(self, n): 35 def __getitem__(self, n):
30 """Get the string name of tile n.""" 36 """Get the string name of tile n."""
31 return self._tiles[n][0] 37 return self._tiles[n][0]
32 38