Changeset - r9923:fd1b105946d0
[Not reviewed]
master
0 8 0
peter1138 - 16 years ago 2008-08-15 17:54:43
peter1138@openttd.org
(svn r14078) -Codechange: Rename *VehicleInfo::base_cost to cost_factor, indicating what it actually is.
8 files changed with 30 insertions and 30 deletions:
0 comments (0 inline, 0 general)
src/aircraft_cmd.cpp
Show inline comments
 
@@ -228,7 +228,7 @@ void GetAircraftSpriteSize(EngineID engi
 

	
 
static CommandCost EstimateAircraftCost(EngineID engine, const AircraftVehicleInfo *avi)
 
{
 
	return CommandCost(EXPENSES_NEW_VEHICLES, GetEngineProperty(engine, 0x0B, avi->base_cost) * (_price.aircraft_base >> 3) >> 5);
 
	return CommandCost(EXPENSES_NEW_VEHICLES, GetEngineProperty(engine, 0x0B, avi->cost_factor) * (_price.aircraft_base >> 3) >> 5);
 
}
 

	
 

	
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -135,8 +135,8 @@ static int CDECL EngineReliabilitySorter
 
/* Train sorting functions */
 
static int CDECL TrainEngineCostSorter(const void *a, const void *b)
 
{
 
	int va = RailVehInfo(*(const EngineID*)a)->base_cost;
 
	int vb = RailVehInfo(*(const EngineID*)b)->base_cost;
 
	int va = RailVehInfo(*(const EngineID*)a)->cost_factor;
 
	int vb = RailVehInfo(*(const EngineID*)b)->cost_factor;
 
	int r = va - vb;
 

	
 
	return _internal_sort_order ? -r : r;
 
@@ -223,8 +223,8 @@ static int CDECL TrainEnginesThenWagonsS
 
/* Road vehicle sorting functions */
 
static int CDECL RoadVehEngineCostSorter(const void *a, const void *b)
 
{
 
	int va = RoadVehInfo(*(const EngineID*)a)->base_cost;
 
	int vb = RoadVehInfo(*(const EngineID*)b)->base_cost;
 
	int va = RoadVehInfo(*(const EngineID*)a)->cost_factor;
 
	int vb = RoadVehInfo(*(const EngineID*)b)->cost_factor;
 
	int r = va - vb;
 

	
 
	return _internal_sort_order ? -r : r;
 
@@ -271,8 +271,8 @@ static int CDECL RoadVehEngineCapacitySo
 
/* Road vehicle sorting functions */
 
static int CDECL ShipEngineCostSorter(const void *a, const void *b)
 
{
 
	int va = ShipVehInfo(*(const EngineID*)a)->base_cost;
 
	int vb = ShipVehInfo(*(const EngineID*)b)->base_cost;
 
	int va = ShipVehInfo(*(const EngineID*)a)->cost_factor;
 
	int vb = ShipVehInfo(*(const EngineID*)b)->cost_factor;
 
	int r = va - vb;
 

	
 
	return _internal_sort_order ? -r : r;
 
@@ -317,8 +317,8 @@ static int CDECL ShipEngineCapacitySorte
 

	
 
static int CDECL AircraftEngineCostSorter(const void *a, const void *b)
 
{
 
	const int va = AircraftVehInfo(*(const EngineID*)a)->base_cost;
 
	const int vb = AircraftVehInfo(*(const EngineID*)b)->base_cost;
 
	const int va = AircraftVehInfo(*(const EngineID*)a)->cost_factor;
 
	const int vb = AircraftVehInfo(*(const EngineID*)b)->cost_factor;
 
	int r = va - vb;
 

	
 
	return _internal_sort_order ? -r : r;
 
@@ -486,7 +486,7 @@ static int DrawCargoCapacityInfo(int x, 
 
static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const RailVehicleInfo *rvi)
 
{
 
	/* Purchase cost */
 
	SetDParam(0, (GetEngineProperty(engine_number, 0x17, rvi->base_cost) * _price.build_railwagon) >> 8);
 
	SetDParam(0, (GetEngineProperty(engine_number, 0x17, rvi->cost_factor) * _price.build_railwagon) >> 8);
 
	DrawString(x, y, STR_PURCHASE_INFO_COST, TC_FROMSTRING);
 
	y += 10;
 

	
 
@@ -524,7 +524,7 @@ static int DrawRailEnginePurchaseInfo(in
 
	uint weight = GetEngineProperty(engine_number, 0x16, rvi->weight);
 

	
 
	/* Purchase Cost - Engine weight */
 
	SetDParam(0, GetEngineProperty(engine_number, 0x17, rvi->base_cost) * (_price.build_railvehicle >> 3) >> 5);
 
	SetDParam(0, GetEngineProperty(engine_number, 0x17, rvi->cost_factor) * (_price.build_railvehicle >> 3) >> 5);
 
	SetDParam(1, weight << multihead);
 
	DrawString(x, y, STR_PURCHASE_INFO_COST_WEIGHT, TC_FROMSTRING);
 
	y += 10;
 
@@ -566,7 +566,7 @@ static int DrawRoadVehPurchaseInfo(int x
 
	bool refittable = (EngInfo(engine_number)->refit_mask != 0);
 

	
 
	/* Purchase cost - Max speed */
 
	SetDParam(0, GetEngineProperty(engine_number, 0x11, rvi->base_cost) * (_price.roadveh_base >> 3) >> 5);
 
	SetDParam(0, GetEngineProperty(engine_number, 0x11, rvi->cost_factor) * (_price.roadveh_base >> 3) >> 5);
 
	SetDParam(1, rvi->max_speed * 10 / 32);
 
	DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING);
 
	y += 10;
 
@@ -584,7 +584,7 @@ static int DrawRoadVehPurchaseInfo(int x
 
static int DrawShipPurchaseInfo(int x, int y, EngineID engine_number, const ShipVehicleInfo *svi)
 
{
 
	/* Purchase cost - Max speed */
 
	SetDParam(0, GetEngineProperty(engine_number, 0x0A, svi->base_cost) * (_price.ship_base >> 3) >> 5);
 
	SetDParam(0, GetEngineProperty(engine_number, 0x0A, svi->cost_factor) * (_price.ship_base >> 3) >> 5);
 
	SetDParam(1, GetEngineProperty(engine_number, 0x0B, svi->max_speed) * 10 / 32);
 
	DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING);
 
	y += 10;
 
@@ -610,7 +610,7 @@ static int DrawAircraftPurchaseInfo(int 
 
	CargoID cargo;
 

	
 
	/* Purchase cost - Max speed */
 
	SetDParam(0, GetEngineProperty(engine_number, 0x0B, avi->base_cost) * (_price.aircraft_base >> 3) >> 5);
 
	SetDParam(0, GetEngineProperty(engine_number, 0x0B, avi->cost_factor) * (_price.aircraft_base >> 3) >> 5);
 
	SetDParam(1, avi->max_speed * 10 / 16);
 
	DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING);
 
	y += 10;
src/engine_gui.cpp
Show inline comments
 
@@ -135,7 +135,7 @@ static void DrawTrainEngineInfo(EngineID
 
	const RailVehicleInfo *rvi = RailVehInfo(engine);
 
	int multihead = (rvi->railveh_type == RAILVEH_MULTIHEAD) ? 1 : 0;
 

	
 
	SetDParam(0, (_price.build_railvehicle >> 3) * GetEngineProperty(engine, 0x17, rvi->base_cost) >> 5);
 
	SetDParam(0, (_price.build_railvehicle >> 3) * GetEngineProperty(engine, 0x17, rvi->cost_factor) >> 5);
 
	SetDParam(2, GetEngineProperty(engine, 0x09, rvi->max_speed) * 10 / 16);
 
	SetDParam(3, GetEngineProperty(engine, 0x0B, rvi->power));
 
	SetDParam(1, GetEngineProperty(engine, 0x16, rvi->weight) << multihead);
 
@@ -155,7 +155,7 @@ static void DrawTrainEngineInfo(EngineID
 
static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw)
 
{
 
	const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
 
	SetDParam(0, (_price.aircraft_base >> 3) * GetEngineProperty(engine, 0x0B, avi->base_cost) >> 5);
 
	SetDParam(0, (_price.aircraft_base >> 3) * GetEngineProperty(engine, 0x0B, avi->cost_factor) >> 5);
 
	SetDParam(1, avi->max_speed * 10 / 16);
 
	SetDParam(2, avi->passenger_capacity);
 
	SetDParam(3, avi->mail_capacity);
 
@@ -168,7 +168,7 @@ static void DrawRoadVehEngineInfo(Engine
 
{
 
	const RoadVehicleInfo *rvi = RoadVehInfo(engine);
 

	
 
	SetDParam(0, (_price.roadveh_base >> 3) * GetEngineProperty(engine, 0x11, rvi->base_cost) >> 5);
 
	SetDParam(0, (_price.roadveh_base >> 3) * GetEngineProperty(engine, 0x11, rvi->cost_factor) >> 5);
 
	SetDParam(1, rvi->max_speed * 10 / 32);
 
	SetDParam(2, rvi->running_cost * GetPriceByIndex(rvi->running_cost_class) >> 8);
 
	SetDParam(3, rvi->cargo_type);
 
@@ -180,7 +180,7 @@ static void DrawRoadVehEngineInfo(Engine
 
static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw)
 
{
 
	const ShipVehicleInfo *svi = ShipVehInfo(engine);
 
	SetDParam(0, GetEngineProperty(engine, 0x0A, svi->base_cost) * (_price.ship_base >> 3) >> 5);
 
	SetDParam(0, GetEngineProperty(engine, 0x0A, svi->cost_factor) * (_price.ship_base >> 3) >> 5);
 
	SetDParam(1, GetEngineProperty(engine, 0x0B, svi->max_speed) * 10 / 32);
 
	SetDParam(2, svi->cargo_type);
 
	SetDParam(3, GetEngineProperty(engine, 0x0D, svi->capacity));
src/engine_type.h
Show inline comments
 
@@ -36,7 +36,7 @@ enum EngineClass {
 
struct RailVehicleInfo {
 
	byte image_index;
 
	RailVehicleTypes railveh_type;
 
	byte base_cost;                 ///< Purchase cost factor;      For multiheaded engines the sum of both engine prices.
 
	byte cost_factor;               ///< Purchase cost factor;      For multiheaded engines the sum of both engine prices.
 
	RailTypeByte railtype;
 
	uint16 max_speed;
 
	uint16 power;                   ///< Power of engine;           For multiheaded engines the sum of both engine powers.
 
@@ -61,7 +61,7 @@ struct RailVehicleInfo {
 

	
 
struct ShipVehicleInfo {
 
	byte image_index;
 
	byte base_cost;
 
	byte cost_factor;
 
	uint16 max_speed;
 
	CargoID cargo_type;
 
	uint16 capacity;
 
@@ -81,7 +81,7 @@ enum {
 

	
 
struct AircraftVehicleInfo {
 
	byte image_index;
 
	byte base_cost;
 
	byte cost_factor;
 
	byte running_cost;
 
	byte subtype;
 
	SoundFxByte sfx;
 
@@ -93,7 +93,7 @@ struct AircraftVehicleInfo {
 

	
 
struct RoadVehicleInfo {
 
	byte image_index;
 
	byte base_cost;
 
	byte cost_factor;
 
	byte running_cost;
 
	byte running_cost_class;
 
	SoundFxByte sfx;
src/newgrf.cpp
Show inline comments
 
@@ -546,7 +546,7 @@ static bool RailVehicleChangeInfo(uint e
 
				break;
 

	
 
			case 0x17: // Cost factor
 
				rvi->base_cost = grf_load_byte(&buf);
 
				rvi->cost_factor = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x18: // AI rank
 
@@ -735,7 +735,7 @@ static bool RoadVehicleChangeInfo(uint e
 
			} break;
 

	
 
			case 0x11: // Cost factor
 
				rvi->base_cost = grf_load_byte(&buf); // ?? is it base_cost?
 
				rvi->cost_factor = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x12: // SFX
 
@@ -833,7 +833,7 @@ static bool ShipVehicleChangeInfo(uint e
 
				break;
 

	
 
			case 0x0A: // Cost factor
 
				svi->base_cost = grf_load_byte(&buf); // ?? is it base_cost?
 
				svi->cost_factor = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x0B: // Speed (1 unit is 0.5 kmh)
 
@@ -952,7 +952,7 @@ static bool AircraftVehicleChangeInfo(ui
 
				break;
 

	
 
			case 0x0B: // Cost factor
 
				avi->base_cost = grf_load_byte(&buf); // ?? is it base_cost?
 
				avi->cost_factor = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x0C: // Speed (1 unit is 8 mph, we translate to 1 unit is 1 km/h)
src/roadveh_cmd.cpp
Show inline comments
 
@@ -134,7 +134,7 @@ void DrawRoadVehEngine(int x, int y, Eng
 

	
 
static CommandCost EstimateRoadVehCost(EngineID engine_type)
 
{
 
	return CommandCost(EXPENSES_NEW_VEHICLES, ((_price.roadveh_base >> 3) * GetEngineProperty(engine_type, 0x11, RoadVehInfo(engine_type)->base_cost)) >> 5);
 
	return CommandCost(EXPENSES_NEW_VEHICLES, ((_price.roadveh_base >> 3) * GetEngineProperty(engine_type, 0x11, RoadVehInfo(engine_type)->cost_factor)) >> 5);
 
}
 

	
 
byte GetRoadVehLength(const Vehicle *v)
src/ship_cmd.cpp
Show inline comments
 
@@ -337,7 +337,7 @@ static bool ShipAccelerate(Vehicle *v)
 

	
 
static CommandCost EstimateShipCost(EngineID engine_type)
 
{
 
	return CommandCost(EXPENSES_NEW_VEHICLES, GetEngineProperty(engine_type, 0x0A, ShipVehInfo(engine_type)->base_cost) * (_price.ship_base >> 3) >> 5);
 
	return CommandCost(EXPENSES_NEW_VEHICLES, GetEngineProperty(engine_type, 0x0A, ShipVehInfo(engine_type)->cost_factor) * (_price.ship_base >> 3) >> 5);
 
}
 

	
 
static void ShipArrivesAt(const Vehicle* v, Station* st)
src/train_cmd.cpp
Show inline comments
 
@@ -610,7 +610,7 @@ void DrawTrainEngine(int x, int y, Engin
 
static CommandCost CmdBuildRailWagon(EngineID engine, TileIndex tile, uint32 flags)
 
{
 
	const RailVehicleInfo *rvi = RailVehInfo(engine);
 
	CommandCost value(EXPENSES_NEW_VEHICLES, (GetEngineProperty(engine, 0x17, rvi->base_cost) * _price.build_railwagon) >> 8);
 
	CommandCost value(EXPENSES_NEW_VEHICLES, (GetEngineProperty(engine, 0x17, rvi->cost_factor) * _price.build_railwagon) >> 8);
 

	
 
	uint num_vehicles = 1 + CountArticulatedParts(engine, false);
 

	
 
@@ -720,7 +720,7 @@ static void NormalizeTrainVehInDepot(con
 

	
 
static CommandCost EstimateTrainCost(EngineID engine, const RailVehicleInfo *rvi)
 
{
 
	return CommandCost(EXPENSES_NEW_VEHICLES, GetEngineProperty(engine, 0x17, rvi->base_cost) * (_price.build_railvehicle >> 3) >> 5);
 
	return CommandCost(EXPENSES_NEW_VEHICLES, GetEngineProperty(engine, 0x17, rvi->cost_factor) * (_price.build_railvehicle >> 3) >> 5);
 
}
 

	
 
static void AddRearEngineToMultiheadedTrain(Vehicle *v, Vehicle *u, bool building)
0 comments (0 inline, 0 general)