(svn r23074) -Codechange: Add Vehicle::GetEngine() to simplify code.

This commit is contained in:
frosch
2011-11-01 00:21:08 +00:00
parent c366e0d45f
commit 72cd855978
13 changed files with 45 additions and 33 deletions

View File

@@ -217,8 +217,8 @@ static const uint MAX_REFIT_CYCLE = 256;
*/
byte GetBestFittingSubType(Vehicle *v_from, Vehicle *v_for)
{
const Engine *e_from = Engine::Get(v_from->engine_type);
const Engine *e_for = Engine::Get(v_for->engine_type);
const Engine *e_from = v_from->GetEngine();
const Engine *e_for = v_for->GetEngine();
/* If one them doesn't carry cargo, there's no need to find a sub type */
if (!e_from->CanCarryCargo() || !e_for->CanCarryCargo()) return 0;
@@ -386,7 +386,7 @@ struct RefitWindow : public Window {
do {
if (v->type == VEH_TRAIN && !vehicles_to_refit.Contains(v->index)) continue;
const Engine *e = Engine::Get(v->engine_type);
const Engine *e = v->GetEngine();
uint32 cmask = e->info.refit_mask;
byte callback_mask = e->info.callback_mask;