# HG changeset patch # User rubidium # Date 1189337029 0 # Node ID 72c3e2bc6429872e7a17f362974d216fb8e28294 # Parent be5076cc40ef49b120e1d769a737d3e1efc03deb (svn r11068) -Codechange: remove Vehicle::HasFront as all vehicles have the Vehicle::first pointer correctly set. diff -r be5076cc40ef -r 72c3e2bc6429 src/depot_gui.cpp --- a/src/depot_gui.cpp Sun Sep 09 10:34:32 2007 +0000 +++ b/src/depot_gui.cpp Sun Sep 09 11:23:49 2007 +0000 @@ -474,7 +474,7 @@ if (v == NULL) return; - if (v->HasFront() && !v->IsPrimaryVehicle()) { + if (!v->IsPrimaryVehicle()) { v = v->First(); /* Do nothing when clicking on a train in depot with no loc attached */ if (v->type == VEH_TRAIN && !IsFrontEngine(v)) return; diff -r be5076cc40ef -r 72c3e2bc6429 src/group_cmd.cpp --- a/src/group_cmd.cpp Sun Sep 09 10:34:32 2007 +0000 +++ b/src/group_cmd.cpp Sun Sep 09 11:23:49 2007 +0000 @@ -354,7 +354,7 @@ */ void RemoveVehicleFromGroup(const Vehicle *v) { - if (!v->IsValid() || !(v->HasFront() && v->IsPrimaryVehicle())) return; + if (!v->IsValid() || !v->IsPrimaryVehicle()) return; if (!IsDefaultGroupID(v->group_id)) DecreaseGroupNumVehicle(v->group_id); } diff -r be5076cc40ef -r 72c3e2bc6429 src/newgrf_engine.cpp --- a/src/newgrf_engine.cpp Sun Sep 09 10:34:32 2007 +0000 +++ b/src/newgrf_engine.cpp Sun Sep 09 11:23:49 2007 +0000 @@ -509,8 +509,6 @@ switch (variable) { case 0x40: // Get length of consist case 0x41: // Get length of same consecutive wagons - if (!v->HasFront()) return 1; - { const Vehicle* u; byte chain_before = 0; @@ -832,7 +830,7 @@ res->ResolveReal = &VehicleResolveReal; res->u.vehicle.self = v; - res->u.vehicle.parent = (v != NULL && v->HasFront()) ? v->First() : v; + res->u.vehicle.parent = (v != NULL) ? v->First() : v; res->u.vehicle.self_type = engine_type; diff -r be5076cc40ef -r 72c3e2bc6429 src/order_gui.cpp --- a/src/order_gui.cpp Sun Sep 09 10:34:32 2007 +0000 +++ b/src/order_gui.cpp Sun Sep 09 11:23:49 2007 +0000 @@ -355,7 +355,7 @@ { if (u->type != v->type) return false; - if (u->HasFront() && !u->IsPrimaryVehicle()) { + if (!u->IsPrimaryVehicle()) { u = u->First(); if (!u->IsPrimaryVehicle()) return false; } diff -r be5076cc40ef -r 72c3e2bc6429 src/roadveh.h --- a/src/roadveh.h Sun Sep 09 10:34:32 2007 +0000 +++ b/src/roadveh.h Sun Sep 09 11:23:49 2007 +0000 @@ -69,7 +69,6 @@ ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_ROADVEH_INC : EXPENSES_ROADVEH_RUN; } WindowClass GetVehicleListWindowClass() const { return WC_ROADVEH_LIST; } bool IsPrimaryVehicle() const { return IsRoadVehFront(this); } - bool HasFront() const { return true; } int GetImage(Direction direction) const; int GetDisplaySpeed() const { return this->cur_speed * 10 / 32; } int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 32; } diff -r be5076cc40ef -r 72c3e2bc6429 src/train.h --- a/src/train.h Sun Sep 09 10:34:32 2007 +0000 +++ b/src/train.h Sun Sep 09 11:23:49 2007 +0000 @@ -296,7 +296,6 @@ WindowClass GetVehicleListWindowClass() const { return WC_TRAINS_LIST; } void PlayLeaveStationSound() const; bool IsPrimaryVehicle() const { return IsFrontEngine(this); } - bool HasFront() const { return true; } int GetImage(Direction direction) const; int GetDisplaySpeed() const { return this->u.rail.last_speed * 10 / 16; } int GetDisplayMaxSpeed() const { return this->u.rail.cached_max_speed * 10 / 16; } diff -r be5076cc40ef -r 72c3e2bc6429 src/tunnelbridge_cmd.cpp --- a/src/tunnelbridge_cmd.cpp Sun Sep 09 10:34:32 2007 +0000 +++ b/src/tunnelbridge_cmd.cpp Sun Sep 09 11:23:49 2007 +0000 @@ -1369,7 +1369,7 @@ } else if (IsBridge(tile)) { // XXX is this necessary? DiagDirection dir; - if (v->HasFront() && v->IsPrimaryVehicle()) { + if (v->IsPrimaryVehicle()) { /* modify speed of vehicle */ uint16 spd = _bridge[GetBridgeType(tile)].speed; diff -r be5076cc40ef -r 72c3e2bc6429 src/vehicle.h --- a/src/vehicle.h Sun Sep 09 10:34:32 2007 +0000 +++ b/src/vehicle.h Sun Sep 09 11:23:49 2007 +0000 @@ -421,12 +421,6 @@ virtual bool IsPrimaryVehicle() const { return false; } /** - * Whether this vehicle understands the concept of a front engine, so - * basically, if GetFirstVehicleInChain() can be called for it. - */ - virtual bool HasFront() const { return false; } - - /** * Gets the sprite to show for the given direction * @param direction the direction the vehicle is facing * @return the sprite for the given vehicle in the given direction