diff options
author | frosch <frosch@openttd.org> | 2015-02-06 21:56:50 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2015-02-06 21:56:50 +0000 |
commit | c655847235ac8ac7deb3e2c8c004dfb2ddf797d9 (patch) | |
tree | bed4e21cccb0f10c73557810131fa5b3823be275 | |
parent | 4846c7ed6b6f024ff31c826c5ede3fbea25ef5cb (diff) | |
download | openttd-c655847235ac8ac7deb3e2c8c004dfb2ddf797d9.tar.xz |
(svn r27138) -Fix: [NewGRF] Negative positions in industry layouts were interpreted incorrectly; however since the wrong behaviour is saner, define as the correct behaviour for GRFv8.
-rw-r--r-- | src/newgrf.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index c3b512014..c9a78deb9 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -3471,6 +3471,15 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, } else if (itt[k].gfx == 0xFF) { itt[k].ti.x = (int8)GB(itt[k].ti.x, 0, 8); itt[k].ti.y = (int8)GB(itt[k].ti.y, 0, 8); + + /* When there were only 256x256 maps, TileIndex was a uint16 and + * itt[k].ti was just a TileIndexDiff that was added to it. + * As such negative "x" values were shifted into the "y" position. + * x = -1, y = 1 -> x = 255, y = 0 + * Since GRF version 8 the position is interpreted as pair of independent int8. + * For GRF version < 8 we need to emulate the old shifting behaviour. + */ + if (_cur.grffile->grf_version < 8 && itt[k].ti.x < 0) itt[k].ti.y += 1; } } |