summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-06-02 13:05:41 +0000
committercelestar <celestar@openttd.org>2006-06-02 13:05:41 +0000
commit25a63ec7af6fadb2d33ef84f79597c14b10e7f39 (patch)
treed5df4e2831609eca45d7ea4558e09a600089ead2 /misc.c
parentd680fcec772d422b88ea4802add2e6195c6327a2 (diff)
downloadopenttd-25a63ec7af6fadb2d33ef84f79597c14b10e7f39.tar.xz
(svn r5070) Merged the bridge branch
-Feature: Bridges can now be placed above: Any railway track combination (excluding depots and waypoints) Any road combination (excluding depots) Clear tiles (duh), including fields Tunnel entrances Bridge heads Thanks to Tron for idea and implementation, KUDr for the yapf synchronization and many others for hours of testing There are still a number of visual problems remaining, especially when electric railways are on or under the bridge. DO NOT REPORT THOSE BUGS FOR THE TIME BEING please.
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/misc.c b/misc.c
index 71e9e25fa..689340d3d 100644
--- a/misc.c
+++ b/misc.c
@@ -859,16 +859,26 @@ static void Load_MAPE(void)
uint size = MapSize();
uint i;
- for (i = 0; i != size;) {
- uint8 buf[1024];
- uint j;
+ if (CheckSavegameVersion(29)) {
+ 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];
}
}
}
@@ -878,17 +888,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);
}
}