Changeset - r1683:eccbfd1712c9
[Not reviewed]
master
0 1 0
tron - 20 years ago 2005-04-12 09:17:51
tron@openttd.org
(svn r2187) Implement a slightly better workaround than r1588 did. (Joint effort with Celestar)
1 file changed with 4 insertions and 2 deletions:
0 comments (0 inline, 0 general)
train_cmd.c
Show inline comments
 
@@ -182,14 +182,12 @@ static int GetTrainAcceleration(Vehicle 
 
		vmass += (_cargoc.weights[u->cargo_type] * u->cargo_count) / 16;
 
		mass += vmass; //[t]
 

	
 
		if (!IsTileType(u->tile, MP_TUNNELBRIDGE)) {
 
			if (HASBIT(u->u.rail.flags, VRF_GOINGUP)) {
 
				incl += vmass * 60;		//3% slope, quite a bit actually
 
			} else if (HASBIT(u->u.rail.flags, VRF_GOINGDOWN)) {
 
				incl -= vmass * 60;
 
			}
 
		}
 
	}
 

	
 

	
 
	// these are shown in the UI
 
@@ -2099,6 +2097,10 @@ static byte AfterSetTrainPos(Vehicle *v,
 
		CLRBIT(v->u.rail.flags, VRF_GOINGDOWN);
 

	
 
		if (new_z != old_z) {
 
			TileIndex tile = TILE_FROM_XY(v->x_pos, v->y_pos);
 

	
 
			// XXX workaround, whole UP/DOWN detection needs overhaul
 
			if (!IsTileType(tile, MP_TUNNELBRIDGE) || (_map5[tile] & 0x80) != 0)
 
			SETBIT(v->u.rail.flags, (new_z > old_z) ? VRF_GOINGUP : VRF_GOINGDOWN);
 
		}
 
	}
0 comments (0 inline, 0 general)