Changeset - r2519:cc6e12810098
[Not reviewed]
master
0 3 0
tron - 19 years ago 2005-10-16 07:58:15
tron@openttd.org
(svn r3048) Replace 0/1/2 by RAILTYPE_RAIL/MONO/MAGLEV where appropriate
3 files changed with 15 insertions and 16 deletions:
0 comments (0 inline, 0 general)
engine_gui.c
Show inline comments
 
@@ -16,18 +16,15 @@
 

	
 

	
 
static StringID GetEngineCategoryName(EngineID engine)
 
{
 
	if (engine < NUM_TRAIN_ENGINES) {
 
		switch (GetEngine(engine)->railtype) {
 
			case 0:
 
				return STR_8102_RAILROAD_LOCOMOTIVE;
 
			case 1:
 
				return STR_8106_MONORAIL_LOCOMOTIVE;
 
			case 2:
 
				return STR_8107_MAGLEV_LOCOMOTIVE;
 
			case RAILTYPE_RAIL:   return STR_8102_RAILROAD_LOCOMOTIVE;
 
			case RAILTYPE_MONO:   return STR_8106_MONORAIL_LOCOMOTIVE;
 
			case RAILTYPE_MAGLEV: return STR_8107_MAGLEV_LOCOMOTIVE;
 
		}
 
	}
 

	
 
	if (engine < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES)
 
		return STR_8103_ROAD_VEHICLE;
 

	
train_cmd.c
Show inline comments
 
@@ -288,43 +288,43 @@ static int GetTrainAcceleration(Vehicle 
 
			incl -= u->u.rail.cached_veh_weight * 60;
 
		}
 
	}
 

	
 
	v->max_speed = max_speed;
 

	
 
	if (v->u.rail.railtype != 2) {
 
	if (v->u.rail.railtype != RAILTYPE_MAGLEV) {
 
		resistance = 13 * mass / 10;
 
		resistance += 60 * num;
 
		resistance += friction * mass * speed / 1000;
 
		resistance += (area * drag_coeff * speed * speed) / 10000;
 
	} else
 
		resistance = (area * (drag_coeff / 2) * speed * speed) / 10000;
 
	resistance += incl;
 
	resistance *= 4; //[N]
 

	
 
	if (speed > 0) {
 
		switch (v->u.rail.railtype) {
 
			case 0:
 
			case 1:
 
			case RAILTYPE_RAIL:
 
			case RAILTYPE_MONO:
 
				force = power / speed; //[N]
 
				force *= 22;
 
				force /= 10;
 
				break;
 

	
 
			case 2:
 
			case RAILTYPE_MAGLEV:
 
				force = power / 25;
 
				break;
 
		}
 
	} else {
 
		//"kickoff" acceleration
 
		force = (mass * 8) + resistance;
 
	}
 

	
 
	if (force <= 0) force = 10000;
 

	
 
	if (v->u.rail.railtype != 2) force = min(force, mass * 10 * 200);
 
	if (v->u.rail.railtype != RAILTYPE_MAGLEV) force = min(force, mass * 10 * 200);
 

	
 
	if (mode == AM_ACCEL) {
 
		return (force - resistance) / (mass * 4);
 
	} else {
 
		return min((-force - resistance) / (mass * 4), 10000 / (mass * 4));
 
	}
 
@@ -1740,13 +1740,13 @@ static void HandleLocomotiveSmokeCloud(V
 

	
 
	do {
 
		EngineID engtype = v->engine_type;
 

	
 
		// no smoke?
 
		if (RailVehInfo(engtype)->flags & 2 ||
 
				GetEngine(engtype)->railtype > 0 ||
 
				GetEngine(engtype)->railtype > RAILTYPE_RAIL ||
 
				(v->vehstatus & VS_HIDDEN) || (v->u.rail.track & 0xC0))
 
			continue;
 

	
 
		switch (RailVehInfo(engtype)->engclass) {
 
		case 0:
 
			// steam smoke.
 
@@ -1785,19 +1785,21 @@ static void TrainPlayLeaveStationSound(V
 
		SND_0A_TRAIN_HORN
 
	};
 

	
 
	EngineID engtype = v->engine_type;
 

	
 
	switch (GetEngine(engtype)->railtype) {
 
		case 0:
 
		case RAILTYPE_RAIL:
 
			SndPlayVehicleFx(sfx[RailVehInfo(engtype)->engclass], v);
 
			break;
 
		case 1:
 

	
 
		case RAILTYPE_MONO:
 
			SndPlayVehicleFx(SND_47_MAGLEV_2, v);
 
			break;
 
		case 2:
 

	
 
		case RAILTYPE_MAGLEV:
 
			SndPlayVehicleFx(SND_41_MAGLEV, v);
 
			break;
 
	}
 
}
 

	
 
static bool CheckTrainStayInDepot(Vehicle *v)
vehicle_gui.c
Show inline comments
 
@@ -172,13 +172,13 @@ void SortVehicleList(vehiclelist_d *vl)
 
}
 

	
 

	
 
/* General Vehicle GUI based procedures that are independent of vehicle types */
 
void InitializeVehiclesGuiList(void)
 
{
 
	_railtype_selected_in_replace_gui = 0;
 
	_railtype_selected_in_replace_gui = RAILTYPE_RAIL;
 
}
 

	
 
// draw the vehicle profit button in the vehicle list window.
 
void DrawVehicleProfitButton(const Vehicle *v, int x, int y)
 
{
 
	uint32 ormod;
0 comments (0 inline, 0 general)