src/engine_gui.cpp
branchgamebalance
changeset 9903 dc85aaa556ae
parent 9895 7bd07f43b0e3
equal deleted inserted replaced
9902:ed8f92929297 9903:dc85aaa556ae
   118 static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw)
   118 static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw)
   119 {
   119 {
   120 	const RailVehicleInfo *rvi = RailVehInfo(engine);
   120 	const RailVehicleInfo *rvi = RailVehInfo(engine);
   121 	uint multihead = (rvi->railveh_type == RAILVEH_MULTIHEAD) ? 1 : 0;
   121 	uint multihead = (rvi->railveh_type == RAILVEH_MULTIHEAD) ? 1 : 0;
   122 
   122 
   123 	SetDParam(0, (_price.build_railvehicle >> 3) * rvi->base_cost >> 5);
   123 	SetDParam(0, (_eco->GetPrice(CEconomy::BUILD_RAILVEHICLE) >> 3) * rvi->base_cost >> 5);
   124 	SetDParam(2, rvi->max_speed * 10 / 16);
   124 	SetDParam(2, rvi->max_speed * 10 / 16);
   125 	SetDParam(3, rvi->power << multihead);
   125 	SetDParam(3, rvi->power << multihead);
   126 	SetDParam(1, rvi->weight << multihead);
   126 	SetDParam(1, rvi->weight << multihead);
   127 
   127 
   128 	SetDParam(4, rvi->running_cost_base * _price.running_rail[rvi->running_cost_class] >> 8 << multihead);
   128 	uint32 cost_class;
       
   129 	switch (rvi->running_cost_class)
       
   130 	{
       
   131 		default:
       
   132 		case 0: cost_class = _eco->GetPrice(CEconomy::RUNNING_RAIL0); break;
       
   133 		case 1: cost_class = _eco->GetPrice(CEconomy::RUNNING_RAIL1); break;
       
   134 		case 2: cost_class = _eco->GetPrice(CEconomy::RUNNING_RAIL2); break;
       
   135 	}
       
   136 	SetDParam(4, rvi->running_cost_base * cost_class >> 8 << multihead);
   129 
   137 
   130 	if (rvi->capacity != 0) {
   138 	if (rvi->capacity != 0) {
   131 		SetDParam(5, rvi->cargo_type);
   139 		SetDParam(5, rvi->cargo_type);
   132 		SetDParam(6, rvi->capacity << multihead);
   140 		SetDParam(6, rvi->capacity << multihead);
   133 	} else {
   141 	} else {
   137 }
   145 }
   138 
   146 
   139 static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw)
   147 static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw)
   140 {
   148 {
   141 	const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
   149 	const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
   142 	SetDParam(0, (_price.aircraft_base >> 3) * avi->base_cost >> 5);
   150 	SetDParam(0, (_eco->GetPrice(CEconomy::AIRCRAFT_BASE) >> 3) * avi->base_cost >> 5);
   143 	SetDParam(1, avi->max_speed * 10 / 16);
   151 	SetDParam(1, avi->max_speed * 10 / 16);
   144 	SetDParam(2, avi->passenger_capacity);
   152 	SetDParam(2, avi->passenger_capacity);
   145 	SetDParam(3, avi->mail_capacity);
   153 	SetDParam(3, avi->mail_capacity);
   146 	SetDParam(4, avi->running_cost * _price.aircraft_running >> 8);
   154 	SetDParam(4, avi->running_cost * _eco->GetPrice(CEconomy::AIRCRAFT_RUNNING) >> 8);
   147 
   155 
   148 	DrawStringMultiCenter(x, y, STR_A02E_COST_MAX_SPEED_CAPACITY, maxw);
   156 	DrawStringMultiCenter(x, y, STR_A02E_COST_MAX_SPEED_CAPACITY, maxw);
   149 }
   157 }
   150 
   158 
   151 static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw)
   159 static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw)
   152 {
   160 {
   153 	const RoadVehicleInfo *rvi = RoadVehInfo(engine);
   161 	const RoadVehicleInfo *rvi = RoadVehInfo(engine);
   154 
   162 
   155 	SetDParam(0, (_price.roadveh_base >> 3) * rvi->base_cost >> 5);
   163 	SetDParam(0, (_eco->GetPrice(CEconomy::ROADVEH_BASE) >> 3) * rvi->base_cost >> 5);
   156 	SetDParam(1, rvi->max_speed * 10 / 32);
   164 	SetDParam(1, rvi->max_speed * 10 / 32);
   157 	SetDParam(2, rvi->running_cost * _price.roadveh_running >> 8);
   165 	SetDParam(2, rvi->running_cost * _eco->GetPrice(CEconomy::ROADVEH_RUNNING) >> 8);
   158 	SetDParam(3, rvi->cargo_type);
   166 	SetDParam(3, rvi->cargo_type);
   159 	SetDParam(4, rvi->capacity);
   167 	SetDParam(4, rvi->capacity);
   160 
   168 
   161 	DrawStringMultiCenter(x, y, STR_902A_COST_SPEED_RUNNING_COST, maxw);
   169 	DrawStringMultiCenter(x, y, STR_902A_COST_SPEED_RUNNING_COST, maxw);
   162 }
   170 }
   163 
   171 
   164 static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw)
   172 static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw)
   165 {
   173 {
   166 	const ShipVehicleInfo *svi = ShipVehInfo(engine);
   174 	const ShipVehicleInfo *svi = ShipVehInfo(engine);
   167 	SetDParam(0, svi->base_cost * (_price.ship_base >> 3) >> 5);
   175 	SetDParam(0, svi->base_cost * (_eco->GetPrice(CEconomy::SHIP_BASE) >> 3) >> 5);
   168 	SetDParam(1, svi->max_speed * 10 / 32);
   176 	SetDParam(1, svi->max_speed * 10 / 32);
   169 	SetDParam(2, svi->cargo_type);
   177 	SetDParam(2, svi->cargo_type);
   170 	SetDParam(3, svi->capacity);
   178 	SetDParam(3, svi->capacity);
   171 	SetDParam(4, svi->running_cost * _price.ship_running >> 8);
   179 	SetDParam(4, svi->running_cost * _eco->GetPrice(CEconomy::SHIP_RUNNING) >> 8);
   172 	DrawStringMultiCenter(x, y, STR_982E_COST_MAX_SPEED_CAPACITY, maxw);
   180 	DrawStringMultiCenter(x, y, STR_982E_COST_MAX_SPEED_CAPACITY, maxw);
   173 }
   181 }
   174 
   182 
   175 
   183 
   176 StringID GetNewsStringNewVehicleAvail(const NewsItem *ni)
   184 StringID GetNewsStringNewVehicleAvail(const NewsItem *ni)