mirror of https://github.com/OpenTTD/OpenTTD
(svn r21195) -Fix [FS#4230] (r21135): in some corner cases the savegame conversion didn't do the right thing
parent
c370f56bf3
commit
d572100585
|
@ -2346,10 +2346,18 @@ bool AfterLoadGame()
|
||||||
byte frame = (vdir == DIAGDIR_NE || vdir == DIAGDIR_NW) ? TILE_SIZE - 1 - pos : pos;
|
byte frame = (vdir == DIAGDIR_NE || vdir == DIAGDIR_NW) ? TILE_SIZE - 1 - pos : pos;
|
||||||
extern const byte _tunnel_visibility_frame[DIAGDIR_END];
|
extern const byte _tunnel_visibility_frame[DIAGDIR_END];
|
||||||
|
|
||||||
if (dir == vdir && !(v->vehstatus & VS_HIDDEN)) {
|
/* Should the vehicle be hidden or not? */
|
||||||
if (frame < _tunnel_visibility_frame[dir]) continue;
|
bool hidden;
|
||||||
/* Tunnel entrance, make us invisible. */
|
if (dir == vdir) { // Entering tunnel
|
||||||
v->tile = vtile;
|
hidden = frame >= _tunnel_visibility_frame[dir];
|
||||||
|
} else if (dir == ReverseDiagDir(vdir)) { // Leaving tunnel
|
||||||
|
hidden = frame < TILE_SIZE - _tunnel_visibility_frame[dir];
|
||||||
|
} else { // Something freaky going on?
|
||||||
|
NOT_REACHED();
|
||||||
|
}
|
||||||
|
v->tile = vtile;
|
||||||
|
|
||||||
|
if (hidden) {
|
||||||
v->vehstatus |= VS_HIDDEN;
|
v->vehstatus |= VS_HIDDEN;
|
||||||
|
|
||||||
switch (v->type) {
|
switch (v->type) {
|
||||||
|
@ -2357,10 +2365,7 @@ bool AfterLoadGame()
|
||||||
case VEH_ROAD: RoadVehicle::From(v)->state = RVSB_WORMHOLE; break;
|
case VEH_ROAD: RoadVehicle::From(v)->state = RVSB_WORMHOLE; break;
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
}
|
}
|
||||||
} else if (dir == ReverseDiagDir(vdir) && (v->vehstatus & VS_HIDDEN)) {
|
} else {
|
||||||
if (frame < TILE_SIZE - _tunnel_visibility_frame[dir]) continue;
|
|
||||||
/* Tunnel exit, make us visible again. */
|
|
||||||
v->tile = vtile;
|
|
||||||
v->vehstatus &= ~VS_HIDDEN;
|
v->vehstatus &= ~VS_HIDDEN;
|
||||||
|
|
||||||
switch (v->type) {
|
switch (v->type) {
|
||||||
|
|
Loading…
Reference in New Issue