(svn r22850) -Feature: Display separate ocean and canal speeds in the ship purchase list, if they differ.

This commit is contained in:
frosch 2011-08-27 10:34:31 +00:00
parent e157a23056
commit 8a9b68d964
2 changed files with 22 additions and 3 deletions

View File

@ -666,10 +666,27 @@ static int DrawShipPurchaseInfo(int left, int right, int y, EngineID engine_numb
const Engine *e = Engine::Get(engine_number);
/* Purchase cost - Max speed */
uint raw_speed = e->GetDisplayMaxSpeed();
uint ocean_speed = e->u.ship.ApplyWaterClassSpeedFrac(raw_speed, true);
uint canal_speed = e->u.ship.ApplyWaterClassSpeedFrac(raw_speed, false);
SetDParam(0, e->GetCost());
SetDParam(1, e->GetDisplayMaxSpeed());
DrawString(left, right, y, STR_PURCHASE_INFO_COST_SPEED);
y += FONT_HEIGHT_NORMAL;
if (ocean_speed == canal_speed) {
SetDParam(1, ocean_speed);
DrawString(left, right, y, STR_PURCHASE_INFO_COST_SPEED);
y += FONT_HEIGHT_NORMAL;
} else {
DrawString(left, right, y, STR_PURCHASE_INFO_COST);
y += FONT_HEIGHT_NORMAL;
SetDParam(0, ocean_speed);
DrawString(left, right, y, STR_PURCHASE_INFO_SPEED_OCEAN);
y += FONT_HEIGHT_NORMAL;
SetDParam(0, canal_speed);
DrawString(left, right, y, STR_PURCHASE_INFO_SPEED_CANAL);
y += FONT_HEIGHT_NORMAL;
}
/* Cargo type + capacity */
SetDParam(0, e->GetDefaultCargoType());

View File

@ -2836,6 +2836,8 @@ STR_BUY_VEHICLE_AIRCRAFT_CAPTION :New Aircraft
STR_PURCHASE_INFO_COST_WEIGHT :{BLACK}Cost: {GOLD}{CURRENCY}{BLACK} Weight: {GOLD}{WEIGHT_S}
STR_PURCHASE_INFO_SPEED_POWER :{BLACK}Speed: {GOLD}{VELOCITY}{BLACK} Power: {GOLD}{POWER}
STR_PURCHASE_INFO_SPEED :{BLACK}Speed: {GOLD}{VELOCITY}
STR_PURCHASE_INFO_SPEED_OCEAN :{BLACK}Speed on ocean: {GOLD}{VELOCITY}
STR_PURCHASE_INFO_SPEED_CANAL :{BLACK}Speed on canal/river: {GOLD}{VELOCITY}
STR_PURCHASE_INFO_RUNNINGCOST :{BLACK}Running Cost: {GOLD}{CURRENCY}/yr
STR_PURCHASE_INFO_CAPACITY :{BLACK}Capacity: {GOLD}{CARGO} {STRING}
STR_PURCHASE_INFO_REFITTABLE :(refittable)