diff options
author | celestar <celestar@openttd.org> | 2006-12-27 12:38:02 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2006-12-27 12:38:02 +0000 |
commit | d95e2c2dd10a0dfc1704962a68a2bd32b635d158 (patch) | |
tree | 28100daed109de06e979123edd0601487ecc8261 /misc.c | |
parent | d92103d6ff97ae413e2e6eae602e04b05addaf17 (diff) | |
download | openttd-d95e2c2dd10a0dfc1704962a68a2bd32b635d158.tar.xz |
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 39 |
1 files changed, 22 insertions, 17 deletions
@@ -551,16 +551,26 @@ static void Load_MAPE(void) uint size = MapSize(); uint i; - for (i = 0; i != size;) { - uint8 buf[1024]; - uint j; + if (CheckSavegameVersion(42)) { + for (i = 0; i != size;) { + uint8 buf[1024]; + uint j; + + SlArray(buf, lengthof(buf), SLE_UINT8); + for (j = 0; j != lengthof(buf); j++) { + _m[i++].extra = GB(buf[j], 0, 2); + _m[i++].extra = GB(buf[j], 2, 2); + _m[i++].extra = GB(buf[j], 4, 2); + _m[i++].extra = GB(buf[j], 6, 2); + } + } + } else { + for (i = 0; i != size;) { + byte buf[4096]; + uint j; - SlArray(buf, lengthof(buf), SLE_UINT8); - for (j = 0; j != lengthof(buf); j++) { - _m[i++].extra = GB(buf[j], 0, 2); - _m[i++].extra = GB(buf[j], 2, 2); - _m[i++].extra = GB(buf[j], 4, 2); - _m[i++].extra = GB(buf[j], 6, 2); + SlArray(buf, lengthof(buf), SLE_UINT8); + for (j = 0; j != lengthof(buf); j++) _m[i++].extra = buf[j]; } } } @@ -570,17 +580,12 @@ static void Save_MAPE(void) uint size = MapSize(); uint i; - SlSetLength(size / 4); + SlSetLength(size); for (i = 0; i != size;) { - uint8 buf[1024]; + uint8 buf[4096]; uint j; - for (j = 0; j != lengthof(buf); j++) { - buf[j] = _m[i++].extra << 0; - buf[j] |= _m[i++].extra << 2; - buf[j] |= _m[i++].extra << 4; - buf[j] |= _m[i++].extra << 6; - } + for (j = 0; j != lengthof(buf); j++) buf[j] = _m[i++].extra; SlArray(buf, lengthof(buf), SLE_UINT8); } } |