Fix bug in production queue
Queue was losing initial task
This commit is contained in:
12
aoe/world.py
12
aoe/world.py
@@ -273,10 +273,10 @@ class World():
|
||||
while (self.get_effective_population() < pop_space and
|
||||
i < len(self.production_queue)):
|
||||
|
||||
thing = self.production_queue[i]
|
||||
thing, task = self.production_queue[i]
|
||||
if self.housing.check_housing(self, thing) and \
|
||||
self.production.check_production(self, thing):
|
||||
self._start_producing(thing)
|
||||
self._start_producing(thing, task)
|
||||
del self.production_queue[i]
|
||||
else:
|
||||
i += 1
|
||||
@@ -298,18 +298,18 @@ class World():
|
||||
|
||||
i = 0
|
||||
while i < len(self.production_queue):
|
||||
thing = self.production_queue[i]
|
||||
thing, task = self.production_queue[i]
|
||||
if self.production.building[thing] == building and \
|
||||
self.housing.check_housing(self, thing):
|
||||
self._start_producing(thing)
|
||||
self._start_producing(thing, task)
|
||||
del self.production_queue[i]
|
||||
break
|
||||
i += 1
|
||||
|
||||
|
||||
def _use_housing_and_production(self, thing):
|
||||
self.housing.check_housing(self, thing)
|
||||
self.production.check_production(self, thing)
|
||||
self.housing.check_housing(self, thing)
|
||||
|
||||
building = self.production.building[thing]
|
||||
if building is not None:
|
||||
@@ -350,7 +350,7 @@ class World():
|
||||
try:
|
||||
self._use_housing_and_production(thing)
|
||||
except ProductionBuildingNotAvailableException:
|
||||
self.production_queue.append(thing)
|
||||
self.production_queue.append((thing, initial_task))
|
||||
else:
|
||||
update_time = self.current_time + self.build_times.build_times[thing]
|
||||
self.events[update_time].append((self._add_thing, (thing, initial_task,)))
|
||||
|
||||
Reference in New Issue
Block a user