Index: src/build_vehicle_gui.cpp =================================================================== --- src/build_vehicle_gui.cpp (revision 15341) +++ src/build_vehicle_gui.cpp (working copy) @@ -476,9 +476,16 @@ { const Engine *e = GetEngine(engine_number); + CompanyID company = (CompanyID)_local_company; + const Company *c = GetCompany(company); + /* Purchase cost */ SetDParam(0, e->GetCost()); - DrawString(x, y, STR_PURCHASE_INFO_COST, TC_FROMSTRING); + + if (c->money >= e->GetCost()) + DrawString(x, y, STR_PURCHASE_INFO_COST, TC_FROMSTRING); + else + DrawString(x, y, STR_PURCHASE_INFO_COST_RED, TC_FROMSTRING); y += 10; /* Wagon weight - (including cargo) */ @@ -514,10 +521,16 @@ const Engine *e = GetEngine(engine_number); uint weight = e->GetDisplayWeight(); + CompanyID company = (CompanyID)_local_company; + const Company *c = GetCompany(company); + /* Purchase Cost - Engine weight */ SetDParam(0, e->GetCost()); SetDParam(1, weight); - DrawString(x, y, STR_PURCHASE_INFO_COST_WEIGHT, TC_FROMSTRING); + if (c->money >= e->GetCost()) + DrawString(x, y, STR_PURCHASE_INFO_COST_WEIGHT, TC_FROMSTRING); + else + DrawString(x, y, STR_PURCHASE_INFO_COST_WEIGHT_RED, TC_FROMSTRING); y += 10; /* Max speed - Engine power */ @@ -556,10 +569,16 @@ { const Engine *e = GetEngine(engine_number); + CompanyID company = (CompanyID)_local_company; + const Company *c = GetCompany(company); + /* Purchase cost - Max speed */ SetDParam(0, e->GetCost()); SetDParam(1, e->GetDisplayMaxSpeed()); - DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING); + if (c->money >= e->GetCost()) + DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING); + else + DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED_RED, TC_FROMSTRING); y += 10; /* Running cost */ @@ -576,10 +595,16 @@ { const Engine *e = GetEngine(engine_number); + CompanyID company = (CompanyID)_local_company; + const Company *c = GetCompany(company); + /* Purchase cost - Max speed */ SetDParam(0, e->GetCost()); SetDParam(1, e->GetDisplayMaxSpeed()); - DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING); + if (c->money >= e->GetCost()) + DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING); + else + DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED_RED, TC_FROMSTRING); y += 10; /* Cargo type + capacity */ @@ -603,10 +628,16 @@ CargoID cargo; const Engine *e = GetEngine(engine_number); + CompanyID company = (CompanyID)_local_company; + const Company *c = GetCompany(company); + /* Purchase cost - Max speed */ SetDParam(0, e->GetCost()); SetDParam(1, e->GetDisplayMaxSpeed()); - DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING); + if (c->money >= e->GetCost()) + DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, TC_FROMSTRING); + else + DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED_RED, TC_FROMSTRING); y += 10; /* Cargo capacity */ @@ -1065,6 +1096,7 @@ break; } } + this->SetDirty(); break; } @@ -1177,6 +1209,12 @@ this->vscroll.cap += delta.y / (int)GetVehicleListHeight(this->vehicle_type); this->widget[BUILD_VEHICLE_WIDGET_LIST].data = (this->vscroll.cap << 8) + 1; } + + virtual void OnHundredthTick() + { + /* redraw the window every now and then */ + this->SetDirty(); + } }; static const WindowDesc _build_vehicle_desc = { @@ -1200,3 +1238,4 @@ new BuildVehicleWindow(&_build_vehicle_desc, tile, type); } + Index: src/lang/english.txt =================================================================== --- src/lang/english.txt (revision 15341) +++ src/lang/english.txt (working copy) @@ -3421,6 +3421,7 @@ STR_TINY_BLACK :{BLACK}{TINYFONT}{COMMA} STR_PURCHASE_INFO_COST_WEIGHT :{BLACK}Cost: {GOLD}{CURRENCY}{BLACK} Weight: {GOLD}{WEIGHT_S} +STR_PURCHASE_INFO_COST_WEIGHT_RED :{BLACK}Cost: {RED}{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_RUNNINGCOST :{BLACK}Running Cost: {GOLD}{CURRENCY}/yr @@ -3428,8 +3429,10 @@ STR_PURCHASE_INFO_DESIGNED_LIFE :{BLACK}Designed: {GOLD}{NUM}{BLACK} Life: {GOLD}{COMMA} years STR_PURCHASE_INFO_RELIABILITY :{BLACK}Max. Reliability: {GOLD}{COMMA}% STR_PURCHASE_INFO_COST :{BLACK}Cost: {GOLD}{CURRENCY} +STR_PURCHASE_INFO_COST_RED :{BLACK}Cost: {RED}{CURRENCY} STR_PURCHASE_INFO_WEIGHT_CWEIGHT :{BLACK}Weight: {GOLD}{WEIGHT_S} ({WEIGHT_S}) STR_PURCHASE_INFO_COST_SPEED :{BLACK}Cost: {GOLD}{CURRENCY}{BLACK} Speed: {GOLD}{VELOCITY} +STR_PURCHASE_INFO_COST_SPEED_RED :{BLACK}Cost: {RED}{CURRENCY}{BLACK} Speed: {GOLD}{VELOCITY} STR_PURCHASE_INFO_AIRCRAFT_CAPACITY :{BLACK}Capacity: {GOLD}{COMMA} passengers, {COMMA} bags of mail STR_PURCHASE_INFO_PWAGPOWER_PWAGWEIGHT :{BLACK}Powered Wagons: {GOLD}+{POWER}{BLACK} Weight: {GOLD}+{WEIGHT_S} STR_PURCHASE_INFO_REFITTABLE_TO :{BLACK}Refittable to: {GOLD}