RogerBacon said:
What is the easiest way to find which city a specific wonder is in? Like, for example, I want to find the city that has the Colossus.
Roger Bacon
Roger,
I am assuming you are talking about how to find programmatically which city has a specific wonder right? The you need to use this snippet of code:
[PRE]
# wonderID = gc.getInfoTypeForString("BUILDING_HOLLYWOOD")
wonderID = gc.getInfoTypeForString("BUILDING_GREAT_LIGHTHOUSE")
city = self.findWonder(wonderID)
if(city):
CyInterface().addImmediateMessage(city.getName(),"")
# This assumes that the iBuildingType value you are sending in is for a unique building
# and not something like barracks. If that is the case then you will get the id of the first
# city with a barracks
def findWonder(self,iBuildingType):
'CyCity - city containing wonder"
# Get all of the players in the game
playerList = PyGame.getCivPlayerList()
for i in range(len(playerList)):
player = playerList
# Get the list of cities the player has
cityList = player.getCityList()
for j in range(len(cityList)):
city = cityList[j]
if(city.hasBuilding(iBuildingType)):
return city
return
[/PRE]
The old code did not work, I have updated and tested the code and it works now.