fix build position

This commit is contained in:
Thefeli73 2020-10-07 19:15:09 +02:00
parent 6af8e1a46d
commit 96633a9e98

30
main.py
View File

@ -392,26 +392,14 @@ def build_place(structure, i):
global building_under_construction, rounds_between_energy, state global building_under_construction, rounds_between_energy, state
if isinstance(available_tiles[i], tuple): if isinstance(available_tiles[i], tuple):
game_layer.place_foundation(available_tiles[i], structure) game_layer.place_foundation(available_tiles[i], structure)
for building in state.available_residence_buildings: for j in range(len(state.utilities)):
if structure in building.building_name: building = state.utilities[j]
for j in range(len(state.residences)): coords_to_check = (building.X, building.Y)
building = state.residences[j] if coords_to_check == available_tiles[i]:
coords_to_check = (building.X, building.Y) available_tiles[i] = building
if coords_to_check == available_tiles[i]: building_under_construction = (building.X, building.Y, j)
available_tiles[i] = building return True
building_under_construction = (building.X, building.Y, j) return False
rounds_between_energy = len(state.residences)+2
return True
for building in state.available_utility_buildings:
if structure in building.building_name:
for j in range(len(state.utilities)):
building = state.utilities[j]
coords_to_check = (building.X, building.Y)
if coords_to_check == available_tiles[i]:
available_tiles[i] = building
building_under_construction = (building.X, building.Y, j)
return True
return False
def build(structure): def build(structure):
@ -438,7 +426,7 @@ def build(structure):
available_tiles[i] = building available_tiles[i] = building
building_under_construction = (building.X, building.Y, j) building_under_construction = (building.X, building.Y, j)
return True return True
return False return False
if __name__ == "__main__": if __name__ == "__main__":