Skip to content

Commit

Permalink
Fixes for bad code
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverCartz committed Aug 17, 2016
1 parent c319224 commit 9d1370a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aimmo-game/simulation/avatar/fog_of_war.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def apply_fog_of_war(world_map, avatar_wrapper):

lower_x = max(location.x - partial_fog_distance, 0)
lower_y = max(location.y - partial_fog_distance, 0)
upper_x = min(location.x + partial_fog_distance, len(world_map.num_cols()) - 1)
upper_y = min(location.y + partial_fog_distance, len(world_map.num_rows()) - 1)
upper_x = min(location.x + partial_fog_distance, world_map.num_cols - 1)
upper_y = min(location.y + partial_fog_distance, world_map.num_rows - 1)

x_range = upper_x - lower_x
y_range = upper_y - lower_y
Expand Down
7 changes: 7 additions & 0 deletions aimmo-game/tests/simulation/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ def all_cells(self):
def get_cell(self, location):
return self._cell_cache.setdefault(location, Cell(location))

@property
def num_rows(self):
return float('inf')

@property
def num_cols(self):
return float('inf')

class EmptyMap(WorldMap):
def __init__(self):
Expand Down
1 change: 1 addition & 0 deletions aimmo-game/tests/simulation/test_world_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def _create_full_cell(self):
'habitable': False,
'location': 'location',
'pickup': 'pickup',
'partially_fogged': False
}
return cell

Expand Down

0 comments on commit 9d1370a

Please sign in to comment.