diff options
author | bjarni <bjarni@openttd.org> | 2005-11-18 23:41:03 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2005-11-18 23:41:03 +0000 |
commit | 22a46798378768271af6b90cd41327155a909dd2 (patch) | |
tree | 3dd0d12983f0eaa08af460475f1f8b0a2c961d75 /economy.c | |
parent | 40ec9bb1235a2231f0c883baaae73e106c67f1cf (diff) | |
download | openttd-22a46798378768271af6b90cd41327155a909dd2.tar.xz |
(svn r3218) -Feature: Multiheaded train engines will now stay in the same train
This means that any user attempt to remove a rear engine will tell the user to move the front engine instead
This fixes the assert when moving multiheaded engines (introduced in r3144)
Note: to make old savegames use this feature, some engines might be turned around in order to link engines in pairs
-Codechange: train subtype is now a bitmask
This allows fast access to info like if it is a wagon or engine and if it is in front and so on
Note: savegame version bump
Diffstat (limited to 'economy.c')
-rw-r--r-- | economy.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -26,6 +26,7 @@ #include "variables.h" #include "vehicle_gui.h" #include "ai/ai.h" +#include "train.h" // Score info const ScoreInfo _score_info[] = { @@ -129,7 +130,7 @@ int UpdateCompanyRatingAndValue(Player *p, bool update) FOR_ALL_VEHICLES(v) { if (v->owner != owner) continue; - if ((v->type == VEH_Train && v->subtype == TS_Front_Engine) || + if ((v->type == VEH_Train && IsFrontEngine(v)) || v->type == VEH_Road || (v->type == VEH_Aircraft && v->subtype<=2) || v->type == VEH_Ship) { @@ -313,7 +314,7 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player) if (v->owner == new_player) { switch (v->type) { case VEH_Train: - if (v->subtype == TS_Front_Engine) num_train++; + if (IsFrontEngine(v)) num_train++; break; case VEH_Road: num_road++; @@ -338,7 +339,7 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player) DeleteVehicle(v); } else { v->owner = new_player; - if (v->type == VEH_Train && v->subtype == TS_Front_Engine) + if (v->type == VEH_Train && IsFrontEngine(v)) v->unitnumber = ++num_train; else if (v->type == VEH_Road) v->unitnumber = ++num_road; @@ -1289,7 +1290,7 @@ static bool LoadWait(const Vehicle *v, const Vehicle *u) { } FOR_ALL_VEHICLES(x) { - if ((x->type != VEH_Train || x->subtype == TS_Front_Engine) && // 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) && // not stopped x->current_order.type == OT_LOADING && // loading |