Skip to content

Commit 9d42136

Browse files
committed
-Fix (OpenDUNE#235): Object_GetDistanceToEncoded calculation used the wrong object's type (thanks SergeYunev)
1 parent 426f817 commit 9d42136

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/object.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ uint16 Object_GetDistanceToEncoded(Object *o, uint16 encoded)
124124
position = s->o.position;
125125
packed = Tile_PackTile(position);
126126

127-
packed += g_table_structure_layoutEdgeTiles[g_table_structureInfo[o->type].layout][(Orientation_Orientation256ToOrientation8(Tile_GetDirection(o->position, position)) + 4) & 7];
127+
/* ENHANCEMENT -- Originally this was o->type, where 'o' refers to a unit. */
128+
packed += g_table_structure_layoutEdgeTiles[g_table_structureInfo[s->o.type].layout][(Orientation_Orientation256ToOrientation8(Tile_GetDirection(o->position, position)) + 4) & 7];
128129

129130
position = Tile_UnpackTile(packed);
130131
} else {

0 commit comments

Comments
 (0)