Permalink
Browse files

Bugfix for safe area removal.

  • Loading branch information...
dfloer committed Nov 7, 2018
1 parent 9ee5d73 commit 6ff16399a4cbeb824214ca846df968b75d4fae5f
Showing with 3 additions and 3 deletions.
  1. +3 −3 cocos2d.py
View
@@ -127,14 +127,14 @@ def add_safe_area(self, center, safe_type=0, radius=7):
City core safe area is highest priority and can't be overridden or removed.
Args:
center (Hexagon): center of the area to be made safe.
safe_type (int): 0 for unsafe, 1 for city-core safety, 2 for other safety.
safe_type (int): 0 for unsafe, 1 for city-core safety, 2 for other safety, -2 to remove other safety.
radius (int): radius of the safe area.
"""
safe_hexes = hex_math.get_hex_chunk(center, radius)
for h in safe_hexes:
if self.hexagon_map[h].safe == 1:
continue
self.hexagon_map[h].safe = safe_type
self.hexagon_map[h].safe += safe_type
def add_building(self, hex_coords, building):
@@ -403,7 +403,7 @@ def remove_building(self, cell):
self.buildings_batch.remove(name)
self.draw_buildings()
if building_id == 3:
terrain_map.add_safe_area(cell, 0, 3)
terrain_map.add_safe_area(cell, -2, 3)
overlay_layer.draw_safe()

0 comments on commit 6ff1639

Please sign in to comment.