diff options
author | peter1138 <peter1138@openttd.org> | 2006-04-08 12:04:23 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-04-08 12:04:23 +0000 |
commit | 59ace676eb14b98a16688685d938c48569dbf236 (patch) | |
tree | ae74d349c3ffaa93a6e05ea9dabd121e4daf8e43 | |
parent | f3563e5d6fbc8fcf2d0df03d0a5e2f5b0c8ed33a (diff) | |
download | openttd-59ace676eb14b98a16688685d938c48569dbf236.tar.xz |
(svn r4322) - Codechange: Remove conversion of kmh to mph from gui code to within the units conversion system, in string.c. This means displaying kmh requires no conversion, instead of being convert from kmh to mph, and then back to kmh again.
-rw-r--r-- | aircraft_gui.c | 10 | ||||
-rw-r--r-- | bridge_gui.c | 2 | ||||
-rw-r--r-- | engine_gui.c | 8 | ||||
-rw-r--r-- | roadveh_gui.c | 10 | ||||
-rw-r--r-- | ship_gui.c | 10 | ||||
-rw-r--r-- | strings.c | 6 | ||||
-rw-r--r-- | train_gui.c | 16 |
7 files changed, 31 insertions, 31 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c index 60af41598..a2d11bdc3 100644 --- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -36,7 +36,7 @@ void DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number) /* Purchase cost - Max speed */ SetDParam(0, avi->base_cost * (_price.aircraft_base>>3)>>5); - SetDParam(1, avi->max_speed * 8); + SetDParam(1, avi->max_speed * 128 / 10); DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0); y += 10; @@ -333,7 +333,7 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e) /* Draw max speed */ { - SetDParam(0, v->max_speed * 8); + SetDParam(0, v->max_speed * 128 / 10); DrawString(2, 25, STR_A00E_MAX_SPEED, 0); } @@ -520,13 +520,13 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e) switch (v->current_order.type) { case OT_GOTO_STATION: { SetDParam(0, v->current_order.station); - SetDParam(1, v->cur_speed * 8); + SetDParam(1, v->cur_speed * 128 / 10); str = STR_HEADING_FOR_STATION + _patches.vehicle_speed; } break; case OT_GOTO_DEPOT: { SetDParam(0, v->current_order.station); - SetDParam(1, v->cur_speed * 8); + SetDParam(1, v->cur_speed * 128 / 10); str = STR_HEADING_FOR_HANGAR + _patches.vehicle_speed; } break; @@ -537,7 +537,7 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e) default: if (v->num_orders == 0) { str = STR_NO_ORDERS + _patches.vehicle_speed; - SetDParam(0, v->cur_speed * 8); + SetDParam(0, v->cur_speed * 128 / 10); } else { str = STR_EMPTY; } diff --git a/bridge_gui.c b/bridge_gui.c index 2913853a0..778c7b93a 100644 --- a/bridge_gui.c +++ b/bridge_gui.c @@ -50,7 +50,7 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e) const Bridge *b = &_bridge[_bridgedata.indexes[i + w->vscroll.pos]]; SetDParam(2, _bridgedata.costs[i + w->vscroll.pos]); - SetDParam(1, (b->speed >> 4) * 10); + SetDParam(1, b->speed); SetDParam(0, b->material); DrawSprite(b->sprite, 3, 15 + i * 22); diff --git a/engine_gui.c b/engine_gui.c index 88d975255..5769c45f6 100644 --- a/engine_gui.c +++ b/engine_gui.c @@ -129,7 +129,7 @@ static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw) uint multihead = (rvi->flags & RVI_MULTIHEAD) ? 1 : 0; SetDParam(0, (_price.build_railvehicle >> 3) * rvi->base_cost >> 5); - SetDParam(2, rvi->max_speed * 10 >> 4); + SetDParam(2, rvi->max_speed); SetDParam(3, rvi->power << multihead); SetDParam(1, rvi->weight << multihead); @@ -177,7 +177,7 @@ static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw) { const AircraftVehicleInfo *avi = AircraftVehInfo(engine); SetDParam(0, (_price.aircraft_base >> 3) * avi->base_cost >> 5); - SetDParam(1, avi->max_speed << 3); + SetDParam(1, avi->max_speed * 128 / 10); SetDParam(2, avi->passenger_capacity); SetDParam(3, avi->mail_capacity); SetDParam(4, avi->running_cost * _price.aircraft_running >> 8); @@ -217,7 +217,7 @@ static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw) const RoadVehicleInfo *rvi = RoadVehInfo(engine); SetDParam(0, (_price.roadveh_base >> 3) * rvi->base_cost >> 5); - SetDParam(1, rvi->max_speed * 10 >> 5); + SetDParam(1, rvi->max_speed / 2); SetDParam(2, rvi->running_cost * _price.roadveh_running >> 8); SetDParam(4, rvi->capacity); @@ -256,7 +256,7 @@ static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw) { const ShipVehicleInfo *svi = ShipVehInfo(engine); SetDParam(0, svi->base_cost * (_price.ship_base >> 3) >> 5); - SetDParam(1, svi->max_speed * 10 >> 5); + SetDParam(1, svi->max_speed / 2); SetDParam(2, _cargoc.names_long[svi->cargo_type]); SetDParam(3, svi->capacity); SetDParam(4, svi->running_cost * _price.ship_running >> 8); diff --git a/roadveh_gui.c b/roadveh_gui.c index 0d5344495..a5c4876c2 100644 --- a/roadveh_gui.c +++ b/roadveh_gui.c @@ -34,7 +34,7 @@ void DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number) /* Purchase cost - Max speed */ SetDParam(0, rvi->base_cost * (_price.roadveh_base>>3)>>5); - SetDParam(1, rvi->max_speed * 10 >> 5); + SetDParam(1, rvi->max_speed / 2); DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0); y += 10; @@ -101,7 +101,7 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e) /* Draw max speed */ { - SetDParam(0, v->max_speed * 10 >> 5); + SetDParam(0, v->max_speed / 2); DrawString(2, 25, STR_900E_MAX_SPEED, 0); } @@ -251,14 +251,14 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e) switch (v->current_order.type) { case OT_GOTO_STATION: { SetDParam(0, v->current_order.station); - SetDParam(1, v->cur_speed * 10 >> 5); + SetDParam(1, v->cur_speed / 2); str = STR_HEADING_FOR_STATION + _patches.vehicle_speed; } break; case OT_GOTO_DEPOT: { Depot *depot = GetDepot(v->current_order.station); SetDParam(0, depot->town_index); - SetDParam(1, v->cur_speed * 10 >> 5); + SetDParam(1, v->cur_speed / 2); str = STR_HEADING_FOR_ROAD_DEPOT + _patches.vehicle_speed; } break; @@ -270,7 +270,7 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e) default: if (v->num_orders == 0) { str = STR_NO_ORDERS + _patches.vehicle_speed; - SetDParam(0, v->cur_speed * 10 >> 5); + SetDParam(0, v->cur_speed / 2); } else str = STR_EMPTY; break; diff --git a/ship_gui.c b/ship_gui.c index d4b0c9dee..c724493e2 100644 --- a/ship_gui.c +++ b/ship_gui.c @@ -33,7 +33,7 @@ void DrawShipPurchaseInfo(int x, int y, EngineID engine_number) /* Purchase cost - Max speed */ SetDParam(0, svi->base_cost * (_price.ship_base>>3)>>5); - SetDParam(1, svi->max_speed * 10 >> 5); + SetDParam(1, svi->max_speed / 2); DrawString(x,y, STR_PURCHASE_INFO_COST_SPEED, 0); y += 10; @@ -179,7 +179,7 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e) /* Draw max speed */ { - SetDParam(0, v->max_speed * 10 >> 5); + SetDParam(0, v->max_speed / 2); DrawString(2, 25, STR_9813_MAX_SPEED, 0); } @@ -489,14 +489,14 @@ static void ShipViewWndProc(Window *w, WindowEvent *e) { switch (v->current_order.type) { case OT_GOTO_STATION: { SetDParam(0, v->current_order.station); - SetDParam(1, v->cur_speed * 10 >> 5); + SetDParam(1, v->cur_speed / 2); str = STR_HEADING_FOR_STATION + _patches.vehicle_speed; } break; case OT_GOTO_DEPOT: { Depot *depot = GetDepot(v->current_order.station); SetDParam(0, depot->town_index); - SetDParam(1, v->cur_speed * 10 >> 5); + SetDParam(1, v->cur_speed / 2); str = STR_HEADING_FOR_SHIP_DEPOT + _patches.vehicle_speed; } break; @@ -508,7 +508,7 @@ static void ShipViewWndProc(Window *w, WindowEvent *e) { default: if (v->num_orders == 0) { str = STR_NO_ORDERS + _patches.vehicle_speed; - SetDParam(0, v->cur_speed * 10 >> 5); + SetDParam(0, v->cur_speed / 2); } else str = STR_EMPTY; break; @@ -499,19 +499,19 @@ typedef struct Units { static const Units units[] = { { // Imperial (Original) - 1, 0, STR_UNITS_VELOCITY_IMPERIAL, + 10, 4, STR_UNITS_VELOCITY_IMPERIAL, 1, 0, STR_UNITS_POWER_IMPERIAL, 1, 0, STR_UNITS_WEIGHT_SHORT_METRIC, STR_UNITS_WEIGHT_LONG_METRIC, 1000, 0, STR_UNITS_VOLUME_SHORT_METRIC, STR_UNITS_VOLUME_LONG_METRIC, }, { // Metric - 1648, 10, STR_UNITS_VELOCITY_METRIC, + 1, 0, STR_UNITS_VELOCITY_METRIC, 1, 0, STR_UNITS_POWER_METRIC, 1, 0, STR_UNITS_WEIGHT_SHORT_METRIC, STR_UNITS_WEIGHT_LONG_METRIC, 1000, 0, STR_UNITS_VOLUME_SHORT_METRIC, STR_UNITS_VOLUME_LONG_METRIC, }, { // SI - 458, 10, STR_UNITS_VELOCITY_SI, + 284, 10, STR_UNITS_VELOCITY_SI, 764, 10, STR_UNITS_POWER_SI, 1000, 0, STR_UNITS_WEIGHT_SHORT_SI, STR_UNITS_WEIGHT_LONG_SI, 1000, 0, STR_UNITS_VOLUME_SHORT_SI, STR_UNITS_VOLUME_LONG_SI, diff --git a/train_gui.c b/train_gui.c index c65b899ff..dc6e0f7da 100644 --- a/train_gui.c +++ b/train_gui.c @@ -43,7 +43,7 @@ void DrawTrainEnginePurchaseInfo(int x, int y, EngineID engine_number) y += 10; /* Max speed - Engine power */ - SetDParam(0, rvi->max_speed * 10 >> 4); + SetDParam(0, rvi->max_speed); SetDParam(1, rvi->power << multihead); DrawString(x,y, STR_PURCHASE_INFO_SPEED_POWER, 0); y += 10; @@ -114,7 +114,7 @@ void DrawTrainWagonPurchaseInfo(int x, int y, EngineID engine_number) /* Wagon speed limit, displayed if above zero */ if (rvi->max_speed > 0 && _patches.wagon_speed_limits) { - SetDParam(0, rvi->max_speed * 10 >> 4); + SetDParam(0, rvi->max_speed); DrawString(x,y, STR_PURCHASE_INFO_SPEED, 0); y += 10; } @@ -932,7 +932,7 @@ static void TrainViewWndProc(Window *w, WindowEvent *e) if (v->u.rail.last_speed == 0) { str = STR_8861_STOPPED; } else { - SetDParam(0, v->u.rail.last_speed * 10 >> 4); + SetDParam(0, v->u.rail.last_speed); str = STR_TRAIN_STOPPING + _patches.vehicle_speed; } } else { @@ -940,14 +940,14 @@ static void TrainViewWndProc(Window *w, WindowEvent *e) case OT_GOTO_STATION: { str = STR_HEADING_FOR_STATION + _patches.vehicle_speed; SetDParam(0, v->current_order.station); - SetDParam(1, v->u.rail.last_speed * 10 >> 4); + SetDParam(1, v->u.rail.last_speed); } break; case OT_GOTO_DEPOT: { Depot *dep = GetDepot(v->current_order.station); SetDParam(0, dep->town_index); str = STR_HEADING_FOR_TRAIN_DEPOT + _patches.vehicle_speed; - SetDParam(1, v->u.rail.last_speed * 10 >> 4); + SetDParam(1, v->u.rail.last_speed); } break; case OT_LOADING: @@ -958,14 +958,14 @@ static void TrainViewWndProc(Window *w, WindowEvent *e) case OT_GOTO_WAYPOINT: { SetDParam(0, v->current_order.station); str = STR_HEADING_FOR_WAYPOINT + _patches.vehicle_speed; - SetDParam(1, v->u.rail.last_speed * 10 >> 4); + SetDParam(1, v->u.rail.last_speed); break; } default: if (v->num_orders == 0) { str = STR_NO_ORDERS + _patches.vehicle_speed; - SetDParam(0, v->u.rail.last_speed * 10 >> 4); + SetDParam(0, v->u.rail.last_speed); } else str = STR_EMPTY; break; @@ -1171,7 +1171,7 @@ static void DrawTrainDetailsWindow(Window *w) SetDParam(3, GetTrainRunningCost(v) >> 8); DrawString(x, 15, STR_885D_AGE_RUNNING_COST_YR, 0); - SetDParam(2, v->u.rail.cached_max_speed * 10 >> 4); + SetDParam(2, v->u.rail.cached_max_speed); SetDParam(1, v->u.rail.cached_power); SetDParam(0, v->u.rail.cached_weight); DrawString(x, 25, STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED, 0); |