Ticket #672 (closed defect: fixed)

Opened 5 weeks ago

Last modified 4 weeks ago

Unable to build brickyard on certain locations

Reported by: Quassy Owned by:
Priority: major Milestone: 2010.1
Component: Code:Game Keywords:
Cc: Version + SVN ref:
Blocked By: Python Version:
Hardware Architecture: All Operating System: All
Blocking:

Description

I am unable to build a brickyard on two ruins (western coast of the island), but can build other buildings (field, farm) on these ruins.

Does not apply to all ruins though (the ones south on the island).

There are also some other completely free sites where building a brickyard is not - but other buildings (testet farm, field, house) is - possible (south eastern / directly next to the farm in the south)

Change History

comment:1 Changed 5 weeks ago by Quassy

Filesize limit on trac is not enough for typical savegames...

Here it is:  http://npshare.de/files/542c88e0/quicksave-1280607372.1682.sqlite

comment:2 Changed 5 weeks ago by eoc

  • Component changed from Unspecified to Code:Game
  • Milestone set to 2010.1

I also experience this from time to time. Sometimes it helps to rotate by 180 degrees ... or 360 ... or more (-

Another issue once was that it mattered from where you approached the building site. If approaching from coast it would need one free tile before you could actually build the by.

comment:3 Changed 4 weeks ago by totycro

It seems that the check for buildability does not take the rotation into account, i.e. width and height are always 2 and 4 for the brickyard, but this would have to change for different rotations.

comment:4 Changed 4 weeks ago by totycro

  • Status changed from new to closed
  • Resolution set to fixed

this fixes it, will commit as soon as svn is up again:

Index: horizons/world/building/buildable.py
===================================================================
--- horizons/world/building/buildable.py	(revision 3630)
+++ horizons/world/building/buildable.py	(working copy)
@@ -76,11 +76,17 @@
 		@param check_settlement: whether to check for a settlement (for settlementless buildings)
 		@param ship: ship instance if building from ship
 		@return instance of _BuildPosition"""
-		position = Rect.init_from_topleft_and_size(point.x, point.y, cls.size[0]-1, cls.size[1]-1)
+		# for non-quadratic buildings, we have to switch width and height depending on the rotation
+		if rotation == 45 or rotation == 225:
+			position = Rect.init_from_topleft_and_size(point.x, point.y, cls.size[0]-1, cls.size[1]-1)
+		else:
+			position = Rect.init_from_topleft_and_size(point.x, point.y, cls.size[1]-1, cls.size[0]-1)
+
 		buildable = True
 		tearset = []
 		try:
 			cls._check_island(session, position)
+			# TODO: if the rotation changes here for non-quadratic buildings, wrong results will be returned
 			rotation = cls._check_rotation(session, position, rotation)
 			tearset = cls._check_buildings(session, position)
 			if check_settlement:
Note: See TracTickets for help on using tickets.