Skip to content

Instantly share code, notes, and snippets.

@nihathrael
Created November 13, 2013 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nihathrael/7457293 to your computer and use it in GitHub Desktop.
Save nihathrael/7457293 to your computer and use it in GitHub Desktop.
diff --git a/horizons/world/__init__.py b/horizons/world/__init__.py
index 0556cf0..e3cb83d 100644
--- a/horizons/world/__init__.py
+++ b/horizons/world/__init__.py
@@ -283,6 +283,9 @@ class World(BuildingOwner, WorldObject):
def load_raw_map(self, savegame_db, preview=False):
self.map_name = savegame_db.map_name
+ # Calculate map dimensions.
+
+
# Calculate map dimensions
self.min_x, self.min_y, self.max_x, self.max_y = savegame_db("SELECT min(x), min(y), max(x), max(y) from GROUND")[0]
self.map_padding = savegame_db.map_padding
@@ -290,6 +293,7 @@ class World(BuildingOwner, WorldObject):
self.min_y -= self.map_padding
self.max_x += self.map_padding
self.max_y += self.map_padding
+ print self.min_x, self.min_y, self.max_x, self.max_y
self.map_dimensions = Rect.init_from_borders(self.min_x, self.min_y, self.max_x, self.max_y)
# Load islands.
@@ -297,6 +301,19 @@ class World(BuildingOwner, WorldObject):
island = Island(savegame_db, islandid, self.session, preview=preview)
self.islands.append(island)
+# self.min_x, self.min_y, self.max_x, self.max_y = 0, 0, 0, 0
+# for island in self.islands:
+# self.min_x = min(island.position.left, self.min_x)
+# self.min_y = min(island.position.top, self.min_y)
+# self.max_x = max(island.position.right, self.max_x)
+# self.max_y = max(island.position.bottom, self.max_y)
+#
+# self.min_x -= self.map_padding
+# self.min_y -= self.map_padding
+# self.max_x += self.map_padding
+# self.max_y += self.map_padding
+# print self.min_x, self.min_y, self.max_x, self.max_y
+
# Add water.
self.log.debug("Filling world with water...")
self.ground_map = {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment