Package horizons :: Package world :: Package buildability :: Module terraincache :: Class TerrainBuildabilityCache
[hide private]
[frames] | no frames]

Class TerrainBuildabilityCache

source code

Keep track of the locations where buildings of specific types can be built.

An instance of this class is used to keep track of the buildability options given the terrain. (x, y) are in instance.cache[terrain_type][(width, height)] if and only if it is possible to place a building with the given terrain type restrictions and with the given size at the origin (x, y) given that other conditions are met. Basically it cares about the required terrain type of the building and not about the buildings on the island.

Other than the terrain type dimension it acts like an immutable BinaryBuildabilityCache.

Instance Methods [hide private]
__init__(self, island) source code
_init_land_and_coast(self) source code
_init_rows(self) source code
_init_squares(self) source code
create_cache(self) source code
create_sea_cache(self) source code
get_buildability_intersection(self, terrain_type, size, *other_cache_layers) source code
Class Variables [hide private]
  sizes = [(1, 1), (2, 2), (2, 3), (2, 4), (3, 3), (4, 4), (6, 6)]
  sea_radius = 3