Changeset - r1236:8463117fb763
[Not reviewed]
master
0 1 0
celestar - 20 years ago 2005-01-30 19:51:39
celestar@openttd.org
(svn r1740) -Fix: [ 1112342 ] Realistic acceleration works properly with TTDPatch non-stop handling behaviour
1 file changed with 20 insertions and 1 deletions:
0 comments (0 inline, 0 general)
train_cmd.c
Show inline comments
 
@@ -59,12 +59,31 @@ static const byte _curve_neighbours90[8]
 

	
 
enum AccelType {
 
	AM_ACCEL,
 
	AM_BRAKE
 
};
 

	
 
static bool TrainShouldStop(Vehicle *v, TileIndex tile)
 
{
 
	Order *o = &v->current_order;
 
	assert(v->type == VEH_Train);
 
	assert(IsTileType(v->tile, MP_STATION));
 
	//When does a train drive through a station
 
	//first we deal with the "new nonstop handling"
 
	if ( _patches.new_nonstop && o->flags & OF_NON_STOP && _map2[tile] == o->station )
 
		return false;
 

	
 
	if (v->last_station_visited == _map2[tile])
 
		return false;
 

	
 
	if ( _map2[tile] != o->station && (o->flags & OF_NON_STOP || _patches.new_nonstop))
 
		return false;
 

	
 
	return true;
 
}
 

	
 
//new acceleration
 
static int GetTrainAcceleration(Vehicle *v, bool mode)
 
{
 
	Vehicle *u = v;
 
	int num = 0;	//number of vehicles, change this into the number of axles later
 
	int power = 0;
 
@@ -134,13 +153,13 @@ static int GetTrainAcceleration(Vehicle 
 

	
 
	if (IsTileType(v->tile, MP_STATION) && v->subtype == TS_Front_Engine) {
 
		static const TileIndexDiffC _station_dir_from_vdir[] = {
 
			{0, 0}, {-1, 0}, {0, 0}, {0, 1}, {0, 0}, {1, 0}, {0, 0}, {0, -1}
 
		};
 

	
 
		if (((v->current_order.station == _map2[v->tile]) || !(v->current_order.flags & OF_NON_STOP)) && v->last_station_visited != _map2[v->tile]) {
 
		if (TrainShouldStop(v, v->tile)) {
 
			int station_length = 0;
 
			TileIndex tile = v->tile;
 
			int delta_v;
 

	
 
			max_speed = 120;
 
			do {
0 comments (0 inline, 0 general)