Fix bug in production queue

Queue was losing initial task
This commit is contained in:
Nate Bowman
2026-11-06 19:06:53 -05:00
parent 0fa68c6e32
commit 1f19740355

View File

@@ -273,10 +273,10 @@ class World():
while (self.get_effective_population() < pop_space and while (self.get_effective_population() < pop_space and
i < len(self.production_queue)): i < len(self.production_queue)):
thing = self.production_queue[i] thing, task = self.production_queue[i]
if self.housing.check_housing(self, thing) and \ if self.housing.check_housing(self, thing) and \
self.production.check_production(self, thing): self.production.check_production(self, thing):
self._start_producing(thing) self._start_producing(thing, task)
del self.production_queue[i] del self.production_queue[i]
else: else:
i += 1 i += 1
@@ -298,18 +298,18 @@ class World():
i = 0 i = 0
while i < len(self.production_queue): while i < len(self.production_queue):
thing = self.production_queue[i] thing, task = self.production_queue[i]
if self.production.building[thing] == building and \ if self.production.building[thing] == building and \
self.housing.check_housing(self, thing): self.housing.check_housing(self, thing):
self._start_producing(thing) self._start_producing(thing, task)
del self.production_queue[i] del self.production_queue[i]
break break
i += 1 i += 1
def _use_housing_and_production(self, thing): def _use_housing_and_production(self, thing):
self.housing.check_housing(self, thing)
self.production.check_production(self, thing) self.production.check_production(self, thing)
self.housing.check_housing(self, thing)
building = self.production.building[thing] building = self.production.building[thing]
if building is not None: if building is not None:
@@ -350,7 +350,7 @@ class World():
try: try:
self._use_housing_and_production(thing) self._use_housing_and_production(thing)
except ProductionBuildingNotAvailableException: except ProductionBuildingNotAvailableException:
self.production_queue.append(thing) self.production_queue.append((thing, initial_task))
else: else:
update_time = self.current_time + self.build_times.build_times[thing] update_time = self.current_time + self.build_times.build_times[thing]
self.events[update_time].append((self._add_thing, (thing, initial_task,))) self.events[update_time].append((self._add_thing, (thing, initial_task,)))