Esempio n. 1
0
	def _setup_grid(self, cursor):
		self.check_size()
		
		# Teams
		self.team_dict = team_q.get_real_active_teams(cursor, skip_irs=False)
		
		# Cities
		self.city_dict = city_q.get_cities_for_map(cursor,
			left=self.left, top=self.top, right=self.right, bottom=self.bottom)
		
		# Buildings
		self.building_dict = building_q.get_all_buildings(cursor)
		
		# Very small saving
		city_q.mass_get_city_buildings(cursor, self.city_dict)
		
		# Huge time saving on this one
		city_f.mass_city_wall_check(cursor, self.city_dict)
		
		# Wonders
		self.wonder_dict = wonder_q.get_all_wonders(cursor)
		
		# Artefacts
		self.artefact_dict = artefact_q.get_all_artefacts(cursor)
		
		# Cache things so we don't need to iterate through all cities
		self.cities_with_wonder = []
		self.cities_with_artefact = []
		
		for k, v in self.wonder_dict.items():
			self.cities_with_wonder.append(v.city)
		
		for k, v in self.artefact_dict.items():
			self.cities_with_artefact.append(v.city)
		
		self.cities_with_wonder = set(self.cities_with_wonder)
		self.cities_with_artefact = set(self.cities_with_artefact)
Esempio n. 2
0
import database
from classes import world, res_dict
from classes import team, city, squad, army, unit
from queries import equipment_q, building_q, deity_q, evolution_q, tech_q, spell_q, artefact_q, wonder_q

# Need some live data for things like buildings etc
temp_cursor = database.get_cursor()
equipment_dict = equipment_q.get_all_equipment(temp_cursor)
building_dict = building_q.get_all_buildings(temp_cursor)
deity_dict = deity_q.get_all_deities(temp_cursor)
evolution_dict = evolution_q.get_all_evolutions(temp_cursor)
spell_dict = spell_q.get_all_spells(temp_cursor)
tech_dict = tech_q.get_all_techs(temp_cursor)
artefact_dict = artefact_q.get_all_artefacts(temp_cursor)
wonder_dict = wonder_q.get_all_wonders(temp_cursor)

def dummy_world():
	w = world.World(Dead_cursor())
	
	#	LISTS
	#------------------------
	w._equipment = equipment_dict
	w._buildings = building_dict
	w._deities = deity_dict
	w._evolutions = evolution_dict
	w._spells = spell_dict
	w._techs = tech_dict
	w._artefacts = artefact_dict
	
	#	TEAMS
	#------------------------