Counting specialists

Joined
Jun 27, 2007
Messages
2,248
Location
Hamilton, Ontario
I want to create a quest that involves specialists. Is it possible to have the game count how many specialist (and what kind) there are in each of a player's cities?
 
Look in CityView.lua (as that's the code that drags all the specialist buildings to the top of the built list and displays how many specialist slots are occupied)

The logic will be something along the lines of
Code:
loop each player
  loop each of their cities
    loop every building type
      if the building has specialist slot(s)
        if the city has the building type
          count how many slots are filled

as quests get checked often, it would be worth caching which building types have specialist slots, ie

Code:
-- Do this once, as the game loads
loop every building type
  if the building has specialist slot(s)
    cache the building type
and then
Code:
loop each player
  loop each of their cities
    loop every cacahed building type with specialists
      if the city has the building type
        count how many slots are filled
 
Back
Top Bottom