diff --git a/src/entities/system_entities.py b/src/entities/system_entities.py index d009642b1676e9a0006998e440e005f2101b2957..ad40813b457477e38860423eb33d82768c7145d8 100644 --- a/src/entities/system_entities.py +++ b/src/entities/system_entities.py @@ -8,6 +8,7 @@ import random # User Imports. from src.logging import init_logging +from src.misc import get_tile_coord_from_id # Initialize logger. @@ -672,8 +673,7 @@ class Walls: curr_problem_child = red_tiles.pop(0) # Get actual problem tile. - pos_x = int(curr_problem_child[0]) - pos_y = int(curr_problem_child[3]) + pos_x, pos_y = get_tile_coord_from_id(curr_problem_child) tile = self.data_manager.tile_set.tiles[pos_y][pos_x] # Fetch neighbor tiles. @@ -758,8 +758,7 @@ class Walls: # Grab tile at start of list. tile_id = pending_tile_list.pop(0) - pos_x = int(tile_id[0]) - pos_y = int(tile_id[3]) + pos_x, pos_y = get_tile_coord_from_id(tile_id) # Get literal tile entity. curr_tile = self.data_manager.tile_set.tiles[pos_y][pos_x] diff --git a/src/misc.py b/src/misc.py index e7831aca94a7b5534b32bc18db84a8f3f0a1d4e2..5b0beb41a9175c81f47940a77677950509962b23 100644 --- a/src/misc.py +++ b/src/misc.py @@ -229,8 +229,9 @@ def get_tile_coord_from_id(tile_id): :param tile_id: Identifier for tile. :return: Tuple of (x_coord, y_coord) for tile. """ - tile_x = int(tile_id[0]) - tile_y = int(tile_id[3]) + id_split = str(tile_id).split(', ') + tile_x = int(id_split[0]) + tile_y = int(id_split[1]) return tile_x, tile_y