File tree Expand file tree Collapse file tree
Rendering/ObjectRenderers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ namespace TSMapEditor
55{
66 public static class Constants
77 {
8- public const string ReleaseVersion = "1.3.4 " ;
8+ public const string ReleaseVersion = "1.3.5 " ;
99
1010 public static int CellSizeX = 48 ;
1111 public static int CellSizeY = 24 ;
Original file line number Diff line number Diff line change @@ -299,7 +299,7 @@ private float GetDepthFromPosition(T gameObject)
299299
300300 private MapTile GetSouthernmostCell ( T gameObject )
301301 {
302- MapTile tile ;
302+ MapTile tile = null ;
303303
304304 if ( gameObject . WhatAmI ( ) == RTTIType . Building )
305305 {
@@ -309,6 +309,33 @@ private MapTile GetSouthernmostCell(T gameObject)
309309 if ( tile == null )
310310 tile = Map . GetTile ( structure . Position ) ;
311311 }
312+ else if ( gameObject . WhatAmI ( ) == RTTIType . Terrain )
313+ {
314+ var terrainObject = gameObject as TerrainObject ;
315+
316+ // If the terrain object is larger than 1x1, we might need to handle it more like structures.
317+ // We can do this by looking at its impassable cell configuration.
318+ if ( terrainObject . TerrainType . ImpassableCells != null )
319+ {
320+ int maxX = 0 ;
321+ int maxY = 0 ;
322+ for ( int i = 0 ; i < terrainObject . TerrainType . ImpassableCells . Count ; i ++ )
323+ {
324+ var impassableCellOffset = terrainObject . TerrainType . ImpassableCells [ i ] ;
325+ if ( impassableCellOffset . X > maxX )
326+ maxX = impassableCellOffset . X ;
327+
328+ if ( impassableCellOffset . Y > maxY )
329+ maxY = impassableCellOffset . Y ;
330+ }
331+
332+ Point2D southernmostCellCoords = terrainObject . Position + new Point2D ( maxX , maxY ) ;
333+ tile = Map . GetTile ( southernmostCellCoords ) ;
334+ }
335+
336+ if ( tile == null )
337+ tile = Map . GetTile ( terrainObject . Position ) ;
338+ }
312339 else
313340 {
314341 tile = Map . GetTile ( gameObject . Position ) ;
You can’t perform that action at this time.
0 commit comments