summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ai/default/default.cpp26
-rw-r--r--src/ai/trolly/trolly.cpp14
-rw-r--r--src/aircraft.h4
-rw-r--r--src/aircraft_cmd.cpp28
-rw-r--r--src/autoreplace_gui.cpp22
-rw-r--r--src/build_vehicle_gui.cpp82
-rw-r--r--src/console_cmds.cpp2
-rw-r--r--src/depot_gui.cpp150
-rw-r--r--src/disaster_cmd.cpp10
-rw-r--r--src/economy.cpp42
-rw-r--r--src/elrail.cpp4
-rw-r--r--src/engine.cpp14
-rw-r--r--src/engine.h2
-rw-r--r--src/engine_gui.cpp8
-rw-r--r--src/main_gui.cpp24
-rw-r--r--src/network/network_server.cpp12
-rw-r--r--src/newgrf.cpp8
-rw-r--r--src/newgrf_engine.cpp24
-rw-r--r--src/npf.cpp2
-rw-r--r--src/oldloader.cpp16
-rw-r--r--src/openttd.cpp16
-rw-r--r--src/order_cmd.cpp58
-rw-r--r--src/order_gui.cpp34
-rw-r--r--src/player_gui.cpp8
-rw-r--r--src/players.cpp6
-rw-r--r--src/rail_cmd.cpp8
-rw-r--r--src/road_cmd.cpp6
-rw-r--r--src/roadveh.h2
-rw-r--r--src/roadveh_cmd.cpp28
-rw-r--r--src/settings_gui.cpp2
-rw-r--r--src/ship.h2
-rw-r--r--src/ship_cmd.cpp20
-rw-r--r--src/smallmap_gui.cpp2
-rw-r--r--src/station.cpp4
-rw-r--r--src/station_cmd.cpp12
-rw-r--r--src/station_gui.cpp8
-rw-r--r--src/train_cmd.cpp64
-rw-r--r--src/train_gui.cpp2
-rw-r--r--src/tunnelbridge_cmd.cpp14
-rw-r--r--src/vehicle.cpp246
-rw-r--r--src/vehicle.h26
-rw-r--r--src/vehicle_gui.cpp110
-rw-r--r--src/vehicle_gui.h10
-rw-r--r--src/water_cmd.cpp6
-rw-r--r--src/yapf/follow_track.hpp2
-rw-r--r--src/yapf/yapf_costrail.hpp2
46 files changed, 596 insertions, 596 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index 8784b6f36..20aa5d1e9 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -93,12 +93,12 @@ static void AiStateVehLoop(Player *p)
FOR_ALL_VEHICLES_FROM(v, index) {
if (v->owner != _current_player) continue;
- if ((v->type == VEH_Train && v->subtype == 0) ||
- v->type == VEH_Road ||
- (v->type == VEH_Aircraft && IsNormalAircraft(v)) ||
- v->type == VEH_Ship) {
+ if ((v->type == VEH_TRAIN && v->subtype == 0) ||
+ v->type == VEH_ROAD ||
+ (v->type == VEH_AIRCRAFT && IsNormalAircraft(v)) ||
+ v->type == VEH_SHIP) {
/* replace engine? */
- if (v->type == VEH_Train && v->engine_type < 3 &&
+ if (v->type == VEH_TRAIN && v->engine_type < 3 &&
(_price.build_railvehicle >> 3) < p->player_money) {
p->ai.state = AIS_VEH_CHECK_REPLACE_VEHICLE;
p->ai.cur_veh = v;
@@ -427,8 +427,8 @@ static void AiStateCheckReplaceVehicle(Player *p)
if (!IsValidVehicle(v) ||
v->owner != _current_player ||
- v->type > VEH_Ship ||
- _veh_check_replace_proc[v->type - VEH_Train](p, v) == INVALID_ENGINE) {
+ v->type > VEH_SHIP ||
+ _veh_check_replace_proc[v->type - VEH_TRAIN](p, v) == INVALID_ENGINE) {
p->ai.state = AIS_VEH_LOOP;
} else {
p->ai.state_counter = 0;
@@ -443,7 +443,7 @@ static void AiStateDoReplaceVehicle(Player *p)
p->ai.state = AIS_VEH_LOOP;
// vehicle is not owned by the player anymore, something went very wrong.
if (!IsValidVehicle(v) || v->owner != _current_player) return;
- _veh_do_replace_proc[v->type - VEH_Train](p);
+ _veh_do_replace_proc[v->type - VEH_TRAIN](p);
}
struct FoundRoute {
@@ -3515,7 +3515,7 @@ static void AiStateSellVeh(Player *p)
Vehicle *v = p->ai.cur_veh;
if (v->owner == _current_player) {
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
if (!IsTileDepotType(v->tile, TRANSPORT_RAIL) || v->u.rail.track != 0x80 || !(v->vehstatus&VS_STOPPED)) {
if (v->current_order.type != OT_GOTO_DEPOT)
@@ -3526,7 +3526,7 @@ static void AiStateSellVeh(Player *p)
// Sell whole train
DoCommand(v->tile, v->index, 1, DC_EXEC, CMD_SELL_RAIL_WAGON);
- } else if (v->type == VEH_Road) {
+ } else if (v->type == VEH_ROAD) {
if (!IsRoadVehInDepotStopped(v)) {
if (v->current_order.type != OT_GOTO_DEPOT)
DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_ROADVEH_TO_DEPOT);
@@ -3534,7 +3534,7 @@ static void AiStateSellVeh(Player *p)
}
DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH);
- } else if (v->type == VEH_Aircraft) {
+ } else if (v->type == VEH_AIRCRAFT) {
if (!IsAircraftInHangarStopped(v)) {
if (v->current_order.type != OT_GOTO_DEPOT)
DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR);
@@ -3542,9 +3542,9 @@ static void AiStateSellVeh(Player *p)
}
DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_AIRCRAFT);
- } else if (v->type == VEH_Ship) {
+ } else if (v->type == VEH_SHIP) {
// XXX: not implemented
- error("!v->type == VEH_Ship");
+ error("!v->type == VEH_SHIP");
}
}
diff --git a/src/ai/trolly/trolly.cpp b/src/ai/trolly/trolly.cpp
index 855f74c8f..bb1357c6d 100644
--- a/src/ai/trolly/trolly.cpp
+++ b/src/ai/trolly/trolly.cpp
@@ -126,7 +126,7 @@ static void AiNew_State_WakeUp(Player *p)
p->ainew.last_vehiclecheck_date = _date;
} else if (c < 100 && !_patches.ai_disable_veh_roadveh) {
// Do we have any spots for road-vehicles left open?
- if (GetFreeUnitNumber(VEH_Road) <= _patches.max_roadveh) {
+ if (GetFreeUnitNumber(VEH_ROAD) <= _patches.max_roadveh) {
if (c < 85) {
p->ainew.action = AI_ACTION_TRUCK_ROUTE;
} else {
@@ -135,7 +135,7 @@ static void AiNew_State_WakeUp(Player *p)
}
#if 0
} else if (c < 200 && !_patches.ai_disable_veh_train) {
- if (GetFreeUnitNumber(VEH_Train) <= _patches.max_trains) {
+ if (GetFreeUnitNumber(VEH_TRAIN) <= _patches.max_trains) {
p->ainew.action = AI_ACTION_TRAIN_ROUTE;
}
#endif
@@ -173,7 +173,7 @@ static void AiNew_State_WakeUp(Player *p)
// to build the route anyway..
if (p->ainew.action == AI_ACTION_BUS_ROUTE &&
money > AI_MINIMUM_BUS_ROUTE_MONEY) {
- if (GetFreeUnitNumber(VEH_Road) > _patches.max_roadveh) {
+ if (GetFreeUnitNumber(VEH_ROAD) > _patches.max_roadveh) {
p->ainew.action = AI_ACTION_NONE;
return;
}
@@ -184,7 +184,7 @@ static void AiNew_State_WakeUp(Player *p)
}
if (p->ainew.action == AI_ACTION_TRUCK_ROUTE &&
money > AI_MINIMUM_TRUCK_ROUTE_MONEY) {
- if (GetFreeUnitNumber(VEH_Road) > _patches.max_roadveh) {
+ if (GetFreeUnitNumber(VEH_ROAD) > _patches.max_roadveh) {
p->ainew.action = AI_ACTION_NONE;
return;
}
@@ -1264,7 +1264,7 @@ static void AiNew_CheckVehicle(Player *p, Vehicle *v)
// We are already sending him back
if (AiNew_GetSpecialVehicleFlag(p, v) & AI_VEHICLEFLAG_SELL) {
- if (v->type == VEH_Road && IsTileDepotType(v->tile, TRANSPORT_ROAD) &&
+ if (v->type == VEH_ROAD && IsTileDepotType(v->tile, TRANSPORT_ROAD) &&
(v->vehstatus&VS_STOPPED)) {
// We are at the depot, sell the vehicle
AI_DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH);
@@ -1275,7 +1275,7 @@ static void AiNew_CheckVehicle(Player *p, Vehicle *v)
if (!AiNew_SetSpecialVehicleFlag(p, v, AI_VEHICLEFLAG_SELL)) return;
{
int ret = 0;
- if (v->type == VEH_Road)
+ if (v->type == VEH_ROAD)
ret = AI_DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_ROADVEH_TO_DEPOT);
// This means we can not find a depot :s
// if (CmdFailed(ret))
@@ -1293,7 +1293,7 @@ static void AiNew_State_CheckAllVehicles(Player *p)
FOR_ALL_VEHICLES(v) {
if (v->owner != p->index) continue;
// Currently, we only know how to handle road-vehicles
- if (v->type != VEH_Road) continue;
+ if (v->type != VEH_ROAD) continue;
AiNew_CheckVehicle(p, v);
}
diff --git a/src/aircraft.h b/src/aircraft.h
index 3acb7babf..0e0cd76ad 100644
--- a/src/aircraft.h
+++ b/src/aircraft.h
@@ -23,7 +23,7 @@ enum AircraftSubType {
* false if it is a shadow or a rotor) */
static inline bool IsNormalAircraft(const Vehicle *v)
{
- assert(v->type == VEH_Aircraft);
+ assert(v->type == VEH_AIRCRAFT);
/* To be fully correct the commented out functionality is the proper one,
* but since value can only be 0 or 2, it is sufficient to only check <= 2
* return (v->subtype == AIR_HELICOPTER) || (v->subtype == AIR_AIRCRAFT); */
@@ -33,7 +33,7 @@ static inline bool IsNormalAircraft(const Vehicle *v)
static inline bool IsAircraftInHangar(const Vehicle* v)
{
- assert(v->type == VEH_Aircraft);
+ assert(v->type == VEH_AIRCRAFT);
return v->vehstatus & VS_HIDDEN && IsHangarTile(v->tile);
}
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 43a836982..ea7a236c3 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -236,7 +236,7 @@ uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo *avi)
*/
int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- if (!IsEngineBuildable(p1, VEH_Aircraft, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
+ if (!IsEngineBuildable(p1, VEH_AIRCRAFT, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
const AircraftVehicleInfo *avi = AircraftVehInfo(p1);
int32 value = EstimateAircraftCost(avi);
@@ -258,7 +258,7 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
}
- UnitID unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_Aircraft);
+ UnitID unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_AIRCRAFT);
if (unit_num > _patches.max_aircraft)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -267,7 +267,7 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Vehicle *u = vl[1]; // shadow
v->unitnumber = unit_num;
- v->type = u->type = VEH_Aircraft;
+ v->type = u->type = VEH_AIRCRAFT;
v->direction = DIR_SE;
v->owner = u->owner = _current_player;
@@ -400,7 +400,7 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
u->next = w;
- w->type = VEH_Aircraft;
+ w->type = VEH_AIRCRAFT;
w->direction = DIR_N;
w->owner = _current_player;
w->x_pos = v->x_pos;
@@ -423,7 +423,7 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
RebuildVehicleLists();
InvalidateWindow(WC_COMPANY, v->owner);
if (IsLocalPlayer())
- InvalidateAutoreplaceWindow(VEH_Aircraft); //updates the replace Aircraft window
+ InvalidateAutoreplaceWindow(VEH_AIRCRAFT); //updates the replace Aircraft window
GetPlayer(_current_player)->num_engines[p1]++;
}
@@ -455,7 +455,7 @@ int32 CmdSellAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner)) return CMD_ERROR;
if (!IsAircraftInHangarStopped(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
@@ -482,7 +482,7 @@ int32 CmdStartStopAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner)) return CMD_ERROR;
/* cannot stop airplane when in flight, or when taking off / landing */
if (v->u.air.state >= STARTTAKEOFF && v->u.air.state < TERM7)
@@ -524,14 +524,14 @@ int32 CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */
if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR;
- return SendAllVehiclesToDepot(VEH_Aircraft, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
+ return SendAllVehiclesToDepot(VEH_AIRCRAFT, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
}
if (!IsValidVehicleID(p1)) return CMD_ERROR;
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Aircraft || !CheckOwnership(v->owner) || IsAircraftInHangar(v)) return CMD_ERROR;
+ if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner) || IsAircraftInHangar(v)) return CMD_ERROR;
if (v->current_order.type == OT_GOTO_DEPOT && !(p2 & DEPOT_LOCATE_HANGAR)) {
if (!!(p2 & DEPOT_SERVICE) == HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
@@ -601,7 +601,7 @@ int32 CmdRefitAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner)) return CMD_ERROR;
if (!IsAircraftInHangarStopped(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
/* Check cargo */
@@ -729,7 +729,7 @@ void AircraftYearlyLoop()
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Aircraft && IsNormalAircraft(v)) {
+ if (v->type == VEH_AIRCRAFT && IsNormalAircraft(v)) {
v->profit_last_year = v->profit_this_year;
v->profit_this_year = 0;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
@@ -2097,7 +2097,7 @@ void Aircraft_Tick(Vehicle *v)
for (uint i = 0; i != 2; i++) {
AircraftEventHandler(v, i);
- if (v->type != VEH_Aircraft) // In case it was deleted
+ if (v->type != VEH_AIRCRAFT) // In case it was deleted
break;
}
}
@@ -2116,7 +2116,7 @@ void UpdateOldAircraft()
FOR_ALL_VEHICLES(v_oldstyle) {
/* airplane has another vehicle with subtype 4 (shadow), helicopter also has 3 (rotor)
* skip those */
- if (v_oldstyle->type == VEH_Aircraft && IsNormalAircraft(v_oldstyle)) {
+ if (v_oldstyle->type == VEH_AIRCRAFT && IsNormalAircraft(v_oldstyle)) {
/* airplane in terminal stopped doesn't hurt anyone, so goto next */
if (v_oldstyle->vehstatus & VS_STOPPED && v_oldstyle->u.air.state == 0) {
v_oldstyle->u.air.state = HANGAR;
@@ -2146,7 +2146,7 @@ void UpdateAirplanesOnNewStation(const Station *st)
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Aircraft && IsNormalAircraft(v)) {
+ if (v->type == VEH_AIRCRAFT && IsNormalAircraft(v)) {
if (v->u.air.targetairport == st->index) { // if heading to this airport
/* update position of airplane. If plane is not flying, landing, or taking off
*you cannot delete airport, so it doesn't matter */
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index d531b24e6..6ef7c7d30 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -80,12 +80,12 @@ static CargoID EngineCargo(EngineID engine)
switch (GetEngine(engine)->type) {
default: NOT_REACHED();
- case VEH_Train:
+ case VEH_TRAIN:
if (RailVehInfo(engine)->capacity == 0) return CT_INVALID; // no capacity -> can't carry cargo
return RailVehInfo(engine)->cargo_type;
- case VEH_Road: return RoadVehInfo(engine)->cargo_type;
- case VEH_Ship: return ShipVehInfo(engine)->cargo_type;
- case VEH_Aircraft: return CT_PASSENGERS; // all planes are build with passengers by default
+ case VEH_ROAD: return RoadVehInfo(engine)->cargo_type;
+ case VEH_SHIP: return ShipVehInfo(engine)->cargo_type;
+ case VEH_AIRCRAFT: return CT_PASSENGERS; // all planes are build with passengers by default
}
}
@@ -147,7 +147,7 @@ static void GenerateReplaceVehList(Window *w, bool draw_left)
EngList_RemoveAll(list);
FOR_ALL_ENGINEIDS_OF_TYPE(e, type) {
- if (type == VEH_Train && !GenerateReplaceRailList(e, draw_left, WP(w, replaceveh_d).wagon_btnstate)) continue; // special rules for trains
+ if (type == VEH_TRAIN && !GenerateReplaceRailList(e, draw_left, WP(w, replaceveh_d).wagon_btnstate)) continue; // special rules for trains
if (draw_left) {
/* Skip drawing the engines we don't have any of and haven't set for replacement */
@@ -255,7 +255,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
/* now the actual drawing of the window itself takes place */
SetDParam(0, _vehicle_type_names[w->window_number]);
- if (w->window_number == VEH_Train) {
+ if (w->window_number == VEH_TRAIN) {
/* set on/off for renew_keep_length */
SetDParam(1, p->renew_keep_length ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF);
@@ -269,7 +269,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
DrawWindowWidgets(w);
- if (w->window_number == VEH_Train) {
+ if (w->window_number == VEH_TRAIN) {
/* Draw the selected railtype in the pulldown menu */
RailType railtype = _railtype_selected_in_replace_gui;
DrawString(157, w->widget[14].top + 1, _rail_types_list[railtype], 0x10);
@@ -487,19 +487,19 @@ void ShowReplaceVehicleWindow(byte vehicletype)
DeleteWindowById(WC_REPLACE_VEHICLE, vehicletype);
switch (vehicletype) {
- case VEH_Train:
+ case VEH_TRAIN:
w = AllocateWindowDescFront(&_replace_rail_vehicle_desc, vehicletype);
w->vscroll.cap = 8;
w->resize.step_height = 14;
WP(w, replaceveh_d).wagon_btnstate = true;
break;
- case VEH_Road:
+ case VEH_ROAD:
w = AllocateWindowDescFront(&_replace_road_vehicle_desc, vehicletype);
w->vscroll.cap = 8;
w->resize.step_height = 14;
break;
- case VEH_Ship:
- case VEH_Aircraft:
+ case VEH_SHIP:
+ case VEH_AIRCRAFT:
w = AllocateWindowDescFront(&_replace_ship_aircraft_vehicle_desc, vehicletype);
w->vscroll.cap = 4;
w->resize.step_height = 24;
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 03e09707b..1ebccc83e 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -63,7 +63,7 @@ static const Widget _build_vehicle_widgets[] = {
static void SetupWindowStrings(Window *w, byte type)
{
switch (type) {
- case VEH_Train:
+ case VEH_TRAIN:
w->widget[BUILD_VEHICLE_WIDGET_CAPTION].data = STR_JUST_STRING;
w->widget[BUILD_VEHICLE_WIDGET_LIST].tooltips = STR_8843_TRAIN_VEHICLE_SELECTION;
w->widget[BUILD_VEHICLE_WIDGET_BUILD].data = STR_881F_BUILD_VEHICLE;
@@ -71,7 +71,7 @@ static void SetupWindowStrings(Window *w, byte type)
w->widget[BUILD_VEHICLE_WIDGET_RENAME].data = STR_8820_RENAME;
w->widget[BUILD_VEHICLE_WIDGET_RENAME].tooltips = STR_8845_RENAME_TRAIN_VEHICLE_TYPE;
break;
- case VEH_Road:
+ case VEH_ROAD:
w->widget[BUILD_VEHICLE_WIDGET_CAPTION].data = STR_9006_NEW_ROAD_VEHICLES;
w->widget[BUILD_VEHICLE_WIDGET_LIST].tooltips = STR_9026_ROAD_VEHICLE_SELECTION;
w->widget[BUILD_VEHICLE_WIDGET_BUILD].data = STR_9007_BUILD_VEHICLE;
@@ -79,7 +79,7 @@ static void SetupWindowStrings(Window *w, byte type)
w->widget[BUILD_VEHICLE_WIDGET_RENAME].data = STR_9034_RENAME;
w->widget[BUILD_VEHICLE_WIDGET_RENAME].tooltips = STR_9035_RENAME_ROAD_VEHICLE_TYPE;
break;
- case VEH_Ship:
+ case VEH_SHIP:
w->widget[BUILD_VEHICLE_WIDGET_CAPTION].data = STR_9808_NEW_SHIPS;
w->widget[BUILD_VEHICLE_WIDGET_LIST].tooltips = STR_9825_SHIP_SELECTION_LIST_CLICK;
w->widget[BUILD_VEHICLE_WIDGET_BUILD].data = STR_9809_BUILD_SHIP;
@@ -87,7 +87,7 @@ static void SetupWindowStrings(Window *w, byte type)
w->widget[BUILD_VEHICLE_WIDGET_RENAME].data = STR_9836_RENAME;
w->widget[BUILD_VEHICLE_WIDGET_RENAME].tooltips = STR_9837_RENAME_SHIP_TYPE;
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
w->widget[BUILD_VEHICLE_WIDGET_CAPTION].data = STR_A005_NEW_AIRCRAFT;
w->widget[BUILD_VEHICLE_WIDGET_LIST].tooltips = STR_A025_AIRCRAFT_SELECTION_LIST;
w->widget[BUILD_VEHICLE_WIDGET_BUILD].data = STR_A006_BUILD_AIRCRAFT;
@@ -536,7 +536,7 @@ void DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number)
bool refitable = false;
switch (e->type) {
- case VEH_Train: {
+ case VEH_TRAIN: {
const RailVehicleInfo *rvi = RailVehInfo(engine_number);
refitable = (EngInfo(engine_number)->refit_mask != 0) && (rvi->capacity > 0);
@@ -562,23 +562,23 @@ void DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number)
y += 10;
}
break;
- case VEH_Road:
+ case VEH_ROAD:
y = DrawRoadVehPurchaseInfo(x, y, engine_number, RoadVehInfo(engine_number));
refitable = true;
break;
- case VEH_Ship: {
+ case VEH_SHIP: {
const ShipVehicleInfo *svi = ShipVehInfo(engine_number);
y = DrawShipPurchaseInfo(x, y, engine_number, svi);
refitable = svi->refittable;
} break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
y = DrawAircraftPurchaseInfo(x, y, engine_number, AircraftVehInfo(engine_number));
refitable = true;
break;
}
/* Draw details, that applies to all types except rail wagons */
- if (e->type != VEH_Train || RailVehInfo(engine_number)->railveh_type != RAILVEH_WAGON) {
+ if (e->type != VEH_TRAIN || RailVehInfo(engine_number)->railveh_type != RAILVEH_WAGON) {
/* Design date - Life length */
SetDParam(0, ymd.year);
SetDParam(1, e->lifelength);
@@ -616,7 +616,7 @@ static void GenerateBuildTrainList(Window *w)
const RailVehicleInfo *rvi = RailVehInfo(eid);
if (bv->filter.railtype != RAILTYPE_END && !HasPowerOnRail(rvi->railtype, bv->filter.railtype)) continue;
- if (!IsEngineBuildable(eid, VEH_Train, _local_player)) continue;
+ if (!IsEngineBuildable(eid, VEH_TRAIN, _local_player)) continue;
EngList_Add(&bv->eng_list, eid);
if (rvi->railveh_type != RAILVEH_WAGON) {
@@ -653,7 +653,7 @@ static void GenerateBuildRoadVehList(Window *w)
sel_id = INVALID_ENGINE;
for (eid = ROAD_ENGINES_INDEX; eid < ROAD_ENGINES_INDEX + NUM_ROAD_ENGINES; eid++) {
- if (!IsEngineBuildable(eid, VEH_Road, _local_player)) continue;
+ if (!IsEngineBuildable(eid, VEH_ROAD, _local_player)) continue;
EngList_Add(&bv->eng_list, eid);
if (eid == bv->sel_engine) sel_id = eid;
@@ -672,7 +672,7 @@ static void GenerateBuildShipList(Window *w)
sel_id = INVALID_ENGINE;
for (eid = SHIP_ENGINES_INDEX; eid < SHIP_ENGINES_INDEX + NUM_SHIP_ENGINES; eid++) {
- if (!IsEngineBuildable(eid, VEH_Ship, _local_player)) continue;
+ if (!IsEngineBuildable(eid, VEH_SHIP, _local_player)) continue;
EngList_Add(&bv->eng_list, eid);
if (eid == bv->sel_engine) sel_id = eid;
@@ -694,7 +694,7 @@ static void GenerateBuildAircraftList(Window *w)
* when planes become obsolete and are removed */
sel_id = INVALID_ENGINE;
for (eid = AIRCRAFT_ENGINES_INDEX; eid < AIRCRAFT_ENGINES_INDEX + NUM_AIRCRAFT_ENGINES; eid++) {
- if (!IsEngineBuildable(eid, VEH_Aircraft, _local_player)) continue;
+ if (!IsEngineBuildable(eid, VEH_AIRCRAFT, _local_player)) continue;
if (w->window_number != 0 && !IsAircraftBuildableAtStation(eid, w->window_number)) continue;
EngList_Add(&bv->eng_list, eid);
@@ -710,16 +710,16 @@ static void GenerateBuildList(Window *w)
buildvehicle_d *bv = &WP(w, buildvehicle_d);
switch (bv->vehicle_type) {
- case VEH_Train:
+ case VEH_TRAIN:
GenerateBuildTrainList(w);
return; // trains should not reach the last sorting
- case VEH_Road:
+ case VEH_ROAD:
GenerateBuildRoadVehList(w);
break;
- case VEH_Ship:
+ case VEH_SHIP:
GenerateBuildShipList(w);
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
GenerateBuildAircraftList(w);
break;
}
@@ -730,10 +730,10 @@ static void GenerateBuildList(Window *w)
static void DrawVehicleEngine(byte type, int x, int y, EngineID engine, SpriteID pal)
{
switch (type) {
- case VEH_Train: DrawTrainEngine( x, y, engine, pal); break;
- case VEH_Road: DrawRoadVehEngine( x, y, engine, pal); break;
- case VEH_Ship: DrawShipEngine( x, y, engine, pal); break;
- case VEH_Aircraft: DrawAircraftEngine(x, y, engine, pal); break;
+ case VEH_TRAIN: DrawTrainEngine( x, y, engine, pal); break;
+ case VEH_ROAD: DrawRoadVehEngine( x, y, engine, pal); break;
+ case VEH_SHIP: DrawShipEngine( x, y, engine, pal); break;
+ case VEH_AIRCRAFT: DrawAircraftEngine(x, y, engine, pal); break;
default: NOT_REACHED();
}
}
@@ -757,22 +757,22 @@ void DrawEngineList(byte type, int x, int y, const EngineList eng_list, uint16 m
assert(max <= EngList_Count(&eng_list));
switch (type) {
- case VEH_Train:
+ case VEH_TRAIN:
x++; // train and road vehicles use the same offset, except trains are one more pixel to the right
/* Fallthough */
- case VEH_Road:
+ case VEH_ROAD:
x += 26;
x_offset = 30;
y += 2;
y_offset = 4;
break;
- case VEH_Ship:
+ case VEH_SHIP:
x += 35;
x_offset = 40;
y += 7;
y_offset = 3;
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
x += 27;
x_offset = 33;
y += 7;
@@ -843,17 +843,17 @@ static void BuildVehicleClickEvent(Window *w, WindowEvent *e)
EngineID sel_eng = bv->sel_engine;
if (sel_eng != INVALID_ENGINE) {
switch (bv->vehicle_type) {
- case VEH_Train:
+ case VEH_TRAIN:
DoCommandP(w->window_number, sel_eng, 0, (RailVehInfo(sel_eng)->railveh_type == RAILVEH_WAGON) ? CcBuildWagon : CcBuildLoco,
CMD_BUILD_RAIL_VEHICLE | CMD_MSG(STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE));
break;
- case VEH_Road:
+ case VEH_ROAD:
DoCommandP(w->window_number, sel_eng, 0, CcBuildRoadVeh, CMD_BUILD_ROAD_VEH | CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE));
break;
- case VEH_Ship:
+ case VEH_SHIP:
DoCommandP(w->window_number, sel_eng, 0, CcBuildShip, CMD_BUILD_SHIP | CMD_MSG(STR_980D_CAN_T_BUILD_SHIP));
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
DoCommandP(w->window_number, sel_eng, 0, CcBuildAircraft, CMD_BUILD_AIRCRAFT | CMD_MSG(STR_A008_CAN_T_BUILD_AIRCRAFT));
break;
}
@@ -868,10 +868,10 @@ static void BuildVehicleClickEvent(Window *w, WindowEvent *e)
bv->rename_engine = sel_eng;
switch (bv->vehicle_type) {
- case VEH_Train: str = STR_886A_RENAME_TRAIN_VEHICLE_TYPE; break;
- case VEH_Road: str = STR_9036_RENAME_ROAD_VEHICLE_TYPE; break;
- case VEH_Ship: str = STR_9838_RENAME_SHIP_TYPE; break;
- case VEH_Aircraft: str = STR_A039_RENAME_AIRCRAFT_TYPE; break;
+ case VEH_TRAIN: str = STR_886A_RENAME_TRAIN_VEHICLE_TYPE; break;
+ case VEH_ROAD: str = STR_9036_RENAME_ROAD_VEHICLE_TYPE; break;
+ case VEH_SHIP: str = STR_9838_RENAME_SHIP_TYPE; break;
+ case VEH_AIRCRAFT: str = STR_A039_RENAME_AIRCRAFT_TYPE; break;
}
ShowQueryString(GetCustomEngineName(sel_eng), str, 31, 160, w, CS_ALPHANUMERAL);
}
@@ -911,10 +911,10 @@ static void NewVehicleWndProc(Window *w, WindowEvent *e)
StringID str = STR_NULL;
_cmd_text = e->we.edittext.str;
switch (bv->vehicle_type) {
- case VEH_Train: str = STR_886B_CAN_T_RENAME_TRAIN_VEHICLE; break;
- case VEH_Road: str = STR_9037_CAN_T_RENAME_ROAD_VEHICLE; break;
- case VEH_Ship: str = STR_9839_CAN_T_RENAME_SHIP_TYPE; break;
- case VEH_Aircraft: str = STR_A03A_CAN_T_RENAME_AIRCRAFT_TYPE; break;
+ case VEH_TRAIN: str = STR_886B_CAN_T_RENAME_TRAIN_VEHICLE; break;
+ case VEH_ROAD: str = STR_9037_CAN_T_RENAME_ROAD_VEHICLE; break;
+ case VEH_SHIP: str = STR_9839_CAN_T_RENAME_SHIP_TYPE; break;
+ case VEH_AIRCRAFT: str = STR_A03A_CAN_T_RENAME_AIRCRAFT_TYPE; break;
}
DoCommandP(0, bv->rename_engine, 0, NULL, CMD_RENAME_ENGINE | CMD_MSG(str));
}
@@ -977,16 +977,16 @@ void ShowBuildVehicleWindow(TileIndex tile, byte type)
bv->descending_sort_order = _last_sort_order[type];
switch (type) {
- case VEH_Train:
+ case VEH_TRAIN:
WP(w,buildvehicle_d).filter.railtype = (tile == 0) ? RAILTYPE_END : GetRailType(tile);
ResizeWindow(w, 0, 16);
break;
- case VEH_Road:
+ case VEH_ROAD:
ResizeWindow(w, 20, 16);
- case VEH_Ship:
+ case VEH_SHIP:
ResizeWindow(w, 27, 0);
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
bv->filter.flags =
tile == 0 ? AirportFTAClass::ALL : GetStationByTile(tile)->Airport()->flags;
ResizeWindow(w, 12, 0);
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 690067a28..bcffc4896 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -141,7 +141,7 @@ DEF_CONSOLE_CMD(ConStopAllVehicles)
FOR_ALL_VEHICLES(v) {
/* Code ripped from CmdStartStopTrain. Can't call it, because of
* ownership problems, so we'll duplicate some code, for now */
- if (v->type == VEH_Train)
+ if (v->type == VEH_TRAIN)
v->u.rail.days_since_order_progr = 0;
v->vehstatus |= VS_STOPPED;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index d6705c455..8976da0b1 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -133,20 +133,20 @@ void CcCloneVehicle(bool success, TileIndex tile, uint32 p1, uint32 p2)
{
if (!success) return;
switch(GetVehicle(p1)->type) {
- case VEH_Train: CcCloneTrain( true, tile, p1, p2); break;
- case VEH_Road: CcCloneRoadVeh( true, tile, p1, p2); break;
- case VEH_Ship: CcCloneShip( true, tile, p1, p2); break;
- case VEH_Aircraft: CcCloneAircraft(true, tile, p1, p2); break;
+ case VEH_TRAIN: CcCloneTrain( true, tile, p1, p2); break;
+ case VEH_ROAD: CcCloneRoadVeh( true, tile, p1, p2); break;
+ case VEH_SHIP: CcCloneShip( true, tile, p1, p2); break;
+ case VEH_AIRCRAFT: CcCloneAircraft(true, tile, p1, p2); break;
}
}
static inline void ShowVehicleViewWindow(const Vehicle *v)
{
switch (v->type) {
- case VEH_Train: ShowTrainViewWindow(v); break;
- case VEH_Road: ShowRoadVehViewWindow(v); break;
- case VEH_Ship: ShowShipViewWindow(v); break;
- case VEH_Aircraft: ShowAircraftViewWindow(v); break;
+ case VEH_TRAIN: ShowTrainViewWindow(v); break;
+ case VEH_ROAD: ShowRoadVehViewWindow(v); break;
+ case VEH_SHIP: ShowShipViewWindow(v); break;
+ case VEH_AIRCRAFT: ShowAircraftViewWindow(v); break;
default: NOT_REACHED();
}
}
@@ -175,7 +175,7 @@ static void DrawVehicleInDepot(Window *w, const Vehicle *v, int x, int y)
int sprite_y = y + w->resize.step_height - GetVehicleListHeight(v->type);
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
DrawTrainImage(v, x + 21, sprite_y, w->widget[DEPOT_WIDGET_MATRIX].right - 32, w->hscroll.pos, WP(w,depot_d).sel);
/* Number of wagons relative to a standard length wagon (rounded up) */
@@ -183,9 +183,9 @@ static void DrawVehicleInDepot(Window *w, const Vehicle *v, int x, int y)
DrawStringRightAligned(w->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, 0); // Draw the counter
break;
- case VEH_Road: DrawRoadVehImage( v, x + 24, sprite_y, WP(w, depot_d).sel); break;
- case VEH_Ship: DrawShipImage( v, x + 19, sprite_y - 1, WP(w, depot_d).sel); break;
- case VEH_Aircraft: {
+ case VEH_ROAD: DrawRoadVehImage( v, x + 24, sprite_y, WP(w, depot_d).sel); break;
+ case VEH_SHIP: DrawShipImage( v, x + 19, sprite_y - 1, WP(w, depot_d).sel); break;
+ case VEH_AIRCRAFT: {
const Sprite *spr = GetSprite(GetAircraftImage(v, DIR_W));
DrawAircraftImage(v, x + 12,
y + max(spr->height + spr->y_offs - 14, 0), // tall sprites needs an y offset
@@ -195,10 +195,10 @@ static void DrawVehicleInDepot(Window *w, const Vehicle *v, int x, int y)
}
if (w->resize.step_height == 14) {
- /* VEH_Train and VEH_Road, which are low */
+ /* VEH_TRAIN and VEH_ROAD, which are low */
diff_x = 15;
} else {
- /* VEH_Ship and VEH_Aircraft, which are tall */
+ /* VEH_SHIP and VEH_AIRCRAFT, which are tall */
diff_y = 12;
}
@@ -233,7 +233,7 @@ static void DrawDepotWindow(Window *w)
WIDGET_LIST_END);
/* determine amount of items for scroller */
- if (WP(w, depot_d).type == VEH_Train) {
+ if (WP(w, depot_d).type == VEH_TRAIN) {
hnum = 8;
for (num = 0; num < WP(w, depot_d).engine_count; num++) {
const Vehicle *v = vl[num];
@@ -247,7 +247,7 @@ static void DrawDepotWindow(Window *w)
}
/* locate the depot struct */
- if (WP(w, depot_d).type == VEH_Aircraft) {
+ if (WP(w, depot_d).type == VEH_AIRCRAFT) {
SetDParam(0, GetStationIndex(tile)); // Airport name
} else {
Depot *depot = GetDepotByTile(tile);
@@ -309,7 +309,7 @@ static int GetVehicleFromDepotWndPt(const Window *w, int x, int y, Vehicle **veh
int pos, skip = 0;
uint16 boxes_in_each_row = w->widget[DEPOT_WIDGET_MATRIX].data & 0xFF;
- if (WP(w, depot_d).type == VEH_Train) {
+ if (WP(w, depot_d).type == VEH_TRAIN) {
xt = 0;
x -= 23;
} else {
@@ -326,7 +326,7 @@ static int GetVehicleFromDepotWndPt(const Window *w, int x, int y, Vehicle **veh
pos = ((row + w->vscroll.pos) * boxes_in_each_row) + xt;
if (WP(w, depot_d).engine_count + WP(w, depot_d).wagon_count <= pos) {
- if (WP(w, depot_d).type == VEH_Train) {
+ if (WP(w, depot_d).type == VEH_TRAIN) {
d->head = NULL;
d->wagon = NULL;
return MODE_DRAG_VEHICLE;
@@ -347,7 +347,7 @@ static int GetVehicleFromDepotWndPt(const Window *w, int x, int y, Vehicle **veh
}
switch (WP(w, depot_d).type) {
- case VEH_Train: {
+ case VEH_TRAIN: {
Vehicle *v = *veh;
d->head = d->wagon = v;
@@ -372,17 +372,17 @@ static int GetVehicleFromDepotWndPt(const Window *w, int x, int y, Vehicle **veh
}
break;
- case VEH_Road:
+ case VEH_ROAD:
if (xm >= 24) return MODE_DRAG_VEHICLE;
if (xm <= 16) return MODE_SHOW_VEHICLE;
break;
- case VEH_Ship:
+ case VEH_SHIP:
if (xm >= 19) return MODE_DRAG_VEHICLE;
if (ym <= 10) return MODE_SHOW_VEHICLE;
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
if (xm >= 12) return MODE_DRAG_VEHICLE;
if (ym <= 12) return MODE_SHOW_VEHICLE;
break;
@@ -420,11 +420,11 @@ static void DepotClick(Window *w, int x, int y)
/* share / copy orders */
if (_thd.place_mode && mode <= 0) {
- _place_clicked_vehicle = (WP(w, depot_d).type == VEH_Train ? gdvp.head : v);
+ _place_clicked_vehicle = (WP(w, depot_d).type == VEH_TRAIN ? gdvp.head : v);
return;
}
- if (WP(w, depot_d).type == VEH_Train) v = gdvp.wagon;
+ if (WP(w, depot_d).type == VEH_TRAIN) v = gdvp.wagon;
switch (mode) {
case MODE_ERROR: // invalid
@@ -433,17 +433,17 @@ static void DepotClick(Window *w, int x, int y)
case MODE_DRAG_VEHICLE: { // start dragging of vehicle
VehicleID sel = WP(w, depot_d).sel;
- if (WP(w, depot_d).type == VEH_Train && sel != INVALID_VEHICLE) {
+ if (WP(w, depot_d).type == VEH_TRAIN && sel != INVALID_VEHICLE) {
WP(w,depot_d).sel = INVALID_VEHICLE;
TrainDepotMoveVehicle(v, sel, gdvp.head);
} else if (v != NULL) {
int image;
switch (WP(w, depot_d).type) {
- case VEH_Train: image = GetTrainImage(v, DIR_W); break;
- case VEH_Road: image = GetRoadVehImage(v, DIR_W); break;
- case VEH_Ship: image = GetShipImage(v, DIR_W); break;
- case VEH_Aircraft: image = GetAircraftImage(v, DIR_W); break;
+ case VEH_TRAIN: image = GetTrainImage(v, DIR_W); break;
+ case VEH_ROAD: image = GetRoadVehImage(v, DIR_W); break;
+ case VEH_SHIP: image = GetShipImage(v, DIR_W); break;
+ case VEH_AIRCRAFT: image = GetAircraftImage(v, DIR_W); break;
default: NOT_REACHED(); image = 0;
}
@@ -462,10 +462,10 @@ static void DepotClick(Window *w, int x, int y)
uint command;
switch (WP(w, depot_d).type) {
- case VEH_Train: command = CMD_START_STOP_TRAIN | CMD_MSG(STR_883B_CAN_T_STOP_START_TRAIN); break;
- case VEH_Road: command = CMD_START_STOP_ROADVEH | CMD_MSG(STR_9015_CAN_T_STOP_START_ROAD_VEHICLE); break;
- case VEH_Ship: command = CMD_START_STOP_SHIP | CMD_MSG(STR_9818_CAN_T_STOP_START_SHIP); break;
- case VEH_Aircraft: command = CMD_START_STOP_AIRCRAFT | CMD_MSG(STR_A016_CAN_T_STOP_START_AIRCRAFT); break;
+ case VEH_TRAIN: command = CMD_START_STOP_TRAIN | CMD_MSG(STR_883B_CAN_T_STOP_START_TRAIN); break;
+ case VEH_ROAD: command = CMD_START_STOP_ROADVEH | CMD_MSG(STR_9015_CAN_T_STOP_START_ROAD_VEHICLE); break;
+ case VEH_SHIP: command = CMD_START_STOP_SHIP | CMD_MSG(STR_9818_CAN_T_STOP_START_SHIP); break;
+ case VEH_AIRCRAFT: command = CMD_START_STOP_AIRCRAFT | CMD_MSG(STR_A016_CAN_T_STOP_START_AIRCRAFT); break;
default: NOT_REACHED(); command = 0;
}
DoCommandP(v->tile, v->index, 0, NULL, command);
@@ -487,17 +487,17 @@ static void HandleCloneVehClick(const Vehicle *v, const Window *w)
if (v == NULL) return;
- if (v->type == VEH_Train && !IsFrontEngine(v)) {
+ if (v->type == VEH_TRAIN && !IsFrontEngine(v)) {
v = GetFirstVehicleInChain(v);
/* Do nothing when clicking on a train in depot with no loc attached */
if (!IsFrontEngine(v)) return;
}
switch (v->type) {
- case VEH_Train: error_str = CMD_MSG(STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE); break;
- case VEH_Road: error_str = CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE); break;
- case VEH_Ship: error_str = CMD_MSG(STR_980D_CAN_T_BUILD_SHIP); break;
- case VEH_Aircraft: error_str = CMD_MSG(STR_A008_CAN_T_BUILD_AIRCRAFT); break;
+ case VEH_TRAIN: error_str = CMD_MSG(STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE); break;
+ case VEH_ROAD: error_str = CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE); break;
+ case VEH_SHIP: error_str = CMD_MSG(STR_980D_CAN_T_BUILD_SHIP); break;
+ case VEH_AIRCRAFT: error_str = CMD_MSG(STR_A008_CAN_T_BUILD_AIRCRAFT); break;
default: return;
}
@@ -517,7 +517,7 @@ static void ResizeDepotButtons(Window *w)
{
ResizeButtons(w, DEPOT_WIDGET_BUILD, DEPOT_WIDGET_LOCATION);
- if (WP(w, depot_d).type == VEH_Train) {
+ if (WP(w, depot_d).type == VEH_TRAIN) {
/* Divide the size of DEPOT_WIDGET_SELL into two equally big buttons so DEPOT_WIDGET_SELL and DEPOT_WIDGET_SELL_CHAIN will get the same size.
* This way it will stay the same even if DEPOT_WIDGET_SELL_CHAIN is resized for some reason */
w->widget[DEPOT_WIDGET_SELL_CHAIN].top = ((w->widget[DEPOT_WIDGET_SELL_CHAIN].bottom - w->widget[DEPOT_WIDGET_SELL].top) / 2) + w->widget[DEPOT_WIDGET_SELL].top;
@@ -532,7 +532,7 @@ static void ResizeDepotButtons(Window *w)
static void SetupStringsForDepotWindow(Window *w, byte type)
{
switch (type) {
- case VEH_Train:
+ case VEH_TRAIN:
w->widget[DEPOT_WIDGET_CAPTION].data = STR_8800_TRAIN_DEPOT;
w->widget[DEPOT_WIDGET_STOP_ALL].tooltips = STR_MASS_STOP_DEPOT_TRAIN_TIP;
w->widget[DEPOT_WIDGET_START_ALL].tooltips= STR_MASS_START_DEPOT_TRAIN_TIP;
@@ -556,7 +556,7 @@ static void SetupStringsForDepotWindow(Window *w, byte type)
w->widget[DEPOT_WIDGET_AUTOREPLACE].data = SPR_REPLACE_TRAIN;
break;
- case VEH_Road:
+ case VEH_ROAD:
w->widget[DEPOT_WIDGET_CAPTION].data = STR_9003_ROAD_VEHICLE_DEPOT;
w->widget[DEPOT_WIDGET_STOP_ALL].tooltips = STR_MASS_STOP_DEPOT_ROADVEH_TIP;
w->widget[DEPOT_WIDGET_START_ALL].tooltips= STR_MASS_START_DEPOT_ROADVEH_TIP;
@@ -580,7 +580,7 @@ static void SetupStringsForDepotWindow(Window *w, byte type)
w->widget[DEPOT_WIDGET_AUTOREPLACE].data = SPR_REPLACE_ROADVEH;
break;
- case VEH_Ship:
+ case VEH_SHIP:
w->widget[DEPOT_WIDGET_CAPTION].data = STR_9803_SHIP_DEPOT;
w->widget[DEPOT_WIDGET_STOP_ALL].tooltips = STR_MASS_STOP_DEPOT_SHIP_TIP;
w->widget[DEPOT_WIDGET_START_ALL].tooltips= STR_MASS_START_DEPOT_SHIP_TIP;
@@ -604,7 +604,7 @@ static void SetupStringsForDepotWindow(Window *w, byte type)
w->widget[DEPOT_WIDGET_AUTOREPLACE].data = SPR_REPLACE_SHIP;
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
w->widget[DEPOT_WIDGET_CAPTION].data = STR_A002_AIRCRAFT_HANGAR;
w->widget[DEPOT_WIDGET_STOP_ALL].tooltips = STR_MASS_STOP_HANGAR_TIP;
w->widget[DEPOT_WIDGET_START_ALL].tooltips= STR_MASS_START_HANGAR_TIP;
@@ -638,22 +638,22 @@ uint _block_sizes[4][2];
/* Array to hold the default resize capacities
* First part is the vehicle type, while the last is 0 = x, 1 = y */
const uint _resize_cap[][2] = {
-/* VEH_Train */ {6, 10 * 29 + 36}, ///< flags, unitnumber and unit count uses a total of 36 pixels and we set default to 10 units
-/* VEH_Road */ {5, 5},
-/* VEH_Ship */ {3, 3},
-/* VEH_Aircraft */ {3, 4},
+/* VEH_TRAIN */ {6, 10 * 29 + 36}, ///< flags, unitnumber and unit count uses a total of 36 pixels and we set default to 10 units
+/* VEH_ROAD */ {5, 5},
+/* VEH_SHIP */ {3, 3},
+/* VEH_AIRCRAFT */ {3, 4},
};
static void ResizeDefaultWindowSizeForTrains()
{
- _block_sizes[VEH_Train][0] = 1;
- _block_sizes[VEH_Train][1] = GetVehicleListHeight(VEH_Train);
+ _block_sizes[VEH_TRAIN][0] = 1;
+ _block_sizes[VEH_TRAIN][1] = GetVehicleListHeight(VEH_TRAIN);
}
static void ResizeDefaultWindowSizeForRoadVehicles()
{
- _block_sizes[VEH_Road][0] = 56;
- _block_sizes[VEH_Road][1] = GetVehicleListHeight(VEH_Road);
+ _block_sizes[VEH_ROAD][0] = 56;
+ _block_sizes[VEH_ROAD][1] = GetVehicleListHeight(VEH_ROAD);
}
static void ResizeDefaultWindowSize(byte type)
@@ -667,8 +667,8 @@ static void ResizeDefaultWindowSize(byte type)
switch (type) {
default: NOT_REACHED();
- case VEH_Ship: GetShipSpriteSize( engine, x, y); break;
- case VEH_Aircraft: GetAircraftSpriteSize(engine, x, y); break;
+ case VEH_SHIP: GetShipSpriteSize( engine, x, y); break;
+ case VEH_AIRCRAFT: GetAircraftSpriteSize(engine, x, y); break;
}
if (x > max_width) max_width = x;
if (y > max_height) max_height = y;
@@ -676,11 +676,11 @@ static void ResizeDefaultWindowSize(byte type)
switch (type) {
default: NOT_REACHED();
- case VEH_Ship:
- _block_sizes[VEH_Ship][0] = max(90U, max_width + 20); // we need 20 pixels from the right edge to the sprite
+ case VEH_SHIP:
+ _block_sizes[VEH_SHIP][0] = max(90U, max_width + 20); // we need 20 pixels from the right edge to the sprite
break;
- case VEH_Aircraft:
- _block_sizes[VEH_Aircraft][0] = max(74U, max_width);
+ case VEH_AIRCRAFT:
+ _block_sizes[VEH_AIRCRAFT][0] = max(74U, max_width);
break;
}
_block_sizes[type][1] = max(GetVehicleListHeight(type), max_height);
@@ -692,8 +692,8 @@ void InitDepotWindowBlockSizes()
{
ResizeDefaultWindowSizeForTrains();
ResizeDefaultWindowSizeForRoadVehicles();
- ResizeDefaultWindowSize(VEH_Ship);
- ResizeDefaultWindowSize(VEH_Aircraft);
+ ResizeDefaultWindowSize(VEH_SHIP);
+ ResizeDefaultWindowSize(VEH_AIRCRAFT);
}
static void CreateDepotListWindow(Window *w, byte type)
@@ -718,7 +718,7 @@ static void CreateDepotListWindow(Window *w, byte type)
_block_sizes[type][0] * w->hscroll.cap,
_block_sizes[type][1] * w->vscroll.cap);
- if (type == VEH_Train) {
+ if (type == VEH_TRAIN) {
/* The train depot has a horizontal scroller so we should make room for it */
ResizeWindow(w, 0, 12);
/* substract the newly added space from the matrix since it was meant for the scrollbar */
@@ -733,10 +733,10 @@ static void CreateDepotListWindow(Window *w, byte type)
w->widget[DEPOT_WIDGET_MATRIX].data =
(w->vscroll.cap * 0x100) // number of rows to draw on the background
- + (type == VEH_Train ? 1 : w->hscroll.cap); // number of boxes in each row. Trains always have just one
+ + (type == VEH_TRAIN ? 1 : w->hscroll.cap); // number of boxes in each row. Trains always have just one
- SetWindowWidgetsHiddenState(w, type != VEH_Train,
+ SetWindowWidgetsHiddenState(w, type != VEH_TRAIN,
DEPOT_WIDGET_H_SCROLL,
DEPOT_WIDGET_SELL_CHAIN,
WIDGET_LIST_END);
@@ -841,7 +841,7 @@ static void DepotWndProc(Window *w, WindowEvent *e)
TileIndex tile = w->window_number;
byte vehtype = WP(w, depot_d).type;
- SetDParam(0, (vehtype == VEH_Aircraft) ? GetStationIndex(tile) : GetDepotByTile(tile)->town_index);
+ SetDParam(0, (vehtype == VEH_AIRCRAFT) ? GetStationIndex(tile) : GetDepotByTile(tile)->town_index);
ShowQuery(
confirm_captions[vehtype],
STR_DEPOT_SELL_CONFIRMATION_TEXT,
@@ -897,7 +897,7 @@ static void DepotWndProc(Window *w, WindowEvent *e)
WP(w, depot_d).sel = INVALID_VEHICLE;
SetWindowDirty(w);
- if (WP(w, depot_d).type == VEH_Train) {
+ if (WP(w, depot_d).type == VEH_TRAIN) {
GetDepotVehiclePtData gdvp;
if (GetVehicleFromDepotWndPt(w, e->we.dragdrop.pt.x, e->we.dragdrop.pt.y, &v, &gdvp) == MODE_DRAG_VEHICLE &&
@@ -934,9 +934,9 @@ static void DepotWndProc(Window *w, WindowEvent *e)
WP(w, depot_d).sel = INVALID_VEHICLE;
SetWindowDirty(w);
- sell_cmd = (v->type == VEH_Train && (e->we.click.widget == DEPOT_WIDGET_SELL_CHAIN || _ctrl_pressed)) ? 1 : 0;
+ sell_cmd = (v->type == VEH_TRAIN && (e->we.click.widget == DEPOT_WIDGET_SELL_CHAIN || _ctrl_pressed)) ? 1 : 0;
- is_engine = (!(v->type == VEH_Train && !IsFrontEngine(v)));
+ is_engine = (!(v->type == VEH_TRAIN && !IsFrontEngine(v)));
if (is_engine) {
_backup_orders_tile = v->tile;
@@ -944,10 +944,10 @@ static void DepotWndProc(Window *w, WindowEvent *e)
}
switch (v->type) {
- case VEH_Train: command = CMD_SELL_RAIL_WAGON | CMD_MSG(STR_8839_CAN_T_SELL_RAILROAD_VEHICLE); break;
- case VEH_Road: command = CMD_SELL_ROAD_VEH | CMD_MSG(STR_9014_CAN_T_SELL_ROAD_VEHICLE); break;
- case VEH_Ship: command = CMD_SELL_SHIP | CMD_MSG(STR_980C_CAN_T_SELL_SHIP); break;
- case VEH_Aircraft: command = CMD_SELL_AIRCRAFT | CMD_MSG(STR_A01C_CAN_T_SELL_AIRCRAFT); break;
+ case VEH_TRAIN: command = CMD_SELL_RAIL_WAGON | CMD_MSG(STR_8839_CAN_T_SELL_RAILROAD_VEHICLE); break;
+ case VEH_ROAD: command = CMD_SELL_ROAD_VEH | CMD_MSG(STR_9014_CAN_T_SELL_ROAD_VEHICLE); break;
+ case VEH_SHIP: command = CMD_SELL_SHIP | CMD_MSG(STR_980C_CAN_T_SELL_SHIP); break;
+ case VEH_AIRCRAFT: command = CMD_SELL_AIRCRAFT | CMD_MSG(STR_A01C_CAN_T_SELL_AIRCRAFT); break;
default: NOT_REACHED(); command = 0;
}
@@ -963,7 +963,7 @@ static void DepotWndProc(Window *w, WindowEvent *e)
case WE_RESIZE:
w->vscroll.cap += e->we.sizing.diff.y / (int)w->resize.step_height;
w->hscroll.cap += e->we.sizing.diff.x / (int)w->resize.step_width;
- w->widget[DEPOT_WIDGET_MATRIX].data = (w->vscroll.cap << 8) + (WP(w, depot_d).type == VEH_Train ? 1 : w->hscroll.cap);
+ w->widget[DEPOT_WIDGET_MATRIX].data = (w->vscroll.cap << 8) + (WP(w, depot_d).type == VEH_TRAIN ? 1 : w->hscroll.cap);
ResizeDepotButtons(w);
break;
}
@@ -979,13 +979,13 @@ void ShowDepotWindow(TileIndex tile, byte type)
switch (type) {
default: NOT_REACHED();
- case VEH_Train:
+ case VEH_TRAIN:
w = AllocateWindowDescFront(&_train_depot_desc, tile); break;
- case VEH_Road:
+ case VEH_ROAD:
w = AllocateWindowDescFront(&_road_depot_desc, tile); break;
- case VEH_Ship:
+ case VEH_SHIP:
w = AllocateWindowDescFront(&_ship_depot_desc, tile); break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
w = AllocateWindowDescFront(&_aircraft_depot_desc, tile); break;
}
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index 15d80abaa..7a302ee61 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -116,11 +116,11 @@ static void DisasterVehicleUpdateImage(Vehicle *v)
}
-/** Initialize a disaster vehicle. These vehicles are of type VEH_Disaster, are unclickable
+/** Initialize a disaster vehicle. These vehicles are of type VEH_DISASTER, are unclickable
* and owned by nobody */
static void InitializeDisasterVehicle(Vehicle *v, int x, int y, byte z, Direction direction, byte subtype)
{
- v->type = VEH_Disaster;
+ v->type = VEH_DISASTER;
v->x_pos = x;
v->y_pos = y;
v->z_pos = z;
@@ -330,7 +330,7 @@ static void DisasterTick_Ufo(Vehicle *v)
v->current_order.dest = 1;
FOR_ALL_VEHICLES(u) {
- if (u->type == VEH_Road && IsHumanPlayer(u->owner)) {
+ if (u->type == VEH_ROAD && IsHumanPlayer(u->owner)) {
v->dest_tile = u->index;
v->age = 0;
return;
@@ -341,7 +341,7 @@ static void DisasterTick_Ufo(Vehicle *v)
} else {
/* Target a vehicle */
u = GetVehicle(v->dest_tile);
- if (u->type != VEH_Road) {
+ if (u->type != VEH_ROAD) {
DeleteDisasterVeh(v);
return;
}
@@ -590,7 +590,7 @@ static void DisasterTick_Big_Ufo(Vehicle *v)
v->current_order.dest = 2;
FOR_ALL_VEHICLES(u) {
- if (u->type == VEH_Train || u->type == VEH_Road) {
+ if (u->type == VEH_TRAIN || u->type == VEH_ROAD) {
if (delta(u->x_pos, v->x_pos) + delta(u->y_pos, v->y_pos) <= 12 * TILE_SIZE) {
u->breakdown_ctr = 5;
u->breakdown_delay = 0xF0;
diff --git a/src/economy.cpp b/src/economy.cpp
index 0d5a27aad..4cbb1cc12 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -79,10 +79,10 @@ int64 CalculateCompanyValue(const Player* p)
FOR_ALL_VEHICLES(v) {
if (v->owner != owner) continue;
- if (v->type == VEH_Train ||
- v->type == VEH_Road ||
- (v->type == VEH_Aircraft && IsNormalAircraft(v)) ||
- v->type == VEH_Ship) {
+ if (v->type == VEH_TRAIN ||
+ v->type == VEH_ROAD ||
+ (v->type == VEH_AIRCRAFT && IsNormalAircraft(v)) ||
+ v->type == VEH_SHIP) {
value += v->value * 3 >> 1;
}
}
@@ -115,10 +115,10 @@ int UpdateCompanyRatingAndValue(Player *p, bool update)
FOR_ALL_VEHICLES(v) {
if (v->owner != owner) continue;
- if ((v->type == VEH_Train && IsFrontEngine(v)) ||
- v->type == VEH_Road ||
- (v->type == VEH_Aircraft && IsNormalAircraft(v)) ||
- v->type == VEH_Ship) {
+ if ((v->type == VEH_TRAIN && IsFrontEngine(v)) ||
+ v->type == VEH_ROAD ||
+ (v->type == VEH_AIRCRAFT && IsNormalAircraft(v)) ||
+ v->type == VEH_SHIP) {
num++;
if (v->age > 730) {
/* Find the vehicle with the lowest amount of profit */
@@ -305,17 +305,17 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player)
FOR_ALL_VEHICLES(v) {
if (v->owner == new_player) {
switch (v->type) {
- case VEH_Train: if (IsFrontEngine(v)) num_train++; break;
- case VEH_Road: num_road++; break;
- case VEH_Ship: num_ship++; break;
- case VEH_Aircraft: if (IsNormalAircraft(v)) num_aircraft++; break;
+ case VEH_TRAIN: if (IsFrontEngine(v)) num_train++; break;
+ case VEH_ROAD: num_road++; break;
+ case VEH_SHIP: num_ship++; break;
+ case VEH_AIRCRAFT: if (IsNormalAircraft(v)) num_aircraft++; break;
default: break;
}
}
}
FOR_ALL_VEHICLES(v) {
- if (v->owner == old_player && IS_BYTE_INSIDE(v->type, VEH_Train, VEH_Aircraft + 1)) {
+ if (v->owner == old_player && IS_BYTE_INSIDE(v->type, VEH_TRAIN, VEH_AIRCRAFT + 1)) {
if (new_player == PLAYER_SPECTATOR) {
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
DeleteWindowById(WC_VEHICLE_DETAILS, v->index);
@@ -325,10 +325,10 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player)
v->owner = new_player;
if (IsEngineCountable(v)) GetPlayer(new_player)->num_engines[v->engine_type]++;
switch (v->type) {
- case VEH_Train: if (IsFrontEngine(v)) v->unitnumber = ++num_train; break;
- case VEH_Road: v->unitnumber = ++num_road; break;
- case VEH_Ship: v->unitnumber = ++num_ship; break;
- case VEH_Aircraft: if (IsNormalAircraft(v)) v->unitnumber = ++num_aircraft; break;
+ case VEH_TRAIN: if (IsFrontEngine(v)) v->unitnumber = ++num_train; break;
+ case VEH_ROAD: v->unitnumber = ++num_road; break;
+ case VEH_SHIP: v->unitnumber = ++num_ship; break;
+ case VEH_AIRCRAFT: if (IsNormalAircraft(v)) v->unitnumber = ++num_aircraft; break;
}
}
}
@@ -1295,7 +1295,7 @@ static bool LoadWait(const Vehicle* v, const Vehicle* u)
}
FOR_ALL_VEHICLES(x) {
- if ((x->type != VEH_Train || IsFrontEngine(x)) && // for all locs
+ if ((x->type != VEH_TRAIN || IsFrontEngine(x)) && // for all locs
u->last_station_visited == x->last_station_visited && // at the same station
!(x->vehstatus & (VS_STOPPED | VS_CRASHED)) && // not stopped or crashed
x->current_order.type == OT_LOADING && // loading
@@ -1481,8 +1481,8 @@ int LoadUnloadVehicle(Vehicle *v, bool just_arrived)
/* update stats */
ge->days_since_pickup = 0;
switch (u->type) {
- case VEH_Train: t = u->u.rail.cached_max_speed; break;
- case VEH_Road: t = u->max_speed / 2; break;
+ case VEH_TRAIN: t = u->u.rail.cached_max_speed; break;
+ case VEH_ROAD: t = u->max_speed / 2; break;
default: t = u->max_speed; break;
}
@@ -1566,7 +1566,7 @@ int LoadUnloadVehicle(Vehicle *v, bool just_arrived)
ShowFeederIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, virtual_profit_total);
}
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
/* Each platform tile is worth 2 rail vehicles. */
int overhang = v->u.rail.cached_total_length - st->GetPlatformLength(v->tile) * TILE_SIZE;
if (overhang > 0) {
diff --git a/src/elrail.cpp b/src/elrail.cpp
index 73f91a298..10b44e0b3 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -418,7 +418,7 @@ int32 SettingsDisableElrail(int32 p1)
* normal rail too */
if (disable) {
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && v->u.rail.railtype == RAILTYPE_ELECTRIC) {
+ if (v->type == VEH_TRAIN && v->u.rail.railtype == RAILTYPE_ELECTRIC) {
/* this railroad vehicle is now compatible only with elrail,
* so add there also normal rail compatibility */
v->u.rail.compatible_railtypes |= (1 << RAILTYPE_RAIL);
@@ -431,7 +431,7 @@ int32 SettingsDisableElrail(int32 p1)
/* setup total power for trains */
FOR_ALL_VEHICLES(v) {
/* power is cached only for front engines */
- if (v->type == VEH_Train && IsFrontEngine(v)) TrainPowerChanged(v);
+ if (v->type == VEH_TRAIN && IsFrontEngine(v)) TrainPowerChanged(v);
}
FOR_ALL_PLAYERS(p) p->avail_railtypes = GetPlayerRailtypes(p->index);
diff --git a/src/engine.cpp b/src/engine.cpp
index b9cd25cf0..862c0b10d 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -96,10 +96,10 @@ void AddTypeToEngines()
{
Engine* e = _engines;
- do e->type = VEH_Train; while (++e < &_engines[ROAD_ENGINES_INDEX]);
- do e->type = VEH_Road; while (++e < &_engines[SHIP_ENGINES_INDEX]);
- do e->type = VEH_Ship; while (++e < &_engines[AIRCRAFT_ENGINES_INDEX]);
- do e->type = VEH_Aircraft; while (++e < &_engines[TOTAL_NUM_ENGINES]);
+ do e->type = VEH_TRAIN; while (++e < &_engines[ROAD_ENGINES_INDEX]);
+ do e->type = VEH_ROAD; while (++e < &_engines[SHIP_ENGINES_INDEX]);
+ do e->type = VEH_SHIP; while (++e < &_engines[AIRCRAFT_ENGINES_INDEX]);
+ do e->type = VEH_AIRCRAFT; while (++e < &_engines[TOTAL_NUM_ENGINES]);
}
void StartupEngines()
@@ -169,7 +169,7 @@ static void AcceptEnginePreview(EngineID eid, PlayerID player)
Engine *e = GetEngine(eid);
SETBIT(e->player_avail, player);
- if (e->type == VEH_Train) {
+ if (e->type == VEH_TRAIN) {
const RailVehicleInfo *rvi = RailVehInfo(eid);
Player *p = GetPlayer(player);
@@ -289,8 +289,8 @@ static void NewVehicleAvailable(Engine *e)
p->block_preview = 20;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train || v->type == VEH_Road || v->type == VEH_Ship ||
- (v->type == VEH_Aircraft && IsNormalAircraft(v))) {
+ if (v->type == VEH_TRAIN || v->type == VEH_ROAD || v->type == VEH_SHIP ||
+ (v->type == VEH_AIRCRAFT && IsNormalAircraft(v))) {
if (v->owner == p->index && v->engine_type == index) {
/* The user did prove me wrong, so restore old value */
p->block_preview = block_preview;
diff --git a/src/engine.h b/src/engine.h
index cd6b0948e..192d7399a 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -111,7 +111,7 @@ struct Engine {
PlayerByte preview_player;
byte preview_wait;
byte player_avail;
- byte type; ///< type, ie VEH_Road, VEH_Train, etc. Same as in vehicle.h
+ byte type; ///< type, ie VEH_ROAD, VEH_TRAIN, etc. Same as in vehicle.h
};
/**
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
index 6426f724e..3342f3728 100644
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -22,10 +22,10 @@ static StringID GetEngineCategoryName(EngineID engine)
{
switch (GetEngine(engine)->type) {
default: NOT_REACHED();
- case VEH_Road: return STR_8103_ROAD_VEHICLE;
- case VEH_Aircraft: return STR_8104_AIRCRAFT;
- case VEH_Ship: return STR_8105_SHIP;
- case VEH_Train:
+ case VEH_ROAD: return STR_8103_ROAD_VEHICLE;
+ case VEH_AIRCRAFT: return STR_8104_AIRCRAFT;
+ case VEH_SHIP: return STR_8105_SHIP;
+ case VEH_TRAIN:
switch (RailVehInfo(engine)->railtype) {
default: NOT_REACHED();
case RAILTYPE_RAIL: return STR_8102_RAILROAD_LOCOMOTIVE;
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index b813c3ebd..4d3aeda49 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -265,22 +265,22 @@ static void MenuClickIndustry(int index)
static void MenuClickShowTrains(int index)
{
- ShowVehicleListWindow((PlayerID)index, VEH_Train);
+ ShowVehicleListWindow((PlayerID)index, VEH_TRAIN);
}
static void MenuClickShowRoad(int index)
{
- ShowVehicleListWindow((PlayerID)index, VEH_Road);
+ ShowVehicleListWindow((PlayerID)index, VEH_ROAD);
}
static void MenuClickShowShips(int index)
{
- ShowVehicleListWindow((PlayerID)index, VEH_Ship);
+ ShowVehicleListWindow((PlayerID)index, VEH_SHIP);
}
static void MenuClickShowAir(int index)
{
- ShowVehicleListWindow((PlayerID)index, VEH_Aircraft);
+ ShowVehicleListWindow((PlayerID)index, VEH_AIRCRAFT);
}
static void MenuClickBuildRail(int index)
@@ -812,7 +812,7 @@ static void ToolbarTrainClick(Window *w)
int dis = -1;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && IsFrontEngine(v)) CLRBIT(dis, v->owner);
+ if (v->type == VEH_TRAIN && IsFrontEngine(v)) CLRBIT(dis, v->owner);
}
PopupMainPlayerToolbMenu(w, 310, 13, dis);
}
@@ -823,7 +823,7 @@ static void ToolbarRoadClick(Window *w)
int dis = -1;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Road) CLRBIT(dis, v->owner);
+ if (v->type == VEH_ROAD) CLRBIT(dis, v->owner);
}
PopupMainPlayerToolbMenu(w, 332, 14, dis);
}
@@ -834,7 +834,7 @@ static void ToolbarShipClick(Window *w)
int dis = -1;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Ship) CLRBIT(dis, v->owner);
+ if (v->type == VEH_SHIP) CLRBIT(dis, v->owner);
}
PopupMainPlayerToolbMenu(w, 354, 15, dis);
}
@@ -845,7 +845,7 @@ static void ToolbarAirClick(Window *w)
int dis = -1;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Aircraft) CLRBIT(dis, v->owner);
+ if (v->type == VEH_AIRCRAFT) CLRBIT(dis, v->owner);
}
PopupMainPlayerToolbMenu(w, 376, 16, dis);
}
@@ -1841,10 +1841,10 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e)
case WKC_F10:ShowOperatingProfitGraph(); break;
case WKC_F11: ShowCompanyLeagueTable(); break;
case WKC_F12: ShowBuildIndustryWindow(); break;
- case WKC_SHIFT | WKC_F1: ShowVehicleListWindow(_local_player, VEH_Train); break;
- case WKC_SHIFT | WKC_F2: ShowVehicleListWindow(_local_player, VEH_Road); break;
- case WKC_SHIFT | WKC_F3: ShowVehicleListWindow(_local_player, VEH_Ship); break;
- case WKC_SHIFT | WKC_F4: ShowVehicleListWindow(_local_player, VEH_Aircraft); break;
+ case WKC_SHIFT | WKC_F1: ShowVehicleListWindow(_local_player, VEH_TRAIN); break;
+ case WKC_SHIFT | WKC_F2: ShowVehicleListWindow(_local_player, VEH_ROAD); break;
+ case WKC_SHIFT | WKC_F3: ShowVehicleListWindow(_local_player, VEH_SHIP); break;
+ case WKC_SHIFT | WKC_F4: ShowVehicleListWindow(_local_player, VEH_AIRCRAFT); break;
case WKC_SHIFT | WKC_F5: ToolbarZoomInClick(w); break;
case WKC_SHIFT | WKC_F6: ToolbarZoomOutClick(w); break;
case WKC_SHIFT | WKC_F7: ShowBuildRailToolbar(_last_built_railtype, -1); break;
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 84a86e14c..110fb4bd6 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -1281,11 +1281,11 @@ void NetworkPopulateCompanyInfo()
if (!IsValidPlayer(v->owner)) continue;
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
if (IsFrontEngine(v)) _network_player_info[v->owner].num_vehicle[0]++;
break;
- case VEH_Road:
+ case VEH_ROAD:
if (v->cargo_type != CT_PASSENGERS) {
_network_player_info[v->owner].num_vehicle[1]++;
} else {
@@ -1293,16 +1293,16 @@ void NetworkPopulateCompanyInfo()
}
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
if (IsNormalAircraft(v)) _network_player_info[v->owner].num_vehicle[3]++;
break;
- case VEH_Ship:
+ case VEH_SHIP:
_network_player_info[v->owner].num_vehicle[4]++;
break;
- case VEH_Special:
- case VEH_Disaster:
+ case VEH_SPECIAL:
+ case VEH_DISASTER:
break;
}
}
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 56ed3988a..ea30c6eec 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -3872,7 +3872,7 @@ static void CalculateRefitMasks()
} else {
// Don't apply default refit mask to wagons or engines with no capacity
if (xor_mask == 0 && (
- GetEngine(engine)->type != VEH_Train || (
+ GetEngine(engine)->type != VEH_TRAIN || (
RailVehInfo(engine)->capacity != 0 &&
RailVehInfo(engine)->railveh_type != RAILVEH_WAGON
)
@@ -3895,17 +3895,17 @@ static void CalculateRefitMasks()
/* Check if this engine's cargo type is valid. If not, set to the first refittable
* cargo type. Apparently cargo_type isn't a common property... */
switch (GetEngine(engine)->type) {
- case VEH_Train: {
+ case VEH_TRAIN: {
RailVehicleInfo *rvi = &_rail_vehicle_info[engine];
if (rvi->cargo_type == CT_INVALID) rvi->cargo_type = FindFirstRefittableCargo(engine);
break;
}
- case VEH_Road: {
+ case VEH_ROAD: {
RoadVehicleInfo *rvi = &_road_vehicle_info[engine - ROAD_ENGINES_INDEX];
if (rvi->cargo_type == CT_INVALID) rvi->cargo_type = FindFirstRefittableCargo(engine);
break;
}
- case VEH_Ship: {
+ case VEH_SHIP: {
ShipVehicleInfo *svi = &_ship_vehicle_info[engine - SHIP_ENGINES_INDEX];
if (svi->cargo_type == CT_INVALID) svi->cargo_type = FindFirstRefittableCargo(engine);
break;
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index dc4ad2766..71fefdbb5 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -195,7 +195,7 @@ uint32 GetEngineGRFID(EngineID engine)
static int MapOldSubType(const Vehicle *v)
{
- if (v->type != VEH_Train) return v->subtype;
+ if (v->type != VEH_TRAIN) return v->subtype;
if (IsTrainEngine(v)) return 0;
if (IsFreeWagon(v)) return 4;
return 2;
@@ -489,7 +489,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
switch (variable) {
case 0x40: /* Get length of consist */
case 0x41: /* Get length of same consecutive wagons */
- if (v->type != VEH_Train) return 1;
+ if (v->type != VEH_TRAIN) return 1;
{
const Vehicle* u;
@@ -545,7 +545,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
return v->owner;
case 0x44: /* Aircraft information */
- if (v->type != VEH_Aircraft) return UINT_MAX;
+ if (v->type != VEH_AIRCRAFT) return UINT_MAX;
{
const Vehicle *w = v->next;
@@ -590,7 +590,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
/* Variables which use the parameter */
case 0x60: /* Count consist's engine ID occurance */
- if (v->type != VEH_Train) return v->engine_type == parameter;
+ if (v->type != VEH_TRAIN) return v->engine_type == parameter;
{
uint count = 0;
@@ -699,7 +699,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
/* Vehicle specific properties */
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
switch (variable - 0x80) {
case 0x62: return v->u.rail.track;
case 0x66: return v->u.rail.railtype;
@@ -714,7 +714,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
}
break;
- case VEH_Road:
+ case VEH_ROAD:
switch (variable - 0x80) {
case 0x62: return v->u.road.state;
case 0x64: return v->u.road.blocked_ctr;
@@ -726,7 +726,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
}
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
switch (variable - 0x80) {
case 0x62: return MapAircraftMovementState(v); // Current movement state
case 0x63: return v->u.air.targetairport; // Airport to which the action refers
@@ -751,7 +751,7 @@ static const SpriteGroup *VehicleResolveReal(const ResolverObject *object, const
if (v == NULL) return group->g.real.loading[0];
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
in_motion = GetFirstVehicleInChain(v)->current_order.type != OT_LOADING;
} else {
in_motion = v->current_order.type != OT_LOADING;
@@ -780,7 +780,7 @@ static inline void NewVehicleResolver(ResolverObject *res, EngineID engine_type,
res->ResolveReal = &VehicleResolveReal;
res->u.vehicle.self = v;
- res->u.vehicle.parent = (v != NULL && v->type == VEH_Train) ? GetFirstVehicleInChain(v) : v;
+ res->u.vehicle.parent = (v != NULL && v->type == VEH_TRAIN) ? GetFirstVehicleInChain(v) : v;
res->u.vehicle.self_type = engine_type;
@@ -812,7 +812,7 @@ static const SpriteGroup *GetVehicleSpriteGroup(EngineID engine, const Vehicle *
} else {
cargo = v->cargo_type;
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
group = GetWagonOverrideSpriteSet(engine, cargo, v->u.rail.first_engine);
if (group != NULL) return group;
@@ -874,7 +874,7 @@ SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle *v, bool info_vie
*/
bool UsesWagonOverride(const Vehicle* v)
{
- assert(v->type == VEH_Train);
+ assert(v->type == VEH_TRAIN);
return GetWagonOverrideSpriteSet(v->engine_type, v->cargo_type, v->u.rail.first_engine) != NULL;
}
@@ -962,7 +962,7 @@ static void DoTriggerVehicle(Vehicle *v, VehicleTrigger trigger, byte base_rando
* i.e.), so we give them all the NEW_CARGO triggered
* vehicle's portion of random bits. */
assert(first);
- DoTriggerVehicle((v->type == VEH_Train) ? GetFirstVehicleInChain(v) : v, VEHICLE_TRIGGER_ANY_NEW_CARGO, new_random_bits, false);
+ DoTriggerVehicle((v->type == VEH_TRAIN) ? GetFirstVehicleInChain(v) : v, VEHICLE_TRIGGER_ANY_NEW_CARGO, new_random_bits, false);
break;
case VEHICLE_TRIGGER_DEPOT:
diff --git a/src/npf.cpp b/src/npf.cpp
index 5138d6401..8ded2d8c2 100644
--- a/src/npf.cpp
+++ b/src/npf.cpp
@@ -888,7 +888,7 @@ void NPFFillWithOrderData(NPFFindStationOrTileData* fstd, Vehicle* v)
* dest_tile, not just any stop of that station.
* So only for train orders to stations we fill fstd->station_index, for all
* others only dest_coords */
- if (v->current_order.type == OT_GOTO_STATION && v->type == VEH_Train) {
+ if (v->current_order.type == OT_GOTO_STATION && v->type == VEH_TRAIN) {
fstd->station_index = v->current_order.dest;
/* Let's take the closest tile of the station as our target for trains */
fstd->dest_coords = CalcClosestStationTile(v->current_order.dest, v->tile);
diff --git a/src/oldloader.cpp b/src/oldloader.cpp
index 4ccfc8cd0..bdf1cf9e6 100644
--- a/src/oldloader.cpp
+++ b/src/oldloader.cpp
@@ -1068,13 +1068,13 @@ static bool LoadOldVehicleUnion(LoadgameState *ls, int num)
* Basically v->type -= 0x10; would suffice, but play safely */
switch (v->type) {
default: NOT_REACHED();
- case 0x00 /*VEH_Invalid */: v->type = VEH_Invalid; res = LoadChunk(ls, NULL, vehicle_empty_chunk); break;
- case 0x10 /*VEH_Train */: v->type = VEH_Train; res = LoadChunk(ls, &v->u.rail, vehicle_train_chunk); break;
- case 0x11 /*VEH_Road */: v->type = VEH_Road; res = LoadChunk(ls, &v->u.road, vehicle_road_chunk); break;
- case 0x12 /*VEH_Ship */: v->type = VEH_Ship; res = LoadChunk(ls, &v->u.ship, vehicle_ship_chunk); break;
- case 0x13 /*VEH_Aircraft*/: v->type = VEH_Aircraft; res = LoadChunk(ls, &v->u.air, vehicle_air_chunk); break;
- case 0x14 /*VEH_Special */: v->type = VEH_Special; res = LoadChunk(ls, &v->u.special, vehicle_special_chunk); break;
- case 0x15 /*VEH_Disaster*/: v->type = VEH_Disaster; res = LoadChunk(ls, &v->u.disaster, vehicle_disaster_chunk); break;
+ case 0x00 /*VEH_INVALID */: v->type = VEH_INVALID; res = LoadChunk(ls, NULL, vehicle_empty_chunk); break;
+ case 0x10 /*VEH_TRAIN */: v->type = VEH_TRAIN; res = LoadChunk(ls, &v->u.rail, vehicle_train_chunk); break;
+ case 0x11 /*VEH_ROAD */: v->type = VEH_ROAD; res = LoadChunk(ls, &v->u.road, vehicle_road_chunk); break;
+ case 0x12 /*VEH_SHIP */: v->type = VEH_SHIP; res = LoadChunk(ls, &v->u.ship, vehicle_ship_chunk); break;
+ case 0x13 /*VEH_AIRCRAFT*/: v->type = VEH_AIRCRAFT; res = LoadChunk(ls, &v->u.air, vehicle_air_chunk); break;
+ case 0x14 /*VEH_SPECIAL */: v->type = VEH_SPECIAL; res = LoadChunk(ls, &v->u.special, vehicle_special_chunk); break;
+ case 0x15 /*VEH_DISASTER*/: v->type = VEH_DISASTER; res = LoadChunk(ls, &v->u.disaster, vehicle_disaster_chunk); break;
}
/* This chunk size should always be 10 bytes */
@@ -1209,7 +1209,7 @@ static bool LoadOldVehicle(LoadgameState *ls, int num)
v->string_id = RemapOldStringID(_old_string_id);
/* Vehicle-subtype is different in TTD(Patch) */
- if (v->type == VEH_Special) v->subtype = v->subtype >> 1;
+ if (v->type == VEH_SPECIAL) v->subtype = v->subtype >> 1;
}
return true;
diff --git a/src/openttd.cpp b/src/openttd.cpp
index b212d318e..0452d6ab8 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1445,7 +1445,7 @@ bool AfterLoadGame()
}
FOR_ALL_VEHICLES(v) {
- if (v->type != VEH_Train && v->type != VEH_Road) continue;
+ if (v->type != VEH_TRAIN && v->type != VEH_ROAD) continue;
if (IsBridgeTile(v->tile)) {
DiagDirection dir = GetBridgeRampDirection(v->tile);
@@ -1462,7 +1462,7 @@ bool AfterLoadGame()
} else {
continue;
}
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
v->u.rail.track = TRACK_BIT_WORMHOLE;
} else {
v->u.road.state = RVSB_WORMHOLE;
@@ -1504,7 +1504,7 @@ bool AfterLoadGame()
RailType min_rail = RAILTYPE_ELECTRIC;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
RailType rt = RailVehInfo(v->engine_type)->railtype;
v->u.rail.railtype = rt;
@@ -1549,7 +1549,7 @@ bool AfterLoadGame()
}
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && (IsFrontEngine(v) || IsFreeWagon(v))) TrainConsistChanged(v);
+ if (v->type == VEH_TRAIN && (IsFrontEngine(v) || IsFreeWagon(v))) TrainConsistChanged(v);
}
}
@@ -1641,7 +1641,7 @@ bool AfterLoadGame()
if (CheckSavegameVersion(25)) {
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Road) {
+ if (v->type == VEH_ROAD) {
v->vehstatus &= ~0x40;
v->u.road.slot = NULL;
v->u.road.slot_age = 0;
@@ -1650,14 +1650,14 @@ bool AfterLoadGame()
} else {
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Road && v->u.road.slot != NULL) v->u.road.slot->num_vehicles++;
+ if (v->type == VEH_ROAD && v->u.road.slot != NULL) v->u.road.slot->num_vehicles++;
}
}
if (CheckSavegameVersion(26)) {
Station *st;
FOR_ALL_STATIONS(st) {
- st->last_vehicle_type = VEH_Invalid;
+ st->last_vehicle_type = VEH_INVALID;
}
}
@@ -1824,7 +1824,7 @@ bool AfterLoadGame()
Vehicle *v;
/* Aircraft units changed from 8 mph to 1 km/h */
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Aircraft && v->subtype <= AIR_AIRCRAFT) {
+ if (v->type == VEH_AIRCRAFT && v->subtype <= AIR_AIRCRAFT) {
const AircraftVehicleInfo *avi = AircraftVehInfo(v->engine_type);
v->cur_speed *= 129;
v->cur_speed /= 10;
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index a703bdaaa..7903d0f57 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -213,11 +213,11 @@ int32 CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
if (!(st->facilities & FACIL_TRAIN)) return CMD_ERROR;
break;
- case VEH_Road:
+ case VEH_ROAD:
if (v->cargo_type == CT_PASSENGERS) {
if (!(st->facilities & FACIL_BUS_STOP)) return CMD_ERROR;
} else {
@@ -225,11 +225,11 @@ int32 CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
break;
- case VEH_Ship:
+ case VEH_SHIP:
if (!(st->facilities & FACIL_DOCK)) return CMD_ERROR;
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
if (!(st->facilities & FACIL_AIRPORT)) return CMD_ERROR;
break;
@@ -254,7 +254,7 @@ int32 CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
case OF_NON_STOP | OF_UNLOAD:
case OF_NON_STOP | OF_UNLOAD | OF_TRANSFER:
case OF_NON_STOP | OF_TRANSFER:
- if (v->type != VEH_Train) return CMD_ERROR;
+ if (v->type != VEH_TRAIN) return CMD_ERROR;
break;
default: return CMD_ERROR;
@@ -263,7 +263,7 @@ int32 CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
case OT_GOTO_DEPOT: {
- if (v->type == VEH_Aircraft) {
+ if (v->type == VEH_AIRCRAFT) {
const Station* st;
if (!IsValidStationID(new_order.dest)) return CMD_ERROR;
@@ -283,15 +283,15 @@ int32 CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (!CheckOwnership(GetTileOwner(dp->xy))) return CMD_ERROR;
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
if (!IsTileDepotType(dp->xy, TRANSPORT_RAIL)) return CMD_ERROR;
break;
- case VEH_Road:
+ case VEH_ROAD:
if (!IsTileDepotType(dp->xy, TRANSPORT_ROAD)) return CMD_ERROR;
break;
- case VEH_Ship:
+ case VEH_SHIP:
if (!IsTileDepotType(dp->xy, TRANSPORT_WATER)) return CMD_ERROR;
break;
@@ -309,7 +309,7 @@ int32 CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
case OF_NON_STOP | OF_PART_OF_ORDERS:
case OF_NON_STOP | OF_PART_OF_ORDERS | OF_HALT_IN_DEPOT:
- if (v->type != VEH_Train) return CMD_ERROR;
+ if (v->type != VEH_TRAIN) return CMD_ERROR;
break;
default: return CMD_ERROR;
@@ -320,7 +320,7 @@ int32 CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
case OT_GOTO_WAYPOINT: {
const Waypoint* wp;
- if (v->type != VEH_Train) return CMD_ERROR;
+ if (v->type != VEH_TRAIN) return CMD_ERROR;
if (!IsValidWaypointID(new_order.dest)) return CMD_ERROR;
wp = GetWaypoint(new_order.dest);
@@ -334,7 +334,7 @@ int32 CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
case 0: break;
case OF_NON_STOP:
- if (v->type != VEH_Train) return CMD_ERROR;
+ if (v->type != VEH_TRAIN) return CMD_ERROR;
break;
default: return CMD_ERROR;
@@ -353,7 +353,7 @@ int32 CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
* handle any more then this.. */
if (v->num_orders >= MAX_BACKUP_ORDER_COUNT) return_cmd_error(STR_8832_TOO_MANY_ORDERS);
- if (v->type == VEH_Ship &&
+ if (v->type == VEH_SHIP &&
IsHumanPlayer(v->owner) &&
!_patches.new_pathfinding_all) {
// Make sure the new destination is not too far away from the previous
@@ -553,9 +553,9 @@ int32 CmdSkipOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->cur_order_index = b;
- if (v->type == VEH_Train) v->u.rail.days_since_order_progr = 0;
+ if (v->type == VEH_TRAIN) v->u.rail.days_since_order_progr = 0;
- if (v->type == VEH_Road) ClearSlot(v);
+ if (v->type == VEH_ROAD) ClearSlot(v);
/* NON-stop flag is misused to see if a train is in a station that is
* on his order list or not */
@@ -566,8 +566,8 @@ int32 CmdSkipOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
/* We have an aircraft/ship, they have a mini-schedule, so update them all */
- if (v->type == VEH_Aircraft) InvalidateWindowClasses(WC_AIRCRAFT_LIST);
- if (v->type == VEH_Ship) InvalidateWindowClasses(WC_SHIPS_LIST);
+ if (v->type == VEH_AIRCRAFT) InvalidateWindowClasses(WC_AIRCRAFT_LIST);
+ if (v->type == VEH_SHIP) InvalidateWindowClasses(WC_SHIPS_LIST);
return 0;
}
@@ -685,7 +685,7 @@ int32 CmdCloneOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return CMD_ERROR;
/* Trucks can't share orders with busses (and visa versa) */
- if (src->type == VEH_Road) {
+ if (src->type == VEH_ROAD) {
if (src->cargo_type != dst->cargo_type && (src->cargo_type == CT_PASSENGERS || dst->cargo_type == CT_PASSENGERS))
return CMD_ERROR;
}
@@ -732,7 +732,7 @@ int32 CmdCloneOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return CMD_ERROR;
/* Trucks can't copy all the orders from busses (and visa versa) */
- if (src->type == VEH_Road) {
+ if (src->type == VEH_ROAD) {
const Order *order;
TileIndex required_dst = INVALID_TILE;
@@ -951,10 +951,10 @@ static TileIndex GetStationTileForVehicle(const Vehicle* v, const Station* st)
{
switch (v->type) {
default: NOT_REACHED();
- case VEH_Train: return st->train_tile;
- case VEH_Aircraft: return st->airport_tile;
- case VEH_Ship: return st->dock_tile;
- case VEH_Road:
+ case VEH_TRAIN: return st->train_tile;
+ case VEH_AIRCRAFT: return st->airport_tile;
+ case VEH_SHIP: return st->dock_tile;
+ case VEH_ROAD:
if (v->cargo_type == CT_PASSENGERS) {
return (st->bus_stops != NULL) ? st->bus_stops->xy : 0;
} else {
@@ -1063,7 +1063,7 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination)
}
order = &v->current_order;
- if ((v->type == VEH_Aircraft && order->type == OT_GOTO_DEPOT ? OT_GOTO_STATION : order->type) == type &&
+ if ((v->type == VEH_AIRCRAFT && order->type == OT_GOTO_DEPOT ? OT_GOTO_STATION : order->type) == type &&
v->current_order.dest == destination) {
order->type = OT_DUMMY;
order->flags = 0;
@@ -1073,7 +1073,7 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination)
/* Clear the order from the order-list */
invalidate = false;
FOR_VEHICLE_ORDERS(v, order) {
- if ((v->type == VEH_Aircraft && order->type == OT_GOTO_DEPOT ? OT_GOTO_STATION : order->type) == type &&
+ if ((v->type == VEH_AIRCRAFT && order->type == OT_GOTO_DEPOT ? OT_GOTO_STATION : order->type) == type &&
order->dest == destination) {
order->type = OT_DUMMY;
order->flags = 0;
@@ -1156,10 +1156,10 @@ void DeleteVehicleOrders(Vehicle *v)
switch (v->type) {
default: NOT_REACHED();
- case VEH_Train: window_class = WC_TRAINS_LIST; break;
- case VEH_Road: window_class = WC_ROADVEH_LIST; break;
- case VEH_Ship: window_class = WC_SHIPS_LIST; break;
- case VEH_Aircraft: window_class = WC_AIRCRAFT_LIST; break;
+ case VEH_TRAIN: window_class = WC_TRAINS_LIST; break;
+ case VEH_ROAD: window_class = WC_ROADVEH_LIST; break;
+ case VEH_SHIP: window_class = WC_SHIPS_LIST; break;
+ case VEH_AIRCRAFT: window_class = WC_AIRCRAFT_LIST; break;
}
DeleteWindowById(window_class, (cur->index << 16) | (v->type << 11) | VLW_SHARED_ORDERS | v->owner);
}
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 7cc9c9492..abfe792dd 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -98,7 +98,7 @@ static void DrawOrdersWindow(Window *w)
(uint)v->num_orders + ((shared_orders || v->num_orders != 0) ? 1 : 0) <= (uint)WP(w, order_d).sel);
/* non-stop only for trains */
- SetWindowWidgetDisabledState(w, ORDER_WIDGET_NON_STOP, v->type != VEH_Train || order == NULL);
+ SetWindowWidgetDisabledState(w, ORDER_WIDGET_NON_STOP, v->type != VEH_TRAIN || order == NULL);
SetWindowWidgetDisabledState(w, ORDER_WIDGET_FULL_LOAD, order == NULL); // full load
SetWindowWidgetDisabledState(w, ORDER_WIDGET_UNLOAD, order == NULL); // unload
SetWindowWidgetDisabledState(w, ORDER_WIDGET_TRANSFER, order == NULL); // transfer
@@ -162,16 +162,16 @@ static void DrawOrdersWindow(Window *w)
case OT_GOTO_DEPOT: {
StringID s = STR_NULL;
- if (v->type == VEH_Aircraft) {
+ if (v->type == VEH_AIRCRAFT) {
s = STR_GO_TO_AIRPORT_HANGAR;
SetDParam(2, order->dest);
} else {
SetDParam(2, GetDepot(order->dest)->town_index);
switch (v->type) {
- case VEH_Train: s = (order->flags & OF_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break;
- case VEH_Road: s = STR_9038_GO_TO_ROADVEH_DEPOT; break;
- case VEH_Ship: s = STR_GO_TO_SHIP_DEPOT; break;
+ case VEH_TRAIN: s = (order->flags & OF_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break;
+ case VEH_ROAD: s = STR_9038_GO_TO_ROADVEH_DEPOT; break;
+ case VEH_SHIP: s = STR_GO_TO_SHIP_DEPOT; break;
default: break;
}
}
@@ -231,7 +231,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
if (_patches.gotodepot) {
switch (GetTileType(tile)) {
case MP_RAILWAY:
- if (v->type == VEH_Train && IsTileOwner(tile, _local_player)) {
+ if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) {
if (IsRailDepot(tile)) {
order.type = OT_GOTO_DEPOT;
order.flags = OF_PART_OF_ORDERS;
@@ -242,7 +242,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
break;
case MP_STREET:
- if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && v->type == VEH_Road && IsTileOwner(tile, _local_player)) {
+ if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
order.type = OT_GOTO_DEPOT;
order.flags = OF_PART_OF_ORDERS;
order.dest = GetDepotByTile(tile)->index;
@@ -251,7 +251,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
break;
case MP_STATION:
- if (v->type != VEH_Aircraft) break;
+ if (v->type != VEH_AIRCRAFT) break;
if (IsHangar(tile) && IsTileOwner(tile, _local_player)) {
order.type = OT_GOTO_DEPOT;
order.flags = OF_PART_OF_ORDERS;
@@ -261,7 +261,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
break;
case MP_WATER:
- if (v->type != VEH_Ship) break;
+ if (v->type != VEH_SHIP) break;
if (IsTileDepotType(tile, TRANSPORT_WATER) &&
IsTileOwner(tile, _local_player)) {
TileIndex tile2 = GetOtherShipDepotTile(tile);
@@ -279,7 +279,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
// check waypoint
if (IsTileType(tile, MP_RAILWAY) &&
- v->type == VEH_Train &&
+ v->type == VEH_TRAIN &&
IsTileOwner(tile, _local_player) &&
IsRailWaypoint(tile)) {
order.type = OT_GOTO_WAYPOINT;
@@ -294,10 +294,10 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
if (st->owner == _current_player || st->owner == OWNER_NONE) {
byte facil;
- (facil=FACIL_DOCK, v->type == VEH_Ship) ||
- (facil=FACIL_TRAIN, v->type == VEH_Train) ||
- (facil=FACIL_AIRPORT, v->type == VEH_Aircraft) ||
- (facil=FACIL_BUS_STOP, v->type == VEH_Road && v->cargo_type == CT_PASSENGERS) ||
+ (facil=FACIL_DOCK, v->type == VEH_SHIP) ||
+ (facil=FACIL_TRAIN, v->type == VEH_TRAIN) ||
+ (facil=FACIL_AIRPORT, v->type == VEH_AIRCRAFT) ||
+ (facil=FACIL_BUS_STOP, v->type == VEH_ROAD && v->cargo_type == CT_PASSENGERS) ||
(facil=FACIL_TRUCK_STOP, 1);
if (st->facilities & facil) {
order.type = OT_GOTO_STATION;
@@ -319,7 +319,7 @@ static bool HandleOrderVehClick(const Vehicle *v, const Vehicle *u, Window *w)
{
if (u->type != v->type) return false;
- if (u->type == VEH_Train && !IsFrontEngine(u)) {
+ if (u->type == VEH_TRAIN && !IsFrontEngine(u)) {
u = GetFirstVehicleInChain(u);
if (!IsFrontEngine(u)) return false;
}
@@ -465,7 +465,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
switch (ord->type) {
case OT_GOTO_STATION: xy = GetStation(ord->dest)->xy ; break;
- case OT_GOTO_DEPOT: xy = (v->type == VEH_Aircraft) ? GetStation(ord->dest)->xy : GetDepot(ord->dest)->xy; break;
+ case OT_GOTO_DEPOT: xy = (v->type == VEH_AIRCRAFT) ? GetStation(ord->dest)->xy : GetDepot(ord->dest)->xy; break;
case OT_GOTO_WAYPOINT: xy = GetWaypoint(ord->dest)->xy; break;
default: xy = 0; break;
}
@@ -677,7 +677,7 @@ void ShowOrdersWindow(const Vehicle *v)
if (v->owner != _local_player) {
w = AllocateWindowDescFront(&_other_orders_desc, veh);
} else {
- w = AllocateWindowDescFront((v->type == VEH_Train) ? &_orders_train_desc : &_orders_desc, veh);
+ w = AllocateWindowDescFront((v->type == VEH_TRAIN) ? &_orders_train_desc : &_orders_desc, veh);
}
if (w != NULL) {
diff --git a/src/player_gui.cpp b/src/player_gui.cpp
index b7a1f941a..485a39165 100644
--- a/src/player_gui.cpp
+++ b/src/player_gui.cpp
@@ -645,10 +645,10 @@ static void DrawPlayerVehiclesAmount(PlayerID player)
FOR_ALL_VEHICLES(v) {
if (v->owner == player) {
switch (v->type) {
- case VEH_Train: if (IsFrontEngine(v)) train++; break;
- case VEH_Road: road++; break;
- case VEH_Aircraft: if (IsNormalAircraft(v)) air++; break;
- case VEH_Ship: ship++; break;
+ case VEH_TRAIN: if (IsFrontEngine(v)) train++; break;
+ case VEH_ROAD: road++; break;
+ case VEH_AIRCRAFT: if (IsNormalAircraft(v)) air++; break;
+ case VEH_SHIP: ship++; break;
default: break;
}
}
diff --git a/src/players.cpp b/src/players.cpp
index 2eaa45933..1da49754e 100644
--- a/src/players.cpp
+++ b/src/players.cpp
@@ -593,7 +593,7 @@ byte GetPlayerRailtypes(PlayerID p)
const Engine* e = GetEngine(i);
const EngineInfo *ei = EngInfo(i);
- if (e->type == VEH_Train && HASBIT(ei->climates, _opt.landscape) &&
+ if (e->type == VEH_TRAIN && HASBIT(ei->climates, _opt.landscape) &&
(HASBIT(e->player_avail, p) || _date >= e->intro_date + 365)) {
const RailVehicleInfo *rvi = RailVehInfo(i);
@@ -704,7 +704,7 @@ int32 CmdSetAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return CMD_ERROR;
// make sure that we do not replace a plane with a helicopter or vise versa
- if (GetEngine(new_engine_type)->type == VEH_Aircraft &&
+ if (GetEngine(new_engine_type)->type == VEH_AIRCRAFT &&
(AircraftVehInfo(old_engine_type)->subtype & AIR_CTOL) != (AircraftVehInfo(new_engine_type)->subtype & AIR_CTOL))
return CMD_ERROR;
@@ -743,7 +743,7 @@ int32 CmdSetAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
p->renew_keep_length = (bool)GB(p2, 0, 1);
if (IsLocalPlayer()) {
- InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train);
+ InvalidateWindow(WC_REPLACE_VEHICLE, VEH_TRAIN);
}
}
break;
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 6f4143f03..0bb915ec1 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -879,7 +879,7 @@ static int32 DoConvertRail(TileIndex tile, RailType totype, bool exec)
/* update power of trains in this depot */
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && IsFrontEngine(v) && v->tile == tile && v->u.rail.track == 0x80) {
+ if (v->type == VEH_TRAIN && IsFrontEngine(v) && v->tile == tile && v->u.rail.track == 0x80) {
TrainPowerChanged(v);
}
}
@@ -1482,7 +1482,7 @@ static void *SignalVehicleCheckProc(Vehicle *v, void *data)
{
const SignalVehicleCheckStruct* dest = (SignalVehicleCheckStruct*)data;
- if (v->type != VEH_Train) return NULL;
+ if (v->type != VEH_TRAIN) return NULL;
/* Wrong tile, or no train? Not a match */
if (v->tile != dest->tile) return NULL;
@@ -1888,7 +1888,7 @@ static uint32 GetTileTrackStatus_Track(TileIndex tile, TransportType mode)
static void ClickTile_Track(TileIndex tile)
{
switch (GetRailTileType(tile)) {
- case RAIL_TILE_DEPOT: ShowDepotWindow(tile, VEH_Train); break;
+ case RAIL_TILE_DEPOT: ShowDepotWindow(tile, VEH_TRAIN); break;
case RAIL_TILE_WAYPOINT: ShowRenameWaypointWindow(GetWaypointByTile(tile)); break;
default: break;
}
@@ -1951,7 +1951,7 @@ static uint32 VehicleEnter_Track(Vehicle *v, TileIndex tile, int x, int y)
int length;
// this routine applies only to trains in depot tiles
- if (v->type != VEH_Train || !IsTileDepotType(tile, TRANSPORT_RAIL)) return VETSB_CONTINUE;
+ if (v->type != VEH_TRAIN || !IsTileDepotType(tile, TRANSPORT_RAIL)) return VETSB_CONTINUE;
/* depot direction */
dir = GetRailDepotDirection(tile);
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 4445f6ee3..f5213a787 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -935,7 +935,7 @@ static void TileLoop_Road(TileIndex tile)
static void ClickTile_Road(TileIndex tile)
{
- if (GetRoadTileType(tile) == ROAD_TILE_DEPOT) ShowDepotWindow(tile, VEH_Road);
+ if (GetRoadTileType(tile) == ROAD_TILE_DEPOT) ShowDepotWindow(tile, VEH_ROAD);
}
static const byte _road_trackbits[16] = {
@@ -1001,7 +1001,7 @@ static uint32 VehicleEnter_Road(Vehicle *v, TileIndex tile, int x, int y)
{
switch (GetRoadTileType(tile)) {
case ROAD_TILE_CROSSING:
- if (v->type == VEH_Train && !IsCrossingBarred(tile)) {
+ if (v->type == VEH_TRAIN && !IsCrossingBarred(tile)) {
/* train crossing a road */
SndPlayVehicleFx(SND_0E_LEVEL_CROSSING, v);
BarCrossing(tile);
@@ -1010,7 +1010,7 @@ static uint32 VehicleEnter_Road(Vehicle *v, TileIndex tile, int x, int y)
break;
case ROAD_TILE_DEPOT:
- if (v->type == VEH_Road &&
+ if (v->type == VEH_ROAD &&
v->u.road.frame == 11 &&
_roadveh_enter_depot_unk0[GetRoadDepotDirection(tile)] == v->u.road.state) {
VehicleEnterDepot(v);
diff --git a/src/roadveh.h b/src/roadveh.h
index 7490d35d8..abed18f05 100644
--- a/src/roadveh.h
+++ b/src/roadveh.h
@@ -8,7 +8,7 @@
static inline bool IsRoadVehInDepot(const Vehicle* v)
{
- assert(v->type == VEH_Road);
+ assert(v->type == VEH_ROAD);
return v->u.road.state == 254;
}
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index e4e95f21f..f056ef6bf 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -128,7 +128,7 @@ int32 CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
UnitID unit_num;
Engine *e;
- if (!IsEngineBuildable(p1, VEH_Road, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
+ if (!IsEngineBuildable(p1, VEH_ROAD, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
@@ -144,7 +144,7 @@ int32 CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (v == NULL) return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
/* find the first free roadveh id */
- unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_Road);
+ unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_ROAD);
if (unit_num > _patches.max_roadveh)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -200,7 +200,7 @@ int32 CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->date_of_last_service = _date;
v->build_year = _cur_year;
- v->type = VEH_Road;
+ v->type = VEH_ROAD;
v->cur_image = 0xC15;
v->random_bits = VehicleRandomBits();
@@ -213,7 +213,7 @@ int32 CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
RebuildVehicleLists();
InvalidateWindow(WC_COMPANY, v->owner);
if (IsLocalPlayer())
- InvalidateAutoreplaceWindow(VEH_Road); // updates the replace Road window
+ InvalidateAutoreplaceWindow(VEH_ROAD); // updates the replace Road window
GetPlayer(_current_player)->num_engines[p1]++;
}
@@ -235,7 +235,7 @@ int32 CmdStartStopRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v = GetVehicle(p1);
- if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR;
/* Check if this road veh can be started/stopped. The callback will fail or
* return 0xFF if it can. */
@@ -285,7 +285,7 @@ int32 CmdSellRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v = GetVehicle(p1);
- if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
@@ -384,14 +384,14 @@ int32 CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */
if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR;
- return SendAllVehiclesToDepot(VEH_Road, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
+ return SendAllVehiclesToDepot(VEH_ROAD, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
}
if (!IsValidVehicleID(p1)) return CMD_ERROR;
v = GetVehicle(p1);
- if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR;
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
@@ -454,7 +454,7 @@ int32 CmdTurnRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v = GetVehicle(p1);
- if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR;
if (v->vehstatus & VS_STOPPED ||
v->u.road.crashed_ctr != 0 ||
@@ -577,7 +577,7 @@ static void* EnumCheckRoadVehCrashTrain(Vehicle* v, void* data)
const Vehicle* u = (Vehicle*)data;
return
- v->type == VEH_Train &&
+ v->type == VEH_TRAIN &&
myabs(v->z_pos - u->z_pos) <= 6 &&
myabs(v->x_pos - u->x_pos) <= 4 &&
myabs(v->y_pos - u->y_pos) <= 4 ?
@@ -804,7 +804,7 @@ static void* EnumCheckRoadVehClose(Vehicle *v, void* data)
return
rvf->veh != v &&
- v->type == VEH_Road &&
+ v->type == VEH_ROAD &&
!IsRoadVehInDepot(v) &&
myabs(v->z_pos - rvf->veh->z_pos) < 6 &&
v->direction == rvf->dir &&
@@ -945,7 +945,7 @@ static void* EnumFindVehToOvertake(Vehicle* v, void* data)
const OvertakeData* od = (OvertakeData*)data;
return
- v->tile == od->tile && v->type == VEH_Road && v != od->u && v != od->v ?
+ v->tile == od->tile && v->type == VEH_ROAD && v != od->u && v != od->v ?
v : NULL;
}
@@ -1829,7 +1829,7 @@ void RoadVehiclesYearlyLoop()
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Road) {
+ if (v->type == VEH_ROAD) {
v->profit_last_year = v->profit_this_year;
v->profit_this_year = 0;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
@@ -1856,7 +1856,7 @@ int32 CmdRefitRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v = GetVehicle(p1);
- if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR;
if (!IsRoadVehInDepotStopped(v)) return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE);
if (new_cid > NUM_CARGO || !CanRefitTo(v->engine_type, new_cid)) return CMD_ERROR;
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index ce9b26aea..53cf59575 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -82,7 +82,7 @@ static inline bool RoadVehiclesAreBuilt()
const Vehicle* v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Road) return true;
+ if (v->type == VEH_ROAD) return true;
}
return false;
}
diff --git a/src/ship.h b/src/ship.h
index 5c6e13596..e4bfd9f98 100644
--- a/src/ship.h
+++ b/src/ship.h
@@ -12,7 +12,7 @@ void GetShipSpriteSize(EngineID engine, uint &width, uint &height);
static inline bool IsShipInDepot(const Vehicle* v)
{
- assert(v->type == VEH_Ship);
+ assert(v->type == VEH_SHIP);
return v->u.ship.state == 0x80;
}
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 0d7c2d606..54c1b0cfa 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -826,7 +826,7 @@ void ShipsYearlyLoop()
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Ship) {
+ if (v->type == VEH_SHIP) {
v->profit_last_year = v->profit_this_year;
v->profit_this_year = 0;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
@@ -846,7 +846,7 @@ int32 CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
UnitID unit_num;
Engine *e;
- if (!IsEngineBuildable(p1, VEH_Ship, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
+ if (!IsEngineBuildable(p1, VEH_SHIP, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
@@ -859,7 +859,7 @@ int32 CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
v = AllocateVehicle();
- unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_Ship);
+ unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_SHIP);
if (v == NULL || unit_num > _patches.max_ships)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -910,7 +910,7 @@ int32 CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->date_of_last_service = _date;
v->build_year = _cur_year;
v->cur_image = 0x0E5E;
- v->type = VEH_Ship;
+ v->type = VEH_SHIP;
v->random_bits = VehicleRandomBits();
v->vehicle_flags = 0;
@@ -922,7 +922,7 @@ int32 CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
RebuildVehicleLists();
InvalidateWindow(WC_COMPANY, v->owner);
if (IsLocalPlayer())
- InvalidateAutoreplaceWindow(VEH_Ship); // updates the replace Ship window
+ InvalidateAutoreplaceWindow(VEH_SHIP); // updates the replace Ship window
GetPlayer(_current_player)->num_engines[p1]++;
}
@@ -943,7 +943,7 @@ int32 CmdSellShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v = GetVehicle(p1);
- if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_SHIP || !CheckOwnership(v->owner)) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
@@ -977,7 +977,7 @@ int32 CmdStartStopShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v = GetVehicle(p1);
- if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_SHIP || !CheckOwnership(v->owner)) return CMD_ERROR;
/* Check if this ship can be started/stopped. The callback will fail or
* return 0xFF if it can. */
@@ -1016,14 +1016,14 @@ int32 CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */
if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR;
- return SendAllVehiclesToDepot(VEH_Ship, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
+ return SendAllVehiclesToDepot(VEH_SHIP, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
}
if (!IsValidVehicleID(p1)) return CMD_ERROR;
v = GetVehicle(p1);
- if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_SHIP || !CheckOwnership(v->owner)) return CMD_ERROR;
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
@@ -1092,7 +1092,7 @@ int32 CmdRefitShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v = GetVehicle(p1);
- if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_SHIP || !CheckOwnership(v->owner)) return CMD_ERROR;
if (!IsShipInDepotStopped(v)) {
return_cmd_error(STR_980B_SHIP_MUST_BE_STOPPED_IN);
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index a5b6cfaae..cc1388b50 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -691,7 +691,7 @@ skip_column:
byte color;
FOR_ALL_VEHICLES(v) {
- if (v->type != VEH_Special &&
+ if (v->type != VEH_SPECIAL &&
(v->vehstatus & (VS_HIDDEN | VS_UNCLICKABLE)) == 0) {
// Remap into flat coordinates.
Point pt = RemapCoords(
diff --git a/src/station.cpp b/src/station.cpp
index f75e2c2e7..6892c37b4 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -48,7 +48,7 @@ Station::Station(TileIndex tile)
delete_ctr = 0;
facilities = 0;
- last_vehicle_type = VEH_Invalid;
+ last_vehicle_type = VEH_INVALID;
random_bits = 0; // Random() must be called when station is really built (DC_EXEC)
waiting_triggers = 0;
@@ -455,7 +455,7 @@ RoadStop::~RoadStop()
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Road && v->u.road.slot == this) ClearSlot(v);
+ if (v->type == VEH_ROAD && v->u.road.slot == this) ClearSlot(v);
}
}
assert(num_vehicles == 0);
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 72be450e0..77cd046f7 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1670,7 +1670,7 @@ static bool CheckShipsOnBuoy(Station *st)
{
const Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Ship) {
+ if (v->type == VEH_SHIP) {
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
if (order->type == OT_GOTO_STATION && order->dest == st->index) {
@@ -2103,7 +2103,7 @@ static void AnimateTile_Station(TileIndex tile)
static void ClickTile_Station(TileIndex tile)
{
if (IsHangar(tile)) {
- ShowDepotWindow(tile, VEH_Aircraft);
+ ShowDepotWindow(tile, VEH_AIRCRAFT);
} else {
ShowStationViewWindow(GetStationIndex(tile));
}
@@ -2115,7 +2115,7 @@ static const byte _enter_station_speedtable[12] = {
static uint32 VehicleEnter_Station(Vehicle *v, TileIndex tile, int x, int y)
{
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
if (IsRailwayStation(tile) && IsFrontEngine(v) &&
!IsCompatibleTrainStationTile(tile + TileOffsByDiagDir(DirToDiagDir(v->direction)), tile)) {
StationID station_id = GetStationIndex(tile);
@@ -2145,7 +2145,7 @@ static uint32 VehicleEnter_Station(Vehicle *v, TileIndex tile, int x, int y)
}
}
}
- } else if (v->type == VEH_Road) {
+ } else if (v->type == VEH_ROAD) {
if (v->u.road.state < RVSB_IN_ROAD_STOP && !IsReversingRoadTrackdir((Trackdir)v->u.road.state) && v->u.road.frame == 0) {
if (IsRoadStop(tile)) {
/* Attempt to allocate a parking bay in a road stop */
@@ -2234,7 +2234,7 @@ static void UpdateStationRating(Station *st)
{
byte days = ge->days_since_pickup;
- if (st->last_vehicle_type == VEH_Ship)
+ if (st->last_vehicle_type == VEH_SHIP)
days >>= 2;
(days > 21) ||
(rating += 25, days > 12) ||
@@ -2537,7 +2537,7 @@ void BuildOilRig(TileIndex tile)
st->time_since_load = 255;
st->time_since_unload = 255;
st->delete_ctr = 0;
- st->last_vehicle_type = VEH_Invalid;
+ st->last_vehicle_type = VEH_INVALID;
st->facilities = FACIL_AIRPORT | FACIL_DOCK;
st->build_date = _date;
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 059ecaf22..f2ffb7cad 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -756,13 +756,13 @@ static void StationViewWndProc(Window *w, WindowEvent *e)
case 10: { /* Show a list of scheduled trains to this station */
const Station *st = GetStation(w->window_number);
- ShowVehicleListWindow(st->owner, VEH_Train, (StationID)w->window_number);
+ ShowVehicleListWindow(st->owner, VEH_TRAIN, (StationID)w->window_number);
break;
}
case 11: { /* Show a list of scheduled road-vehicles to this station */
const Station *st = GetStation(w->window_number);
- ShowVehicleListWindow(st->owner, VEH_Road, (StationID)w->window_number);
+ ShowVehicleListWindow(st->owner, VEH_ROAD, (StationID)w->window_number);
break;
}
@@ -770,7 +770,7 @@ static void StationViewWndProc(Window *w, WindowEvent *e)
const Station *st = GetStation(w->window_number);
/* Since oilrigs have no owners, show the scheduled aircraft of current player */
PlayerID owner = (st->owner == OWNER_NONE) ? _current_player : st->owner;
- ShowVehicleListWindow(owner, VEH_Aircraft, (StationID)w->window_number);
+ ShowVehicleListWindow(owner, VEH_AIRCRAFT, (StationID)w->window_number);
break;
}
@@ -778,7 +778,7 @@ static void StationViewWndProc(Window *w, WindowEvent *e)
const Station *st = GetStation(w->window_number);
/* Since oilrigs/bouys have no owners, show the scheduled ships of current player */
PlayerID owner = (st->owner == OWNER_NONE) ? _current_player : st->owner;
- ShowVehicleListWindow(owner, VEH_Ship, (StationID)w->window_number);
+ ShowVehicleListWindow(owner, VEH_SHIP, (StationID)w->window_number);
break;
}
}
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 493891567..ad511aa07 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -140,7 +140,7 @@ void TrainConsistChanged(Vehicle* v)
{
uint16 max_speed = 0xFFFF;
- assert(v->type == VEH_Train);
+ assert(v->type == VEH_TRAIN);
assert(IsFrontEngine(v) || IsFreeWagon(v));
const RailVehicleInfo *rvi_v = RailVehInfo(v->engine_type);
@@ -262,7 +262,7 @@ static bool TrainShouldStop(const Vehicle* v, TileIndex tile)
const Order* o = &v->current_order;
StationID sid = GetStationIndex(tile);
- assert(v->type == VEH_Train);
+ assert(v->type == VEH_TRAIN);
//When does a train drive through a station
//first we deal with the "new nonstop handling"
if (_patches.new_nonstop && o->flags & OF_NON_STOP && sid == o->dest) {
@@ -545,7 +545,7 @@ static void AddArticulatedParts(Vehicle **vl)
u->max_age = 0;
u->engine_type = engine_type;
u->value = 0;
- u->type = VEH_Train;
+ u->type = VEH_TRAIN;
u->subtype = 0;
SetArticulatedPart(u);
u->cur_image = 0xAC2;
@@ -580,7 +580,7 @@ static int32 CmdBuildRailWagon(EngineID engine, TileIndex tile, uint32 flags)
Vehicle *w;
FOR_ALL_VEHICLES(w) {
- if (w->type == VEH_Train && w->tile == tile &&
+ if (w->type == VEH_TRAIN && w->tile == tile &&
IsFreeWagon(w) && w->engine_type == engine) {
u = GetLastVehicleInChain(w);
break;
@@ -623,7 +623,7 @@ static int32 CmdBuildRailWagon(EngineID engine, TileIndex tile, uint32 flags)
v->u.rail.railtype = rvi->railtype;
v->build_year = _cur_year;
- v->type = VEH_Train;
+ v->type = VEH_TRAIN;
v->cur_image = 0xAC2;
v->random_bits = VehicleRandomBits();
@@ -636,7 +636,7 @@ static int32 CmdBuildRailWagon(EngineID engine, TileIndex tile, uint32 flags)
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
if (IsLocalPlayer()) {
- InvalidateAutoreplaceWindow(VEH_Train); // updates the replace Train window
+ InvalidateAutoreplaceWindow(VEH_TRAIN); // updates the replace Train window
}
GetPlayer(_current_player)->num_engines[engine]++;
}
@@ -651,7 +651,7 @@ static void NormalizeTrainVehInDepot(const Vehicle* u)
const Vehicle* v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && IsFreeWagon(v) &&
+ if (v->type == VEH_TRAIN && IsFreeWagon(v) &&
v->tile == u->tile &&
v->u.rail.track == TRACK_BIT_DEPOT) {
if (CmdFailed(DoCommand(0, v->index | (u->index << 16), 1, DC_EXEC,
@@ -689,7 +689,7 @@ static void AddRearEngineToMultiheadedTrain(Vehicle* v, Vehicle* u, bool buildin
u->build_year = v->build_year;
if (building) v->value >>= 1;
u->value = v->value;
- u->type = VEH_Train;
+ u->type = VEH_TRAIN;
u->cur_image = 0xAC2;
u->random_bits = VehicleRandomBits();
VehiclePositionChanged(u);
@@ -704,7 +704,7 @@ static void AddRearEngineToMultiheadedTrain(Vehicle* v, Vehicle* u, bool buildin
int32 CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
/* Check if the engine-type is valid (for the player) */
- if (!IsEngineBuildable(p1, VEH_Train, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
+ if (!IsEngineBuildable(p1, VEH_TRAIN, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
/* Check if the train is actually being built in a depot belonging
* to the player. Doesn't matter if only the cost is queried */
@@ -739,7 +739,7 @@ int32 CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Vehicle *v = vl[0];
- UnitID unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_Train);
+ UnitID unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_TRAIN);
if (unit_num > _patches.max_trains)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -781,7 +781,7 @@ int32 CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->service_interval = _patches.servint_trains;
v->date_of_last_service = _date;
v->build_year = _cur_year;
- v->type = VEH_Train;
+ v->type = VEH_TRAIN;
v->cur_image = 0xAC2;
v->random_bits = VehicleRandomBits();
@@ -818,7 +818,7 @@ int32 CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
RebuildVehicleLists();
InvalidateWindow(WC_COMPANY, v->owner);
if (IsLocalPlayer())
- InvalidateAutoreplaceWindow(VEH_Train); // updates the replace Train window
+ InvalidateAutoreplaceWindow(VEH_TRAIN); // updates the replace Train window
GetPlayer(_current_player)->num_engines[p1]++;
}
@@ -897,7 +897,7 @@ static Vehicle *FindGoodVehiclePos(const Vehicle *src)
TileIndex tile = src->tile;
FOR_ALL_VEHICLES(dst) {
- if (dst->type == VEH_Train && IsFreeWagon(dst) && dst->tile == tile) {
+ if (dst->type == VEH_TRAIN && IsFreeWagon(dst) && dst->tile == tile) {
// check so all vehicles in the line have the same engine.
Vehicle *v = dst;
@@ -964,7 +964,7 @@ int32 CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Vehicle *src = GetVehicle(s);
- if (src->type != VEH_Train || !CheckOwnership(src->owner)) return CMD_ERROR;
+ if (src->type != VEH_TRAIN || !CheckOwnership(src->owner)) return CMD_ERROR;
// if nothing is selected as destination, try and find a matching vehicle to drag to.
Vehicle *dst;
@@ -973,7 +973,7 @@ int32 CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
} else {
if (!IsValidVehicleID(d)) return CMD_ERROR;
dst = GetVehicle(d);
- if (dst->type != VEH_Train || !CheckOwnership(dst->owner)) return CMD_ERROR;
+ if (dst->type != VEH_TRAIN || !CheckOwnership(dst->owner)) return CMD_ERROR;
}
// if an articulated part is being handled, deal with its parent vehicle
@@ -1078,7 +1078,7 @@ int32 CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
// moving a loco to a new line?, then we need to assign a unitnumber.
if (dst == NULL && !IsFrontEngine(src) && IsTrainEngine(src)) {
- UnitID unit_num = GetFreeUnitNumber(VEH_Train);
+ UnitID unit_num = GetFreeUnitNumber(VEH_TRAIN);
if (unit_num > _patches.max_trains)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -1242,7 +1242,7 @@ int32 CmdStartStopTrain(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR;
/* Check if this train can be started/stopped. The callback will fail or
* return 0xFF if it can. */
@@ -1283,7 +1283,7 @@ int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
@@ -1562,7 +1562,7 @@ static void ReverseTrainSwapVeh(Vehicle *v, int l, int r)
/* Check if the vehicle is a train and is on the tile we are testing */
static void *TestTrainOnCrossing(Vehicle *v, void *data)
{
- if (v->tile != *(const TileIndex*)data || v->type != VEH_Train) return NULL;
+ if (v->tile != *(const TileIndex*)data || v->type != VEH_TRAIN) return NULL;
return v;
}
@@ -1669,7 +1669,7 @@ int32 CmdReverseTrainDirection(TileIndex tile, uint32 flags, uint32 p1, uint32 p
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR;
if (p2) {
// turn a single unit around
@@ -1717,7 +1717,7 @@ int32 CmdForceTrainProceed(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR;
if (flags & DC_EXEC) v->u.rail.force_proceed = 0x50;
@@ -1740,7 +1740,7 @@ int32 CmdRefitRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR;
if (CheckTrainStoppedInDepot(v) < 0) return_cmd_error(STR_TRAIN_MUST_BE_STOPPED);
/* Check cargo */
@@ -1918,14 +1918,14 @@ int32 CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */
if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR;
- return SendAllVehiclesToDepot(VEH_Train, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
+ return SendAllVehiclesToDepot(VEH_TRAIN, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
}
if (!IsValidVehicleID(p1)) return CMD_ERROR;
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR;
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
@@ -2779,7 +2779,7 @@ static void *FindTrainCollideEnum(Vehicle *v, void *data)
if (v != tcc->v &&
v != tcc->v_skip &&
- v->type == VEH_Train &&
+ v->type == VEH_TRAIN &&
v->u.rail.track != TRACK_BIT_DEPOT &&
myabs(v->z_pos - tcc->v->z_pos) <= 6 &&
myabs(v->x_pos - tcc->v->x_pos) < 6 &&
@@ -2870,7 +2870,7 @@ static void *CheckVehicleAtSignal(Vehicle *v, void *data)
{
const VehicleAtSignalData* vasd = (VehicleAtSignalData*)data;
- if (v->type == VEH_Train && IsFrontEngine(v) && v->tile == vasd->tile) {
+ if (v->type == VEH_TRAIN && IsFrontEngine(v) && v->tile == vasd->tile) {
DirDiff diff = ChangeDirDiff(DirDifference(v->direction, vasd->direction), DIRDIFF_90RIGHT);
if (diff == DIRDIFF_90RIGHT || (v->cur_speed <= 5 && diff <= DIRDIFF_REVERSE)) return v;
@@ -3391,7 +3391,7 @@ void Train_Tick(Vehicle *v)
TrainLocoHandler(v, false);
// make sure vehicle wasn't deleted.
- if (v->type == VEH_Train && IsFrontEngine(v))
+ if (v->type == VEH_TRAIN && IsFrontEngine(v))
TrainLocoHandler(v, true);
} else if (IsFreeWagon(v) && HASBITS(v->vehstatus, VS_CRASHED)) {
// Delete flooded standalone wagon
@@ -3500,7 +3500,7 @@ void TrainsYearlyLoop()
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && IsFrontEngine(v)) {
+ if (v->type == VEH_TRAIN && IsFrontEngine(v)) {
// show warning if train is not generating enough income last 2 years (corresponds to a red icon in the vehicle list)
if (_patches.train_income_warn && v->owner == _local_player && v->age >= 730 && v->profit_this_year < 0) {
SetDParam(1, v->profit_this_year);
@@ -3534,13 +3534,13 @@ void ConnectMultiheadedTrains()
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
v->u.rail.other_multiheaded_part = NULL;
}
}
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && IsFrontEngine(v)) {
+ if (v->type == VEH_TRAIN && IsFrontEngine(v)) {
Vehicle *u = v;
BEGIN_ENUM_WAGONS(u) {
@@ -3581,13 +3581,13 @@ void ConvertOldMultiheadToNew()
{
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
SETBIT(v->subtype, 7); // indicates that it's the old format and needs to be converted in the next loop
}
}
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
if (HASBIT(v->subtype, 7) && ((v->subtype & ~0x80) == 0 || (v->subtype & ~0x80) == 4)) {
Vehicle *u = v;
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index fcdc35bfe..6abc36c79 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -25,7 +25,7 @@ void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2)
// find a locomotive in the depot.
found = NULL;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && IsFrontEngine(v) &&
+ if (v->type == VEH_TRAIN && IsFrontEngine(v) &&
v->tile == tile &&
v->u.rail.track == TRACK_BIT_DEPOT) {
if (found != NULL) return; // must be exactly one.
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index da6105d8b..8d04c3211 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -543,7 +543,7 @@ TileIndex CheckTunnelBusy(TileIndex tile, uint *length)
v = FindVehicleBetween(starttile, tile, z);
if (v != NULL) {
- _error_message = v->type == VEH_Train ?
+ _error_message = v->type == VEH_TRAIN ?
STR_5000_TRAIN_IN_TUNNEL : STR_5001_ROAD_VEHICLE_IN_TUNNEL;
return INVALID_TILE;
}
@@ -1257,7 +1257,7 @@ static uint32 VehicleEnter_TunnelBridge(Vehicle *v, TileIndex tile, int x, int y
DiagDirection dir;
DiagDirection vdir;
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
fc = (x & 0xF) + (y << 4);
dir = GetTunnelDirection(tile);
@@ -1286,7 +1286,7 @@ static uint32 VehicleEnter_TunnelBridge(Vehicle *v, TileIndex tile, int x, int y
v->vehstatus &= ~VS_HIDDEN;
return VETSB_ENTERED_WORMHOLE;
}
- } else if (v->type == VEH_Road) {
+ } else if (v->type == VEH_ROAD) {
fc = (x & 0xF) + (y << 4);
dir = GetTunnelDirection(tile);
vdir = DirToDiagDir(v->direction);
@@ -1320,11 +1320,11 @@ static uint32 VehicleEnter_TunnelBridge(Vehicle *v, TileIndex tile, int x, int y
} else if (IsBridge(tile)) { // XXX is this necessary?
DiagDirection dir;
- if (v->type == VEH_Road || (v->type == VEH_Train && IsFrontEngine(v))) {
+ if (v->type == VEH_ROAD || (v->type == VEH_TRAIN && IsFrontEngine(v))) {
/* modify speed of vehicle */
uint16 spd = _bridge[GetBridgeType(tile)].speed;
- if (v->type == VEH_Road) spd *= 2;
+ if (v->type == VEH_ROAD) spd *= 2;
if (v->cur_speed > spd) v->cur_speed = spd;
}
@@ -1337,7 +1337,7 @@ static uint32 VehicleEnter_TunnelBridge(Vehicle *v, TileIndex tile, int x, int y
case DIAGDIR_SW: if ((x & 0xF) != TILE_SIZE - 1) return VETSB_CONTINUE; break;
case DIAGDIR_NW: if ((y & 0xF) != 0) return VETSB_CONTINUE; break;
}
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
v->u.rail.track = TRACK_BIT_WORMHOLE;
CLRBIT(v->u.rail.flags, VRF_GOINGUP);
CLRBIT(v->u.rail.flags, VRF_GOINGDOWN);
@@ -1347,7 +1347,7 @@ static uint32 VehicleEnter_TunnelBridge(Vehicle *v, TileIndex tile, int x, int y
return VETSB_ENTERED_WORMHOLE;
} else if (DirToDiagDir(v->direction) == ReverseDiagDir(dir)) {
v->tile = tile;
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
if (v->u.rail.track == TRACK_BIT_WORMHOLE) {
v->u.rail.track = (DiagDirToAxis(dir) == AXIS_X ? TRACK_BIT_X : TRACK_BIT_Y);
return VETSB_ENTERED_WORMHOLE;
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index ec1f7b74b..d5852b0a9 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -87,7 +87,7 @@ static void VehiclePoolNewBlock(uint start_item)
* TODO - This is just a temporary stage, this will be removed. */
for (v = GetVehicle(start_item); v != NULL; v = (v->index + 1U < GetVehiclePoolSize()) ? GetVehicle(v->index + 1) : NULL) {
v->index = start_item++;
- v->type = VEH_Invalid;
+ v->type = VEH_INVALID;
}
}
@@ -119,16 +119,16 @@ bool VehicleNeedsService(const Vehicle *v)
StringID VehicleInTheWayErrMsg(const Vehicle* v)
{
switch (v->type) {
- case VEH_Train: return STR_8803_TRAIN_IN_THE_WAY;
- case VEH_Road: return STR_9000_ROAD_VEHICLE_IN_THE_WAY;
- case VEH_Aircraft: return STR_A015_AIRCRAFT_IN_THE_WAY;
+ case VEH_TRAIN: return STR_8803_TRAIN_IN_THE_WAY;
+ case VEH_ROAD: return STR_9000_ROAD_VEHICLE_IN_THE_WAY;
+ case VEH_AIRCRAFT: return STR_A015_AIRCRAFT_IN_THE_WAY;
default: return STR_980E_SHIP_IN_THE_WAY;
}
}
static void *EnsureNoVehicleProc(Vehicle *v, void *data)
{
- if (v->tile != *(const TileIndex*)data || v->type == VEH_Disaster)
+ if (v->tile != *(const TileIndex*)data || v->type == VEH_DISASTER)
return NULL;
_error_message = VehicleInTheWayErrMsg(v);
@@ -144,7 +144,7 @@ static void *EnsureNoVehicleProcZ(Vehicle *v, void *data)
{
const TileInfo *ti = (const TileInfo*)data;
- if (v->tile != ti->tile || v->type == VEH_Disaster) return NULL;
+ if (v->tile != ti->tile || v->type == VEH_DISASTER) return NULL;
if (v->z_pos > ti->z) return NULL;
_error_message = VehicleInTheWayErrMsg(v);
@@ -186,7 +186,7 @@ Vehicle *FindVehicleBetween(TileIndex from, TileIndex to, byte z, bool without_c
}
FOR_ALL_VEHICLES(veh) {
if (without_crashed && (veh->vehstatus & VS_CRASHED) != 0) continue;
- if ((veh->type == VEH_Train || veh->type == VEH_Road) && (z==0xFF || veh->z_pos == z)) {
+ if ((veh->type == VEH_TRAIN || veh->type == VEH_ROAD) && (z==0xFF || veh->z_pos == z)) {
if ((veh->x_pos>>4) >= x1 && (veh->x_pos>>4) <= x2 &&
(veh->y_pos>>4) >= y1 && (veh->y_pos>>4) <= y2) {
return veh;
@@ -223,20 +223,20 @@ void AfterLoadVehicles()
FOR_ALL_VEHICLES(v) {
v->first = NULL;
- if (v->type == VEH_Train) v->u.rail.first_engine = INVALID_ENGINE;
+ if (v->type == VEH_TRAIN) v->u.rail.first_engine = INVALID_ENGINE;
}
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && (IsFrontEngine(v) || IsFreeWagon(v)))
+ if (v->type == VEH_TRAIN && (IsFrontEngine(v) || IsFreeWagon(v)))
TrainConsistChanged(v);
}
FOR_ALL_VEHICLES(v) {
switch (v->type) {
- case VEH_Train: v->cur_image = GetTrainImage(v, v->direction); break;
- case VEH_Road: v->cur_image = GetRoadVehImage(v, v->direction); break;
- case VEH_Ship: v->cur_image = GetShipImage(v, v->direction); break;
- case VEH_Aircraft:
+ case VEH_TRAIN: v->cur_image = GetTrainImage(v, v->direction); break;
+ case VEH_ROAD: v->cur_image = GetRoadVehImage(v, v->direction); break;
+ case VEH_SHIP: v->cur_image = GetShipImage(v, v->direction); break;
+ case VEH_AIRCRAFT:
if (IsNormalAircraft(v)) {
v->cur_image = GetAircraftImage(v, v->direction);
@@ -267,7 +267,7 @@ static Vehicle *InitializeVehicle(Vehicle *v)
assert(v->orders == NULL);
- v->type = VEH_Invalid;
+ v->type = VEH_INVALID;
v->left_coord = INVALID_COORD;
v->first = NULL;
v->next = NULL;
@@ -483,7 +483,7 @@ static Vehicle *GetPrevVehicleInChain_bruteforce(const Vehicle *v)
{
Vehicle *u;
- FOR_ALL_VEHICLES(u) if (u->type == VEH_Train && u->next == v) return u;
+ FOR_ALL_VEHICLES(u) if (u->type == VEH_TRAIN && u->next == v) return u;
return NULL;
}
@@ -516,7 +516,7 @@ Vehicle *GetFirstVehicleInChain(const Vehicle *v)
Vehicle* u;
assert(v != NULL);
- assert(v->type == VEH_Train);
+ assert(v->type == VEH_TRAIN);
if (v->first != NULL) {
if (IsFrontEngine(v->first) || IsFreeWagon(v->first)) return v->first;
@@ -553,12 +553,12 @@ uint CountVehiclesInChain(const Vehicle* v)
bool IsEngineCountable(const Vehicle *v)
{
switch (v->type) {
- case VEH_Aircraft: return IsNormalAircraft(v); // don't count plane shadows and helicopter rotors
- case VEH_Train:
+ case VEH_AIRCRAFT: return IsNormalAircraft(v); // don't count plane shadows and helicopter rotors
+ case VEH_TRAIN:
return !IsArticulatedPart(v) && // tenders and other articulated parts
(!IsMultiheaded(v) || IsTrainEngine(v)); // rear parts of multiheaded engines
- case VEH_Road:
- case VEH_Ship:
+ case VEH_ROAD:
+ case VEH_SHIP:
return true;
default: return false; // Only count player buildable vehicles
}
@@ -574,9 +574,9 @@ void DestroyVehicle(Vehicle *v)
DeleteVehicleNews(v->index, INVALID_STRING_ID);
DeleteName(v->string_id);
- if (v->type == VEH_Road) ClearSlot(v);
+ if (v->type == VEH_ROAD) ClearSlot(v);
- if (v->type != VEH_Train || (v->type == VEH_Train && (IsFrontEngine(v) || IsFreeWagon(v)))) {
+ if (v->type != VEH_TRAIN || (v->type == VEH_TRAIN && (IsFrontEngine(v) || IsFreeWagon(v)))) {
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
}
@@ -665,12 +665,12 @@ void CallVehicleTicks()
_vehicle_tick_procs[v->type](v);
switch (v->type) {
- case VEH_Train:
- case VEH_Road:
- case VEH_Aircraft:
- case VEH_Ship:
- if (v->type == VEH_Train && IsTrainWagon(v)) continue;
- if (v->type == VEH_Aircraft && v->subtype != AIR_HELICOPTER) continue;
+ case VEH_TRAIN:
+ case VEH_ROAD:
+ case VEH_AIRCRAFT:
+ case VEH_SHIP:
+ if (v->type == VEH_TRAIN && IsTrainWagon(v)) continue;
+ if (v->type == VEH_AIRCRAFT && v->subtype != AIR_HELICOPTER) continue;
v->motion_counter += (v->direction & 1) ? (v->cur_speed * 3) / 4 : v->cur_speed;
/* Play a running sound if the motion counter passes 256 (Do we not skip sounds?) */
@@ -701,7 +701,7 @@ static bool CanFillVehicle_FullLoadAny(Vehicle *v)
//if the aircraft carries passengers and is NOT full, then
//continue loading, no matter how much mail is in
- if (v->type == VEH_Aircraft &&
+ if (v->type == VEH_AIRCRAFT &&
v->cargo_type == CT_PASSENGERS &&
v->cargo_cap != v->cargo_count) {
return true;
@@ -737,7 +737,7 @@ bool CanFillVehicle(Vehicle *v)
TileIndex tile = v->tile;
if (IsTileType(tile, MP_STATION) ||
- (v->type == VEH_Ship && (
+ (v->type == VEH_SHIP && (
IsTileType(TILE_ADDXY(tile, 1, 0), MP_STATION) ||
IsTileType(TILE_ADDXY(tile, -1, 0), MP_STATION) ||
IsTileType(TILE_ADDXY(tile, 0, 1), MP_STATION) ||
@@ -791,10 +791,10 @@ int32 GetRefitCost(EngineID engine_type)
int32 base_cost = 0;
switch (GetEngine(engine_type)->type) {
- case VEH_Ship: base_cost = _price.ship_base; break;
- case VEH_Road: base_cost = _price.roadveh_base; break;
- case VEH_Aircraft: base_cost = _price.aircraft_base; break;
- case VEH_Train:
+ case VEH_SHIP: base_cost = _price.ship_base; break;
+ case VEH_ROAD: base_cost = _price.roadveh_base; break;
+ case VEH_AIRCRAFT: base_cost = _price.aircraft_base; break;
+ case VEH_TRAIN:
base_cost = 2 * ((RailVehInfo(engine_type)->railveh_type == RAILVEH_WAGON) ?
_price.build_railwagon : _price.build_railvehicle);
break;
@@ -1431,7 +1431,7 @@ Vehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicle type)
v = ForceAllocateSpecialVehicle();
if (v != NULL) {
- v->type = VEH_Special;
+ v->type = VEH_SPECIAL;
v->subtype = type;
v->x_pos = x;
v->y_pos = y;
@@ -1542,7 +1542,7 @@ void CheckVehicleBreakdown(Vehicle *v)
/* calculate reliability value to use in comparison */
rel = v->reliability;
- if (v->type == VEH_Ship) rel += 0x6666;
+ if (v->type == VEH_SHIP) rel += 0x6666;
/* disabled breakdowns? */
if (_opt.diff.vehicle_breakdowns < 1) return;
@@ -1621,10 +1621,10 @@ int32 CmdMassStartStopVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
bool vehicle_list_window = HASBIT(p2, 6);
switch (vehicle_type) {
- case VEH_Train: stop_command = CMD_START_STOP_TRAIN; break;
- case VEH_Road: stop_command = CMD_START_STOP_ROADVEH; break;
- case VEH_Ship: stop_command = CMD_START_STOP_SHIP; break;
- case VEH_Aircraft: stop_command = CMD_START_STOP_AIRCRAFT; break;
+ case VEH_TRAIN: stop_command = CMD_START_STOP_TRAIN; break;
+ case VEH_ROAD: stop_command = CMD_START_STOP_ROADVEH; break;
+ case VEH_SHIP: stop_command = CMD_START_STOP_SHIP; break;
+ case VEH_AIRCRAFT: stop_command = CMD_START_STOP_AIRCRAFT; break;
default: return CMD_ERROR;
}
@@ -1645,7 +1645,7 @@ int32 CmdMassStartStopVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
if (!!(v->vehstatus & VS_STOPPED) != start_stop) continue;
if (!vehicle_list_window) {
- if (vehicle_type == VEH_Train) {
+ if (vehicle_type == VEH_TRAIN) {
if (CheckTrainInDepot(v, false) == -1) continue;
} else {
if (!(v->vehstatus & VS_HIDDEN)) continue;
@@ -1685,10 +1685,10 @@ int32 CmdDepotSellAllVehicles(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
byte vehicle_type = GB(p1, 0, 8);
switch (vehicle_type) {
- case VEH_Train: sell_command = CMD_SELL_RAIL_WAGON; break;
- case VEH_Road: sell_command = CMD_SELL_ROAD_VEH; break;
- case VEH_Ship: sell_command = CMD_SELL_SHIP; break;
- case VEH_Aircraft: sell_command = CMD_SELL_AIRCRAFT; break;
+ case VEH_TRAIN: sell_command = CMD_SELL_RAIL_WAGON; break;
+ case VEH_ROAD: sell_command = CMD_SELL_ROAD_VEH; break;
+ case VEH_SHIP: sell_command = CMD_SELL_SHIP; break;
+ case VEH_AIRCRAFT: sell_command = CMD_SELL_AIRCRAFT; break;
default: return CMD_ERROR;
}
@@ -1814,7 +1814,7 @@ int32 CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (!CheckOwnership(v->owner)) return CMD_ERROR;
- if (v->type == VEH_Train && (!IsFrontEngine(v) || v->u.rail.crash_anim_pos >= 4400)) return CMD_ERROR;
+ if (v->type == VEH_TRAIN && (!IsFrontEngine(v) || v->u.rail.crash_anim_pos >= 4400)) return CMD_ERROR;
// check that we can allocate enough vehicles
if (!(flags & DC_EXEC)) {
@@ -1857,13 +1857,13 @@ int32 CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
DoCommand(0, w->index, v2->cargo_type | (v2->cargo_subtype << 8), flags, GetCmdRefitVeh(v));
break; // We learned that the engine in question needed a refit. No need to check anymore
}
- } while (v->type == VEH_Train && (w2 = w2->next) != NULL && (v2 = v2->next) != NULL);
+ } while (v->type == VEH_TRAIN && (w2 = w2->next) != NULL && (v2 = v2->next) != NULL);
- if (v->type == VEH_Train && HASBIT(v->u.rail.flags, VRF_REVERSE_DIRECTION)) {
+ if (v->type == VEH_TRAIN && HASBIT(v->u.rail.flags, VRF_REVERSE_DIRECTION)) {
SETBIT(w->u.rail.flags, VRF_REVERSE_DIRECTION);
}
- if (v->type == VEH_Train && !IsFrontEngine(v)) {
+ if (v->type == VEH_TRAIN && !IsFrontEngine(v)) {
// this s a train car
// add this unit to the end of the train
DoCommand(0, (w_rear->index << 16) | w->index, 1, flags, CMD_MOVE_RAIL_VEHICLE);
@@ -1875,9 +1875,9 @@ int32 CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
w_rear = w; // trains needs to know the last car in the train, so they can add more in next loop
}
- } while (v->type == VEH_Train && (v = GetNextVehicle(v)) != NULL);
+ } while (v->type == VEH_TRAIN && (v = GetNextVehicle(v)) != NULL);
- if (flags & DC_EXEC && v_front->type == VEH_Train) {
+ if (flags & DC_EXEC && v_front->type == VEH_TRAIN) {
// for trains this needs to be the front engine due to the callback function
_new_vehicle_id = w_front->index;
}
@@ -1924,7 +1924,7 @@ static void MoveVehicleCargo(Vehicle *dest, Vehicle *source)
* the complete train, which is without the weight of cargo we just
* moved back into some (of the) new wagon(s).
*/
- if (dest->type == VEH_Train) TrainConsistChanged(dest->first);
+ if (dest->type == VEH_TRAIN) TrainConsistChanged(dest->first);
}
static bool VerifyAutoreplaceRefitForOrders(const Vehicle *v, const EngineID engine_type)
@@ -1932,7 +1932,7 @@ static bool VerifyAutoreplaceRefitForOrders(const Vehicle *v, const EngineID eng
const Order *o;
const Vehicle *u;
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
u = GetFirstVehicleInChain(v);
} else {
u = v;
@@ -1961,21 +1961,21 @@ static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type)
CargoID new_cargo_type = CT_INVALID;
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
new_cargo_capacity = (RailVehInfo(engine_type)->capacity > 0);
new_cargo_type = RailVehInfo(engine_type)->cargo_type;
break;
- case VEH_Road:
+ case VEH_ROAD:
new_cargo_capacity = (RoadVehInfo(engine_type)->capacity > 0);
new_cargo_type = RoadVehInfo(engine_type)->cargo_type;
break;
- case VEH_Ship:
+ case VEH_SHIP:
new_cargo_capacity = (ShipVehInfo(engine_type)->capacity > 0);
new_cargo_type = ShipVehInfo(engine_type)->cargo_type;
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
/* all aircraft starts as passenger planes with cargo capacity
* new_cargo_capacity is always true for aircraft, which is the init value. No need to set it here */
new_cargo_type = CT_PASSENGERS;
@@ -1993,7 +1993,7 @@ static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type)
return CT_INVALID;
}
}
- if (v->type != VEH_Train) return CT_INVALID; // We can't refit the vehicle to carry the cargo we want
+ if (v->type != VEH_TRAIN) return CT_INVALID; // We can't refit the vehicle to carry the cargo we want
/* Below this line it's safe to assume that the vehicle in question is a train */
@@ -2068,12 +2068,12 @@ static int32 ReplaceVehicle(Vehicle **w, byte flags, int32 total_cost)
}
}
- if (new_v->type == VEH_Train && HASBIT(old_v->u.rail.flags, VRF_REVERSE_DIRECTION) && !IsMultiheaded(new_v) && !(new_v->next != NULL && IsArticulatedPart(new_v->next))) {
+ if (new_v->type == VEH_TRAIN && HASBIT(old_v->u.rail.flags, VRF_REVERSE_DIRECTION) && !IsMultiheaded(new_v) && !(new_v->next != NULL && IsArticulatedPart(new_v->next))) {
// we are autorenewing to a single engine, so we will turn it as the old one was turned as well
SETBIT(new_v->u.rail.flags, VRF_REVERSE_DIRECTION);
}
- if (old_v->type == VEH_Train && !IsFrontEngine(old_v)) {
+ if (old_v->type == VEH_TRAIN && !IsFrontEngine(old_v)) {
/* this is a railcar. We need to move the car into the train
* We add the new engine after the old one instead of replacing it. It will give the same result anyway when we
* sell the old engine in a moment
@@ -2093,7 +2093,7 @@ static int32 ReplaceVehicle(Vehicle **w, byte flags, int32 total_cost)
new_v->unitnumber = old_v->unitnumber; // use the same unit number
new_v->current_order = old_v->current_order;
- if (old_v->type == VEH_Train && GetNextVehicle(old_v) != NULL){
+ if (old_v->type == VEH_TRAIN && GetNextVehicle(old_v) != NULL){
Vehicle *temp_v = GetNextVehicle(old_v);
// move the entire train to the new engine, excluding the old engine
@@ -2108,7 +2108,7 @@ static int32 ReplaceVehicle(Vehicle **w, byte flags, int32 total_cost)
}
}
/* We are done setting up the new vehicle. Now we move the cargo from the old one to the new one */
- MoveVehicleCargo(new_v->type == VEH_Train ? GetFirstVehicleInChain(new_v) : new_v, old_v);
+ MoveVehicleCargo(new_v->type == VEH_TRAIN ? GetFirstVehicleInChain(new_v) : new_v, old_v);
// Get the name of the old vehicle if it has a custom name.
if (!IsCustomName(old_v->string_id)) {
@@ -2168,7 +2168,7 @@ static int32 MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs)
* If it's not a train, the value is unused
* round up to the length of the tiles used for the train instead of the train length instead
* Useful when newGRF uses custom length */
- uint16 old_total_length = (v->type == VEH_Train ?
+ uint16 old_total_length = (v->type == VEH_TRAIN ?
(v->u.rail.cached_total_length + TILE_SIZE - 1) / TILE_SIZE * TILE_SIZE :
-1
);
@@ -2190,7 +2190,7 @@ static int32 MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs)
cost = 0;
w = v;
do {
- if (w->type == VEH_Train && IsMultiheaded(w) && !IsTrainEngine(w)) {
+ if (w->type == VEH_TRAIN && IsMultiheaded(w) && !IsTrainEngine(w)) {
/* we build the rear ends of multiheaded trains with the front ones */
continue;
}
@@ -2207,7 +2207,7 @@ static int32 MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs)
temp_cost = ReplaceVehicle(&w, flags, cost);
if (flags & DC_EXEC &&
- (w->type != VEH_Train || w->u.rail.first_engine == INVALID_ENGINE)) {
+ (w->type != VEH_TRAIN || w->u.rail.first_engine == INVALID_ENGINE)) {
/* now we bought a new engine and sold the old one. We need to fix the
* pointers in order to avoid pointing to the old one for trains: these
* pointers should point to the front engine and not the cars
@@ -2218,17 +2218,17 @@ static int32 MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs)
if (!CmdFailed(temp_cost)) {
cost += temp_cost;
}
- } while (w->type == VEH_Train && (w = GetNextVehicle(w)) != NULL);
+ } while (w->type == VEH_TRAIN && (w = GetNextVehicle(w)) != NULL);
if (!(flags & DC_EXEC) && (p->money64 < (int32)(cost + p->engine_renew_money) || cost == 0)) {
if (!check && p->money64 < (int32)(cost + p->engine_renew_money) && ( _local_player == v->owner ) && cost != 0) {
StringID message;
SetDParam(0, v->unitnumber);
switch (v->type) {
- case VEH_Train: message = STR_TRAIN_AUTORENEW_FAILED; break;
- case VEH_Road: message = STR_ROADVEHICLE_AUTORENEW_FAILED; break;
- case VEH_Ship: message = STR_SHIP_AUTORENEW_FAILED; break;
- case VEH_Aircraft: message = STR_AIRCRAFT_AUTORENEW_FAILED; break;
+ case VEH_TRAIN: message = STR_TRAIN_AUTORENEW_FAILED; break;
+ case VEH_ROAD: message = STR_ROADVEHICLE_AUTORENEW_FAILED; break;
+ case VEH_SHIP: message = STR_SHIP_AUTORENEW_FAILED; break;
+ case VEH_AIRCRAFT: message = STR_AIRCRAFT_AUTORENEW_FAILED; break;
// This should never happen
default: NOT_REACHED(); message = 0; break;
}
@@ -2252,7 +2252,7 @@ static int32 MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs)
}
/* If setting is on to try not to exceed the old length of the train with the replacement */
- if (v->type == VEH_Train && p->renew_keep_length) {
+ if (v->type == VEH_TRAIN && p->renew_keep_length) {
Vehicle *temp;
w = v;
@@ -2307,8 +2307,8 @@ void BuildDepotVehicleList(byte type, TileIndex tile, Vehicle ***engine_list, ui
Vehicle *v;
/* This function should never be called without an array to store results */
- assert(!(engine_list == NULL && type != VEH_Train));
- assert(!(type == VEH_Train && engine_list == NULL && wagon_list == NULL));
+ assert(!(engine_list == NULL && type != VEH_TRAIN));
+ assert(!(type == VEH_TRAIN && engine_list == NULL && wagon_list == NULL));
/* Both array and the length should either be NULL to disable the list or both should not be NULL */
assert((engine_list == NULL && engine_list_length == NULL) || (engine_list != NULL && engine_list_length != NULL));
@@ -2321,9 +2321,9 @@ void BuildDepotVehicleList(byte type, TileIndex tile, Vehicle ***engine_list, ui
if (wagon_count != NULL) *wagon_count = 0;
switch (type) {
- case VEH_Train:
+ case VEH_TRAIN:
FOR_ALL_VEHICLES(v) {
- if (v->tile == tile && v->type == VEH_Train && v->u.rail.track == TRACK_BIT_DEPOT) {
+ if (v->tile == tile && v->type == VEH_TRAIN && v->u.rail.track == TRACK_BIT_DEPOT) {
if (IsFrontEngine(v)) {
if (engine_list == NULL) continue;
if (*engine_count == *engine_list_length) ExtendVehicleListSize((const Vehicle***)engine_list, engine_list_length, 25);
@@ -2337,28 +2337,28 @@ void BuildDepotVehicleList(byte type, TileIndex tile, Vehicle ***engine_list, ui
}
break;
- case VEH_Road:
+ case VEH_ROAD:
FOR_ALL_VEHICLES(v) {
- if (v->tile == tile && v->type == VEH_Road && IsRoadVehInDepot(v)) {
+ if (v->tile == tile && v->type == VEH_ROAD && IsRoadVehInDepot(v)) {
if (*engine_count == *engine_list_length) ExtendVehicleListSize((const Vehicle***)engine_list, engine_list_length, 25);
(*engine_list)[(*engine_count)++] = v;
}
}
break;
- case VEH_Ship:
+ case VEH_SHIP:
FOR_ALL_VEHICLES(v) {
- if (v->tile == tile && v->type == VEH_Ship && IsShipInDepot(v)) {
+ if (v->tile == tile && v->type == VEH_SHIP && IsShipInDepot(v)) {
if (*engine_count == *engine_list_length) ExtendVehicleListSize((const Vehicle***)engine_list, engine_list_length, 25);
(*engine_list)[(*engine_count)++] = v;
}
}
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
FOR_ALL_VEHICLES(v) {
if (v->tile == tile &&
- v->type == VEH_Aircraft && IsNormalAircraft(v) &&
+ v->type == VEH_AIRCRAFT && IsNormalAircraft(v) &&
v->vehstatus & VS_HIDDEN) {
if (*engine_count == *engine_list_length) ExtendVehicleListSize((const Vehicle***)engine_list, engine_list_length, 25);
(*engine_list)[(*engine_count)++] = v;
@@ -2385,7 +2385,7 @@ void BuildDepotVehicleList(byte type, TileIndex tile, Vehicle ***engine_list, ui
*/
uint GenerateVehicleSortList(const Vehicle ***sort_list, uint16 *length_of_array, byte type, PlayerID owner, uint32 index, uint16 window_type)
{
- const byte subtype = (type != VEH_Aircraft) ? (byte)Train_Front : (byte)AIR_AIRCRAFT;
+ const byte subtype = (type != VEH_AIRCRAFT) ? (byte)Train_Front : (byte)AIR_AIRCRAFT;
uint n = 0;
const Vehicle *v;
@@ -2393,8 +2393,8 @@ uint GenerateVehicleSortList(const Vehicle ***sort_list, uint16 *length_of_array
case VLW_STATION_LIST: {
FOR_ALL_VEHICLES(v) {
if (v->type == type && (
- (type == VEH_Train && IsFrontEngine(v)) ||
- (type != VEH_Train && v->subtype <= subtype))) {
+ (type == VEH_TRAIN && IsFrontEngine(v)) ||
+ (type != VEH_TRAIN && v->subtype <= subtype))) {
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
@@ -2428,8 +2428,8 @@ uint GenerateVehicleSortList(const Vehicle ***sort_list, uint16 *length_of_array
case VLW_STANDARD: {
FOR_ALL_VEHICLES(v) {
if (v->type == type && v->owner == owner && (
- (type == VEH_Train && IsFrontEngine(v)) ||
- (type != VEH_Train && v->subtype <= subtype))) {
+ (type == VEH_TRAIN && IsFrontEngine(v)) ||
+ (type != VEH_TRAIN && v->subtype <= subtype))) {
/* TODO find a better estimate on the total number of vehicles for current player */
if (n == *length_of_array) ExtendVehicleListSize(sort_list, length_of_array, GetNumVehicles()/4);
(*sort_list)[n++] = v;
@@ -2441,8 +2441,8 @@ uint GenerateVehicleSortList(const Vehicle ***sort_list, uint16 *length_of_array
case VLW_DEPOT_LIST: {
FOR_ALL_VEHICLES(v) {
if (v->type == type && (
- (type == VEH_Train && IsFrontEngine(v)) ||
- (type != VEH_Train && v->subtype <= subtype))) {
+ (type == VEH_TRAIN && IsFrontEngine(v)) ||
+ (type != VEH_TRAIN && v->subtype <= subtype))) {
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
@@ -2510,10 +2510,10 @@ int32 SendAllVehiclesToDepot(byte type, uint32 flags, bool service, PlayerID own
bool IsVehicleInDepot(const Vehicle *v)
{
switch (v->type) {
- case VEH_Train: return CheckTrainInDepot(v, false) != -1;
- case VEH_Road: return IsRoadVehInDepot(v);
- case VEH_Ship: return IsShipInDepot(v);
- case VEH_Aircraft: return IsAircraftInHangar(v);
+ case VEH_TRAIN: return CheckTrainInDepot(v, false) != -1;
+ case VEH_ROAD: return IsRoadVehInDepot(v);
+ case VEH_SHIP: return IsShipInDepot(v);
+ case VEH_AIRCRAFT: return IsAircraftInHangar(v);
default: NOT_REACHED();
}
return false;
@@ -2522,32 +2522,32 @@ bool IsVehicleInDepot(const Vehicle *v)
void VehicleEnterDepot(Vehicle *v)
{
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
InvalidateWindowClasses(WC_TRAINS_LIST);
if (!IsFrontEngine(v)) v = GetFirstVehicleInChain(v);
UpdateSignalsOnSegment(v->tile, GetRailDepotDirection(v->tile));
v->load_unload_time_rem = 0;
break;
- case VEH_Road:
+ case VEH_ROAD:
InvalidateWindowClasses(WC_ROADVEH_LIST);
v->u.road.state = RVSB_IN_DEPOT;
break;
- case VEH_Ship:
+ case VEH_SHIP:
InvalidateWindowClasses(WC_SHIPS_LIST);
v->u.ship.state = TRACK_BIT_DEPOT;
RecalcShipStuff(v);
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
HandleAircraftEnterHangar(v);
break;
default: NOT_REACHED();
}
- if (v->type != VEH_Train) {
+ if (v->type != VEH_TRAIN) {
/* Trains update the vehicle list when the first unit enters the depot and calls VehicleEnterDepot() when the last unit enters.
* We only increase the number of vehicles when the first one enters, so we will not need to search for more vehicles in the depot */
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
@@ -2591,7 +2591,7 @@ void VehicleEnterDepot(Vehicle *v)
if (HASBIT(t.flags, OFB_PART_OF_ORDERS)) {
/* Part of orders */
- if (v->type == VEH_Train) v->u.rail.days_since_order_progr = 0;
+ if (v->type == VEH_TRAIN) v->u.rail.days_since_order_progr = 0;
v->cur_order_index++;
} else if (HASBIT(t.flags, OFB_HALT_IN_DEPOT)) {
/* Force depot visit */
@@ -2600,10 +2600,10 @@ void VehicleEnterDepot(Vehicle *v)
StringID string;
switch (v->type) {
- case VEH_Train: string = STR_8814_TRAIN_IS_WAITING_IN_DEPOT; break;
- case VEH_Road: string = STR_9016_ROAD_VEHICLE_IS_WAITING; break;
- case VEH_Ship: string = STR_981C_SHIP_IS_WAITING_IN_DEPOT; break;
- case VEH_Aircraft: string = STR_A014_AIRCRAFT_IS_WAITING_IN; break;
+ case VEH_TRAIN: string = STR_8814_TRAIN_IS_WAITING_IN_DEPOT; break;
+ case VEH_ROAD: string = STR_9016_ROAD_VEHICLE_IS_WAITING; break;
+ case VEH_SHIP: string = STR_981C_SHIP_IS_WAITING_IN_DEPOT; break;
+ case VEH_AIRCRAFT: string = STR_A014_AIRCRAFT_IS_WAITING_IN; break;
default: NOT_REACHED(); string = STR_EMPTY; // Set the string to something to avoid a compiler warning
}
@@ -2744,7 +2744,7 @@ Trackdir GetVehicleTrackdir(const Vehicle* v)
if (v->vehstatus & VS_CRASHED) return INVALID_TRACKDIR;
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
if (v->u.rail.track == TRACK_BIT_DEPOT) /* We'll assume the train is facing outwards */
return DiagdirToDiagTrackdir(GetRailDepotDirection(v->tile)); /* Train in depot */
@@ -2753,14 +2753,14 @@ Trackdir GetVehicleTrackdir(const Vehicle* v)
return TrackDirectionToTrackdir(FindFirstTrack(v->u.rail.track), v->direction);
- case VEH_Ship:
+ case VEH_SHIP:
if (IsShipInDepot(v))
/* We'll assume the ship is facing outwards */
return DiagdirToDiagTrackdir(GetShipDepotDirection(v->tile));
return TrackDirectionToTrackdir(FindFirstTrack(v->u.ship.state), v->direction);
- case VEH_Road:
+ case VEH_ROAD:
if (IsRoadVehInDepot(v)) /* We'll assume the road vehicle is facing outwards */
return DiagdirToDiagTrackdir(GetRoadDepotDirection(v->tile));
@@ -2775,7 +2775,7 @@ Trackdir GetVehicleTrackdir(const Vehicle* v)
/* Vehicle is turning around, get the direction from vehicle's direction */
return DiagdirToDiagTrackdir(DirToDiagDir(v->direction));
- /* case VEH_Aircraft: case VEH_Special: case VEH_Disaster: */
+ /* case VEH_AIRCRAFT: case VEH_SPECIAL: case VEH_DISASTER: */
default: return INVALID_TRACKDIR;
}
}
@@ -2797,10 +2797,10 @@ UnitID GetFreeUnitNumber(byte type)
static UnitID gmax = 0;
switch (type) {
- case VEH_Train: max = _patches.max_trains; break;
- case VEH_Road: max = _patches.max_roadveh; break;
- case VEH_Ship: max = _patches.max_ships; break;
- case VEH_Aircraft: max = _patches.max_aircraft; break;
+ case VEH_TRAIN: max = _patches.max_trains; break;
+ case VEH_ROAD: max = _patches.max_roadveh; break;
+ case VEH_SHIP: max = _patches.max_ships; break;
+ case VEH_AIRCRAFT: max = _patches.max_aircraft; break;
default: NOT_REACHED();
}
@@ -2860,7 +2860,7 @@ static SpriteID GetEngineColourMap(EngineID engine_type, PlayerID player, Engine
if (p->livery[LS_DEFAULT].in_use && (_patches.liveries == 2 || (_patches.liveries == 1 && player == _local_player))) {
/* Determine the livery scheme to use */
switch (GetEngine(engine_type)->type) {
- case VEH_Train: {
+ case VEH_TRAIN: {
const RailVehicleInfo *rvi = RailVehInfo(engine_type);
switch (rvi->railtype) {
@@ -2901,21 +2901,21 @@ static SpriteID GetEngineColourMap(EngineID engine_type, PlayerID player, Engine
break;
}
- case VEH_Road: {
+ case VEH_ROAD: {
const RoadVehicleInfo *rvi = RoadVehInfo(engine_type);
if (cargo_type == CT_INVALID) cargo_type = rvi->cargo_type;
scheme = (cargo_type == CT_PASSENGERS) ? LS_BUS : LS_TRUCK;
break;
}
- case VEH_Ship: {
+ case VEH_SHIP: {
const ShipVehicleInfo *svi = ShipVehInfo(engine_type);
if (cargo_type == CT_INVALID) cargo_type = svi->cargo_type;
scheme = (cargo_type == CT_PASSENGERS) ? LS_PASSENGER_SHIP : LS_FREIGHT_SHIP;
break;
}
- case VEH_Aircraft: {
+ case VEH_AIRCRAFT: {
const AircraftVehicleInfo *avi = AircraftVehInfo(engine_type);
if (cargo_type == CT_INVALID) cargo_type = CT_PASSENGERS;
switch (avi->subtype) {
@@ -2948,7 +2948,7 @@ SpriteID GetEnginePalette(EngineID engine_type, PlayerID player)
SpriteID GetVehiclePalette(const Vehicle *v)
{
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
return GetEngineColourMap(
(v->u.rail.first_engine != INVALID_ENGINE && (IsArticulatedPart(v) || UsesWagonOverride(v))) ?
v->u.rail.first_engine : v->engine_type,
@@ -3071,7 +3071,7 @@ extern const SaveLoad _common_veh_desc[] = {
static const SaveLoad _train_desc[] = {
- SLE_WRITEBYTE(Vehicle, type, VEH_Train, 0), // Train type. VEH_Train in mem, 0 in file.
+ SLE_WRITEBYTE(Vehicle, type, VEH_TRAIN, 0), // Train type. VEH_TRAIN in mem, 0 in file.
SLE_INCLUDEX(0, INC_VEHICLE_COMMON),
SLE_VARX(offsetof(Vehicle, u) + offsetof(VehicleRail, crash_anim_pos), SLE_UINT16),
SLE_VARX(offsetof(Vehicle, u) + offsetof(VehicleRail, force_proceed), SLE_UINT8),
@@ -3089,7 +3089,7 @@ static const SaveLoad _train_desc[] = {
};
static const SaveLoad _roadveh_desc[] = {
- SLE_WRITEBYTE(Vehicle, type, VEH_Road, 1), // Road type. VEH_Road in mem, 1 in file.
+ SLE_WRITEBYTE(Vehicle, type, VEH_ROAD, 1), // Road type. VEH_ROAD in mem, 1 in file.
SLE_INCLUDEX(0, INC_VEHICLE_COMMON),
SLE_VARX(offsetof(Vehicle, u) + offsetof(VehicleRoad, state), SLE_UINT8),
SLE_VARX(offsetof(Vehicle, u) + offsetof(VehicleRoad, frame), SLE_UINT8),
@@ -3109,7 +3109,7 @@ static const SaveLoad _roadveh_desc[] = {
};
static const SaveLoad _ship_desc[] = {
- SLE_WRITEBYTE(Vehicle, type, VEH_Ship, 2), // Ship type. VEH_Ship in mem, 2 in file.
+ SLE_WRITEBYTE(Vehicle, type, VEH_SHIP, 2), // Ship type. VEH_SHIP in mem, 2 in file.
SLE_INCLUDEX(0, INC_VEHICLE_COMMON),
SLE_VARX(offsetof(Vehicle, u) + offsetof(VehicleShip, state), SLE_UINT8),
@@ -3120,7 +3120,7 @@ static const SaveLoad _ship_desc[] = {
};
static const SaveLoad _aircraft_desc[] = {
- SLE_WRITEBYTE(Vehicle, type, VEH_Aircraft, 3), // Aircraft type. VEH_Aircraft in mem, 3 in file.
+ SLE_WRITEBYTE(Vehicle, type, VEH_AIRCRAFT, 3), // Aircraft type. VEH_AIRCRAFT in mem, 3 in file.
SLE_INCLUDEX(0, INC_VEHICLE_COMMON),
SLE_VARX(offsetof(Vehicle, u) + offsetof(VehicleAir, crashed_counter), SLE_UINT16),
SLE_VARX(offsetof(Vehicle, u) + offsetof(VehicleAir, pos), SLE_UINT8),
@@ -3139,7 +3139,7 @@ static const SaveLoad _aircraft_desc[] = {
};
static const SaveLoad _special_desc[] = {
- SLE_WRITEBYTE(Vehicle,type,VEH_Special, 4),
+ SLE_WRITEBYTE(Vehicle,type,VEH_SPECIAL, 4),
SLE_VAR(Vehicle, subtype, SLE_UINT8),
@@ -3171,7 +3171,7 @@ static const SaveLoad _special_desc[] = {
};
static const SaveLoad _disaster_desc[] = {
- SLE_WRITEBYTE(Vehicle, type, VEH_Disaster, 5),
+ SLE_WRITEBYTE(Vehicle, type, VEH_DISASTER, 5),
SLE_REF(Vehicle, next, REF_VEHICLE_OLD),
@@ -3284,13 +3284,13 @@ extern const ChunkHandler _veh_chunk_handlers[] = {
void Vehicle::BeginLoading()
{
- assert(IsTileType(tile, MP_STATION) || type == VEH_Ship);
+ assert(IsTileType(tile, MP_STATION) || type == VEH_SHIP);
current_order.type = OT_LOADING;
}
void Vehicle::LeaveStation()
{
- assert(IsTileType(tile, MP_STATION) || type == VEH_Ship);
+ assert(IsTileType(tile, MP_STATION) || type == VEH_SHIP);
assert(current_order.type == OT_LOADING);
current_order.type = OT_LEAVESTATION;
current_order.flags = 0;
diff --git a/src/vehicle.h b/src/vehicle.h
index 790343a8b..cd3c73dff 100644
--- a/src/vehicle.h
+++ b/src/vehicle.h
@@ -63,13 +63,13 @@ enum RoadVehicleStates {
};
enum {
- VEH_Train,
- VEH_Road,
- VEH_Ship,
- VEH_Aircraft,
- VEH_Special,
- VEH_Disaster,
- VEH_Invalid = 0xFF,
+ VEH_TRAIN,
+ VEH_ROAD,
+ VEH_SHIP,
+ VEH_AIRCRAFT,
+ VEH_SPECIAL,
+ VEH_DISASTER,
+ VEH_INVALID = 0xFF,
} ;
enum VehStatus {
@@ -457,7 +457,7 @@ static inline uint GetNumVehicles()
*/
static inline bool IsValidVehicle(const Vehicle *v)
{
- return v->type != VEH_Invalid;
+ return v->type != VEH_INVALID;
}
void DestroyVehicle(Vehicle *v);
@@ -465,16 +465,16 @@ void DestroyVehicle(Vehicle *v);
static inline void DeleteVehicle(Vehicle *v)
{
DestroyVehicle(v);
- v->type = VEH_Invalid;
+ v->type = VEH_INVALID;
}
static inline bool IsPlayerBuildableVehicleType(byte type)
{
switch (type) {
- case VEH_Train:
- case VEH_Road:
- case VEH_Ship:
- case VEH_Aircraft:
+ case VEH_TRAIN:
+ case VEH_ROAD:
+ case VEH_SHIP:
+ case VEH_AIRCRAFT:
return true;
}
return false;
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index c4f5a66f3..d93544167 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -267,7 +267,7 @@ static RefitList *BuildRefitList(const Vehicle *v)
}
}
}
- } while (v->type == VEH_Train && (u = u->next) != NULL && num_lines < max_lines);
+ } while (v->type == VEH_TRAIN && (u = u->next) != NULL && num_lines < max_lines);
list->num_lines = num_lines;
list->items = refit;
@@ -320,7 +320,7 @@ static void VehicleRefitWndProc(Window *w, WindowEvent *e)
case WE_PAINT: {
Vehicle *v = GetVehicle(w->window_number);
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
uint length = CountVehiclesInChain(v);
if (length != WP(w, refit_d).length) {
@@ -372,10 +372,10 @@ static void VehicleRefitWndProc(Window *w, WindowEvent *e)
int command = 0;
switch (v->type) {
- case VEH_Train: command = CMD_REFIT_RAIL_VEHICLE | CMD_MSG(STR_RAIL_CAN_T_REFIT_VEHICLE); break;
- case VEH_Road: command = CMD_REFIT_ROAD_VEH | CMD_MSG(STR_REFIT_ROAD_VEHICLE_CAN_T); break;
- case VEH_Ship: command = CMD_REFIT_SHIP | CMD_MSG(STR_9841_CAN_T_REFIT_SHIP); break;
- case VEH_Aircraft: command = CMD_REFIT_AIRCRAFT | CMD_MSG(STR_A042_CAN_T_REFIT_AIRCRAFT); break;
+ case VEH_TRAIN: command = CMD_REFIT_RAIL_VEHICLE | CMD_MSG(STR_RAIL_CAN_T_REFIT_VEHICLE); break;
+ case VEH_ROAD: command = CMD_REFIT_ROAD_VEH | CMD_MSG(STR_REFIT_ROAD_VEHICLE_CAN_T); break;
+ case VEH_SHIP: command = CMD_REFIT_SHIP | CMD_MSG(STR_9841_CAN_T_REFIT_SHIP); break;
+ case VEH_AIRCRAFT: command = CMD_REFIT_AIRCRAFT | CMD_MSG(STR_A042_CAN_T_REFIT_AIRCRAFT); break;
}
if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo->cargo | WP(w,refit_d).cargo->subtype << 8, NULL, command)) DeleteWindow(w);
} else {
@@ -437,26 +437,26 @@ void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order)
w->resize.step_height = 14;
WP(w, refit_d).sel = -1;
WP(w, refit_d).list = BuildRefitList(v);
- if (v->type == VEH_Train) WP(w, refit_d).length = CountVehiclesInChain(v);
+ if (v->type == VEH_TRAIN) WP(w, refit_d).length = CountVehiclesInChain(v);
SetVScrollCount(w, WP(w, refit_d).list->num_lines);
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
w->widget[3].tooltips = STR_RAIL_SELECT_TYPE_OF_CARGO_FOR;
w->widget[6].data = STR_RAIL_REFIT_VEHICLE;
w->widget[6].tooltips = STR_RAIL_REFIT_TO_CARRY_HIGHLIGHTED;
break;
- case VEH_Road:
+ case VEH_ROAD:
w->widget[3].tooltips = STR_ROAD_SELECT_TYPE_OF_CARGO_FOR;
w->widget[6].data = STR_REFIT_ROAD_VEHICLE;
w->widget[6].tooltips = STR_REFIT_ROAD_VEHICLE_TO_CARRY_HIGHLIGHTED;
break;
- case VEH_Ship:
+ case VEH_SHIP:
w->widget[3].tooltips = STR_983D_SELECT_TYPE_OF_CARGO_FOR;
w->widget[6].data = STR_983C_REFIT_SHIP;
w->widget[6].tooltips = STR_983E_REFIT_SHIP_TO_CARRY_HIGHLIGHTED;
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
w->widget[3].tooltips = STR_A03E_SELECT_TYPE_OF_CARGO_FOR;
w->widget[6].data = STR_A03D_REFIT_AIRCRAFT;
w->widget[6].tooltips = STR_A03F_REFIT_AIRCRAFT_TO_CARRY;
@@ -652,7 +652,7 @@ static int CDECL VehicleMaxSpeedSorter(const void *a, const void *b)
int r;
const Vehicle *ua = va, *ub = vb;
- if (va->type == VEH_Train && vb->type == VEH_Train) {
+ if (va->type == VEH_TRAIN && vb->type == VEH_TRAIN) {
do {
if (RailVehInfo(ua->engine_type)->max_speed != 0)
max_speed_a = min(max_speed_a, RailVehInfo(ua->engine_type)->max_speed);
@@ -826,22 +826,22 @@ static void CreateVehicleListWindow(Window *w)
/* Set up the window widgets */
switch (vl->vehicle_type) {
- case VEH_Train:
+ case VEH_TRAIN:
w->widget[VLW_WIDGET_LIST].tooltips = STR_883D_TRAINS_CLICK_ON_TRAIN_FOR;
w->widget[VLW_WIDGET_AVAILABLE_VEHICLES].data = STR_AVAILABLE_TRAINS;
break;
- case VEH_Road:
+ case VEH_ROAD:
w->widget[VLW_WIDGET_LIST].tooltips = STR_901A_ROAD_VEHICLES_CLICK_ON;
w->widget[VLW_WIDGET_AVAILABLE_VEHICLES].data = STR_AVAILABLE_ROAD_VEHICLES;
break;
- case VEH_Ship:
+ case VEH_SHIP:
w->widget[VLW_WIDGET_LIST].tooltips = STR_9823_SHIPS_CLICK_ON_SHIP_FOR;
w->widget[VLW_WIDGET_AVAILABLE_VEHICLES].data = STR_AVAILABLE_SHIPS;
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
w->widget[VLW_WIDGET_LIST].tooltips = STR_A01F_AIRCRAFT_CLICK_ON_AIRCRAFT;
w->widget[VLW_WIDGET_AVAILABLE_VEHICLES].data = STR_AVAILABLE_AIRCRAFT;
break;
@@ -855,29 +855,29 @@ static void CreateVehicleListWindow(Window *w)
break;
case VLW_STANDARD: /* Company Name - standard widget setup */
switch (vl->vehicle_type) {
- case VEH_Train: w->widget[VLW_WIDGET_CAPTION].data = STR_881B_TRAINS; break;
- case VEH_Road: w->widget[VLW_WIDGET_CAPTION].data = STR_9001_ROAD_VEHICLES; break;
- case VEH_Ship: w->widget[VLW_WIDGET_CAPTION].data = STR_9805_SHIPS; break;
- case VEH_Aircraft: w->widget[VLW_WIDGET_CAPTION].data = STR_A009_AIRCRAFT; break;
+ case VEH_TRAIN: w->widget[VLW_WIDGET_CAPTION].data = STR_881B_TRAINS; break;
+ case VEH_ROAD: w->widget[VLW_WIDGET_CAPTION].data = STR_9001_ROAD_VEHICLES; break;
+ case VEH_SHIP: w->widget[VLW_WIDGET_CAPTION].data = STR_9805_SHIPS; break;
+ case VEH_AIRCRAFT: w->widget[VLW_WIDGET_CAPTION].data = STR_A009_AIRCRAFT; break;
default: NOT_REACHED(); break;
}
break;
case VLW_STATION_LIST: /* Station Name */
switch (vl->vehicle_type) {
- case VEH_Train: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_TRAINS; break;
- case VEH_Road: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_ROAD_VEHICLES; break;
- case VEH_Ship: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_SHIPS; break;
- case VEH_Aircraft: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_AIRCRAFT; break;
+ case VEH_TRAIN: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_TRAINS; break;
+ case VEH_ROAD: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_ROAD_VEHICLES; break;
+ case VEH_SHIP: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_SHIPS; break;
+ case VEH_AIRCRAFT: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_AIRCRAFT; break;
default: NOT_REACHED(); break;
}
break;
case VLW_DEPOT_LIST:
switch (vl->vehicle_type) {
- case VEH_Train: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_TRAIN_DEPOT; break;
- case VEH_Road: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_ROADVEH_DEPOT; break;
- case VEH_Ship: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_SHIP_DEPOT; break;
- case VEH_Aircraft: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_AIRCRAFT_DEPOT; break;
+ case VEH_TRAIN: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_TRAIN_DEPOT; break;
+ case VEH_ROAD: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_ROADVEH_DEPOT; break;
+ case VEH_SHIP: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_SHIP_DEPOT; break;
+ case VEH_AIRCRAFT: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_AIRCRAFT_DEPOT; break;
default: NOT_REACHED(); break;
}
break;
@@ -885,16 +885,16 @@ static void CreateVehicleListWindow(Window *w)
}
switch (vl->vehicle_type) {
- case VEH_Train:
+ case VEH_TRAIN:
w->resize.step_width = 1;
/* Fallthrough */
- case VEH_Road:
+ case VEH_ROAD:
w->vscroll.cap = 7;
w->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_SMALL;
w->resize.height = 220 - (PLY_WND_PRC__SIZE_OF_ROW_SMALL * 3); // Minimum of 4 vehicles
break;
- case VEH_Ship:
- case VEH_Aircraft:
+ case VEH_SHIP:
+ case VEH_AIRCRAFT:
w->vscroll.cap = 4;
w->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_BIG;
break;
@@ -907,10 +907,10 @@ static void CreateVehicleListWindow(Window *w)
* point to the correct global _sorting struct so we are freed
* from having conditionals during window operation */
switch (vl->vehicle_type) {
- case VEH_Train: vl->_sorting = &_sorting.train; break;
- case VEH_Road: vl->_sorting = &_sorting.roadveh; break;
- case VEH_Ship: vl->_sorting = &_sorting.ship; break;
- case VEH_Aircraft: vl->_sorting = &_sorting.aircraft; break;
+ case VEH_TRAIN: vl->_sorting = &_sorting.train; break;
+ case VEH_ROAD: vl->_sorting = &_sorting.roadveh; break;
+ case VEH_SHIP: vl->_sorting = &_sorting.ship; break;
+ case VEH_AIRCRAFT: vl->_sorting = &_sorting.aircraft; break;
default: NOT_REACHED(); break;
}
@@ -932,7 +932,7 @@ static void DrawSmallOrderList(const Vehicle *v, int x, int y)
sel--;
if (order->type == OT_GOTO_STATION) {
- if (v->type == VEH_Ship && GetStation(order->dest)->IsBuoy()) continue;
+ if (v->type == VEH_SHIP && GetStation(order->dest)->IsBuoy()) continue;
SetDParam(0, order->dest);
DrawString(x, y, STR_A036, 0);
@@ -983,13 +983,13 @@ static void DrawVehicleListWindow(Window *w)
case VLW_DEPOT_LIST:
switch (vl->vehicle_type) {
- case VEH_Train: SetDParam(0, STR_8800_TRAIN_DEPOT); break;
- case VEH_Road: SetDParam(0, STR_9003_ROAD_VEHICLE_DEPOT); break;
- case VEH_Ship: SetDParam(0, STR_9803_SHIP_DEPOT); break;
- case VEH_Aircraft: SetDParam(0, STR_A002_AIRCRAFT_HANGAR); break;
+ case VEH_TRAIN: SetDParam(0, STR_8800_TRAIN_DEPOT); break;
+ case VEH_ROAD: SetDParam(0, STR_9003_ROAD_VEHICLE_DEPOT); break;
+ case VEH_SHIP: SetDParam(0, STR_9803_SHIP_DEPOT); break;
+ case VEH_AIRCRAFT: SetDParam(0, STR_A002_AIRCRAFT_HANGAR); break;
default: NOT_REACHED(); break;
}
- if (vl->vehicle_type == VEH_Aircraft) {
+ if (vl->vehicle_type == VEH_AIRCRAFT) {
SetDParam(1, index); // Airport name
} else {
SetDParam(1, GetDepot(index)->town_index);
@@ -1024,10 +1024,10 @@ static void DrawVehicleListWindow(Window *w)
DrawVehicleImage(v, x + 19, y + 6, w->widget[VLW_WIDGET_LIST].right - w->widget[VLW_WIDGET_LIST].left - 20, 0, INVALID_VEHICLE);
DrawString(x + 19, y + w->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, 0);
- if ((v->type == VEH_Train && v->string_id != STR_SV_TRAIN_NAME) ||
- (v->type == VEH_Road && v->string_id != STR_SV_ROADVEH_NAME) ||
- (v->type == VEH_Ship && v->string_id != STR_SV_SHIP_NAME) ||
- (v->type == VEH_Aircraft && v->string_id != STR_SV_AIRCRAFT_NAME)) {
+ if ((v->type == VEH_TRAIN && v->string_id != STR_SV_TRAIN_NAME) ||
+ (v->type == VEH_ROAD && v->string_id != STR_SV_ROADVEH_NAME) ||
+ (v->type == VEH_SHIP && v->string_id != STR_SV_SHIP_NAME) ||
+ (v->type == VEH_AIRCRAFT && v->string_id != STR_SV_AIRCRAFT_NAME)) {
/* The vehicle got a name so we will print it */
SetDParam(0, v->string_id);
@@ -1096,10 +1096,10 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
v = vl->sort_list[id_v];
switch (vl->vehicle_type) {
- case VEH_Train: ShowTrainViewWindow(v); break;
- case VEH_Road: ShowRoadVehViewWindow(v); break;
- case VEH_Ship: ShowShipViewWindow(v); break;
- case VEH_Aircraft: ShowAircraftViewWindow(v); break;
+ case VEH_TRAIN: ShowTrainViewWindow(v); break;
+ case VEH_ROAD: ShowRoadVehViewWindow(v); break;
+ case VEH_SHIP: ShowShipViewWindow(v); break;
+ case VEH_AIRCRAFT: ShowAircraftViewWindow(v); break;
default: NOT_REACHED(); break;
}
} break;
@@ -1244,18 +1244,18 @@ static void ShowVehicleListWindowLocal(PlayerID player, uint16 VLW_flag, byte ve
* some of the windows to the correct size */
switch (vehicle_type) {
default: NOT_REACHED();
- case VEH_Train:
+ case VEH_TRAIN:
w = AllocateWindowDescFront(&_player_vehicle_list_train_desc, num);
if (w != NULL) ResizeWindow(w, 65, 38);
break;
- case VEH_Road:
+ case VEH_ROAD:
w = AllocateWindowDescFront(&_player_vehicle_list_road_veh_desc, num);
if (w != NULL) ResizeWindow(w, 0, 38);
break;
- case VEH_Ship:
+ case VEH_SHIP:
w = AllocateWindowDescFront(&_player_vehicle_list_ship_desc, num);
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
w = AllocateWindowDescFront(&_player_vehicle_list_aircraft_desc, num);
break;
}
@@ -1287,7 +1287,7 @@ void ShowVehicleListWindow(PlayerID player, byte vehicle_type, TileIndex depot_t
{
uint16 depot_airport_index;
- if (vehicle_type == VEH_Aircraft) {
+ if (vehicle_type == VEH_AIRCRAFT) {
depot_airport_index = GetStationIndex(depot_tile);
} else {
Depot *depot = GetDepotByTile(depot_tile);
diff --git a/src/vehicle_gui.h b/src/vehicle_gui.h
index d5c55c722..e104f8307 100644
--- a/src/vehicle_gui.h
+++ b/src/vehicle_gui.h
@@ -56,17 +56,17 @@ void ShowReplaceVehicleWindow(byte vehicletype);
static inline void DrawVehicleImage(const Vehicle *v, int x, int y, int count, int skip, VehicleID selection)
{
switch (v->type) {
- case VEH_Train: DrawTrainImage(v, x, y, count, skip, selection); break;
- case VEH_Road: DrawRoadVehImage(v, x, y, selection); break;
- case VEH_Ship: DrawShipImage(v, x, y, selection); break;
- case VEH_Aircraft: DrawAircraftImage(v, x, y, selection); break;
+ case VEH_TRAIN: DrawTrainImage(v, x, y, count, skip, selection); break;
+ case VEH_ROAD: DrawRoadVehImage(v, x, y, selection); break;
+ case VEH_SHIP: DrawShipImage(v, x, y, selection); break;
+ case VEH_AIRCRAFT: DrawAircraftImage(v, x, y, selection); break;
default: NOT_REACHED();
}
}
static inline uint GetVehicleListHeight(byte type)
{
- return (type == VEH_Train || type == VEH_Road) ? 14 : 24;
+ return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24;
}
#endif /* VEHICLE_GUI_H */
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index ed4b2d726..4b1270797 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -610,7 +610,7 @@ static void FloodVehicle(Vehicle *v)
if (!(v->vehstatus & VS_CRASHED)) {
uint16 pass = 0;
- if (v->type == VEH_Road) { // flood bus/truck
+ if (v->type == VEH_ROAD) { // flood bus/truck
pass = 1; // driver
if (v->cargo_type == CT_PASSENGERS)
pass += v->cargo_count;
@@ -618,7 +618,7 @@ static void FloodVehicle(Vehicle *v)
v->vehstatus |= VS_CRASHED;
v->u.road.crashed_ctr = 2000; // max 2220, disappear pretty fast
RebuildVehicleLists();
- } else if (v->type == VEH_Train) {
+ } else if (v->type == VEH_TRAIN) {
Vehicle *u;
v = GetFirstVehicleInChain(v);
@@ -727,7 +727,7 @@ static void ClickTile_Water(TileIndex tile)
if (GetWaterTileType(tile) == WATER_TILE_DEPOT) {
TileIndex tile2 = GetOtherShipDepotTile(tile);
- ShowDepotWindow(tile < tile2 ? tile : tile2, VEH_Ship);
+ ShowDepotWindow(tile < tile2 ? tile : tile2, VEH_SHIP);
}
}
diff --git a/src/yapf/follow_track.hpp b/src/yapf/follow_track.hpp
index 4e0a29a87..0e522a00f 100644
--- a/src/yapf/follow_track.hpp
+++ b/src/yapf/follow_track.hpp
@@ -22,7 +22,7 @@ struct CFollowTrackT : public FollowTrack_t
FORCEINLINE void Init(const Vehicle* v, CPerformanceTimer* pPerf)
{
- assert(!IsRailTT() || (v != NULL && v->type == VEH_Train));
+ assert(!IsRailTT() || (v != NULL && v->type == VEH_TRAIN));
m_veh = v;
m_pPerf = pPerf;
// don't worry, all is inlined so compiler should remove unnecessary initializations
diff --git a/src/yapf/yapf_costrail.hpp b/src/yapf/yapf_costrail.hpp
index 9a37b28e5..8efda0c27 100644
--- a/src/yapf/yapf_costrail.hpp
+++ b/src/yapf/yapf_costrail.hpp
@@ -154,7 +154,7 @@ public:
int cost = 0;
const Vehicle* v = Yapf().GetVehicle();
assert(v != NULL);
- assert(v->type == VEH_Train);
+ assert(v->type == VEH_TRAIN);
assert(v->u.rail.cached_total_length != 0);
int needed_platform_length = (v->u.rail.cached_total_length + TILE_SIZE - 1) / TILE_SIZE;
if (platform_length > needed_platform_length) {