fix 2
This commit is contained in:
@@ -83,19 +83,31 @@ def evaluate_blueprints(conn):
|
||||
|
||||
if incomplete_buildings:
|
||||
phase_incomplete = True
|
||||
waiting_for_resources = False
|
||||
|
||||
# Try to find a building in this phase that we can upgrade right now
|
||||
for b_name in incomplete_buildings:
|
||||
b_info = build_data.get(b_name)
|
||||
if b_info and b_info.get('can_upgrade') == True:
|
||||
target_building = b_name
|
||||
break
|
||||
if b_info and not b_info.get('has_max_level'):
|
||||
# A missing_dependencies object that is empty means dependencies are met
|
||||
deps = b_info.get('missing_dependencies')
|
||||
if not deps:
|
||||
if b_info.get('enough_resources') != False:
|
||||
target_building = b_name
|
||||
break
|
||||
else:
|
||||
waiting_for_resources = True
|
||||
|
||||
if target_building:
|
||||
# Found something we can build right now
|
||||
break
|
||||
elif waiting_for_resources:
|
||||
# We meet the dependencies for at least one building, but lack resources.
|
||||
# We should wait for resources to accumulate instead of spending them on future phases.
|
||||
break
|
||||
else:
|
||||
# Nothing in this phase can be built (missing dependencies, population, or resources)
|
||||
# We look ahead up to 2 additional phases to unblock it
|
||||
# ALL incomplete buildings in this phase are blocked by missing dependencies.
|
||||
# We look ahead up to 2 additional phases to build the required dependencies.
|
||||
blocked_phases += 1
|
||||
if blocked_phases > 2:
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user