Fixes to auto timetable patch: move new VehicleFlags to end,

whitespace & style, fix lang strings.
This commit is contained in:
Jonathan G Rennison
2015-08-04 21:29:19 +01:00
parent 80deb3c01d
commit 0ebf8b6b0b
9 changed files with 22 additions and 21 deletions

View File

@@ -325,7 +325,7 @@ enum Commands {
CMD_CHANGE_TIMETABLE, ///< change the timetable for a vehicle CMD_CHANGE_TIMETABLE, ///< change the timetable for a vehicle
CMD_SET_VEHICLE_ON_TIME, ///< set the vehicle on time feature (timetable) CMD_SET_VEHICLE_ON_TIME, ///< set the vehicle on time feature (timetable)
CMD_AUTOFILL_TIMETABLE, ///< autofill the timetable CMD_AUTOFILL_TIMETABLE, ///< autofill the timetable
CMD_AUTOMATE_TIMETABLE, ///< automate the timetable CMD_AUTOMATE_TIMETABLE, ///< automate the timetable
CMD_SET_TIMETABLE_START, ///< set the date that a timetable should start CMD_SET_TIMETABLE_START, ///< set the date that a timetable should start
CMD_OPEN_CLOSE_AIRPORT, ///< open/close an airport to incoming aircraft CMD_OPEN_CLOSE_AIRPORT, ///< open/close an airport to incoming aircraft

View File

@@ -1398,12 +1398,12 @@ STR_CONFIG_SETTING_ADVANCED_VEHICLE_LISTS :Use groups in v
STR_CONFIG_SETTING_ADVANCED_VEHICLE_LISTS_HELPTEXT :Enable usage of the advanced vehicle lists for grouping vehicles STR_CONFIG_SETTING_ADVANCED_VEHICLE_LISTS_HELPTEXT :Enable usage of the advanced vehicle lists for grouping vehicles
STR_CONFIG_SETTING_LOADING_INDICATORS :Use loading indicators: {STRING2} STR_CONFIG_SETTING_LOADING_INDICATORS :Use loading indicators: {STRING2}
STR_CONFIG_SETTING_LOADING_INDICATORS_HELPTEXT :Select whether loading indicators are displayed above loading or unloading vehicles STR_CONFIG_SETTING_LOADING_INDICATORS_HELPTEXT :Select whether loading indicators are displayed above loading or unloading vehicles
STR_CONFIG_SETTING_TIMETABLE_AUTOMATED :{LTBLUE}Automatically manage timetables: {ORANGE}{STRING2} STR_CONFIG_SETTING_TIMETABLE_AUTOMATED :Automatically manage timetables: {STRING2}
STR_CONFIG_SETTING_TIMETABLE_AUTOMATED_HELPTEXT :Whether to enable automatic timetables STR_CONFIG_SETTING_TIMETABLE_AUTOMATED_HELPTEXT :Whether to enable automatic timetables
STR_CONFIG_SETTING_TIMETABLE_IN_TICKS :Show timetable in ticks rather than days: {STRING2} STR_CONFIG_SETTING_TIMETABLE_IN_TICKS :Show timetable in ticks rather than days: {STRING2}
STR_CONFIG_SETTING_TIMETABLE_IN_TICKS_HELPTEXT :Show travel times in time tables in game ticks instead of days STR_CONFIG_SETTING_TIMETABLE_IN_TICKS_HELPTEXT :Show travel times in time tables in game ticks instead of days
STR_CONFIG_SETTING_TIMETABLE_SEPARATION :{LTBLUE}Use timetable to ensure vehicle separation: {ORANGE}{STRING2} STR_CONFIG_SETTING_TIMETABLE_SEPARATION :Use timetable to ensure vehicle separation: {STRING2}
STR_CONFIG_SETTING_TIMETABLE_SEPARATION_HELPTEXT :Select whether to ensure separation of vehicles when using automatic timetables STR_CONFIG_SETTING_TIMETABLE_SEPARATION_HELPTEXT :Select whether to ensure separation of vehicles when using automatic timetables
STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE :Show arrival and departure in timetables: {STRING2} STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE :Show arrival and departure in timetables: {STRING2}
STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE_HELPTEXT :Display anticipated arrival and departure times in timetables STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE_HELPTEXT :Display anticipated arrival and departure times in timetables
STR_CONFIG_SETTING_QUICKGOTO :Quick creation of vehicle orders: {STRING2} STR_CONFIG_SETTING_QUICKGOTO :Quick creation of vehicle orders: {STRING2}
@@ -3941,8 +3941,8 @@ STR_TIMETABLE_RESET_LATENESS_TOOLTIP :{BLACK}Reset th
STR_TIMETABLE_AUTOFILL :{BLACK}Autofill STR_TIMETABLE_AUTOFILL :{BLACK}Autofill
STR_TIMETABLE_AUTOFILL_TOOLTIP :{BLACK}Fill the timetable automatically with the values from the next journey (Ctrl+Click to try to keep waiting times) STR_TIMETABLE_AUTOFILL_TOOLTIP :{BLACK}Fill the timetable automatically with the values from the next journey (Ctrl+Click to try to keep waiting times)
STR_TIMETABLE_AUTOMATE :{BLACK}Automate STR_TIMETABLE_AUTOMATE :{BLACK}Automate
STR_TIMETABLE_AUTOMATE_TOOLTIP :{BLACK}Manage the timetables automatically by updating the values for each journey STR_TIMETABLE_AUTOMATE_TOOLTIP :{BLACK}Manage the timetables automatically by updating the values for each journey
STR_TIMETABLE_EXPECTED :{BLACK}Expected STR_TIMETABLE_EXPECTED :{BLACK}Expected
STR_TIMETABLE_SCHEDULED :{BLACK}Scheduled STR_TIMETABLE_SCHEDULED :{BLACK}Scheduled

View File

@@ -1622,8 +1622,9 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/* Set automation bit if target has it. */ /* Set automation bit if target has it. */
if (HasBit(src->vehicle_flags, VF_AUTOMATE_TIMETABLE)) if (HasBit(src->vehicle_flags, VF_AUTOMATE_TIMETABLE)) {
SetBit(dst->vehicle_flags, VF_AUTOMATE_TIMETABLE); SetBit(dst->vehicle_flags, VF_AUTOMATE_TIMETABLE);
}
if (_settings_game.order.timetable_separation) dst->ClearSeparation(); if (_settings_game.order.timetable_separation) dst->ClearSeparation();
if (_settings_game.order.timetable_separation) ClrBit(dst->vehicle_flags, VF_TIMETABLE_STARTED); if (_settings_game.order.timetable_separation) ClrBit(dst->vehicle_flags, VF_TIMETABLE_STARTED);

View File

@@ -693,7 +693,7 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
SLE_CONDVAR(Vehicle, waiting_triggers, SLE_UINT8, 2, SL_MAX_VERSION), SLE_CONDVAR(Vehicle, waiting_triggers, SLE_UINT8, 2, SL_MAX_VERSION),
SLE_CONDREF(Vehicle, ahead_separation, REF_VEHICLE, TIMESEP_SV, SL_MAX_VERSION), SLE_CONDREF(Vehicle, ahead_separation, REF_VEHICLE, TIMESEP_SV, SL_MAX_VERSION),
SLE_CONDREF(Vehicle, behind_separation, REF_VEHICLE, TIMESEP_SV, SL_MAX_VERSION), SLE_CONDREF(Vehicle, behind_separation, REF_VEHICLE, TIMESEP_SV, SL_MAX_VERSION),
SLE_CONDREF(Vehicle, next_shared, REF_VEHICLE, 2, SL_MAX_VERSION), SLE_CONDREF(Vehicle, next_shared, REF_VEHICLE, 2, SL_MAX_VERSION),
SLE_CONDNULL(2, 2, 68), SLE_CONDNULL(2, 2, 68),
@@ -702,7 +702,7 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
SLE_CONDVAR(Vehicle, group_id, SLE_UINT16, 60, SL_MAX_VERSION), SLE_CONDVAR(Vehicle, group_id, SLE_UINT16, 60, SL_MAX_VERSION),
SLE_CONDVAR(Vehicle, current_order_time, SLE_UINT32, 67, SL_MAX_VERSION), SLE_CONDVAR(Vehicle, current_order_time, SLE_UINT32, 67, SL_MAX_VERSION),
SLE_CONDVAR(Vehicle, current_loading_time, SLE_UINT32, TIMESEP_SV, SL_MAX_VERSION), SLE_CONDVAR(Vehicle, current_loading_time, SLE_UINT32, TIMESEP_SV, SL_MAX_VERSION),
SLE_CONDVAR(Vehicle, lateness_counter, SLE_INT32, 67, SL_MAX_VERSION), SLE_CONDVAR(Vehicle, lateness_counter, SLE_INT32, 67, SL_MAX_VERSION),
SLE_CONDNULL(10, 2, 143), // old reserved space SLE_CONDNULL(10, 2, 143), // old reserved space

View File

@@ -438,8 +438,8 @@ struct OrderSettings {
bool gradual_loading; ///< load vehicles gradually bool gradual_loading; ///< load vehicles gradually
bool selectgoods; ///< only send the goods to station if a train has been there bool selectgoods; ///< only send the goods to station if a train has been there
bool no_servicing_if_no_breakdowns; ///< don't send vehicles to depot when breakdowns are disabled bool no_servicing_if_no_breakdowns; ///< don't send vehicles to depot when breakdowns are disabled
bool timetable_automated; ///< whether to automatically manage timetables bool timetable_automated; ///< whether to automatically manage timetables
bool timetable_separation; ///< whether to perform automatic separation based on timetable bool timetable_separation; ///< whether to perform automatic separation based on timetable
bool serviceathelipad; ///< service helicopters at helipads automatically (no need to send to depot) bool serviceathelipad; ///< service helicopters at helipads automatically (no need to send to depot)
}; };

View File

@@ -56,8 +56,7 @@ public:
offset(0), offset(0),
num_param(size) num_param(size)
{ {
uint left = parent.GetDataLeft(); assert(size <= parent.GetDataLeft());
assert(size <= left);
if (parent.type == NULL) { if (parent.type == NULL) {
this->type = NULL; this->type = NULL;
} else { } else {

View File

@@ -2142,8 +2142,9 @@ void Vehicle::HandleLoading(bool mode)
uint wait_time = max(this->current_order.GetTimetabledWait() - this->lateness_counter, 0); uint wait_time = max(this->current_order.GetTimetabledWait() - this->lateness_counter, 0);
/* Save time just loading took since that is what goes into the timetable */ /* Save time just loading took since that is what goes into the timetable */
if (!HasBit(this->vehicle_flags, VF_LOADING_FINISHED)) if (!HasBit(this->vehicle_flags, VF_LOADING_FINISHED)) {
this->current_loading_time = this->current_order_time; this->current_loading_time = this->current_order_time;
}
/* Not the first call for this tick, or still loading */ /* Not the first call for this tick, or still loading */
if (mode || !HasBit(this->vehicle_flags, VF_LOADING_FINISHED) || this->current_order_time < wait_time) return; if (mode || !HasBit(this->vehicle_flags, VF_LOADING_FINISHED) || this->current_order_time < wait_time) return;

View File

@@ -46,11 +46,11 @@ enum VehicleFlags {
VF_TIMETABLE_STARTED, ///< Whether the vehicle has started running on the timetable yet. VF_TIMETABLE_STARTED, ///< Whether the vehicle has started running on the timetable yet.
VF_AUTOFILL_TIMETABLE, ///< Whether the vehicle should fill in the timetable automatically. VF_AUTOFILL_TIMETABLE, ///< Whether the vehicle should fill in the timetable automatically.
VF_AUTOFILL_PRES_WAIT_TIME, ///< Whether non-destructive auto-fill should preserve waiting times VF_AUTOFILL_PRES_WAIT_TIME, ///< Whether non-destructive auto-fill should preserve waiting times
VF_AUTOMATE_TIMETABLE, ///< Whether the vehicle should manage the timetable automatically.
VF_STOP_LOADING, ///< Don't load anymore during the next load cycle. VF_STOP_LOADING, ///< Don't load anymore during the next load cycle.
VF_PATHFINDER_LOST, ///< Vehicle's pathfinder is lost. VF_PATHFINDER_LOST, ///< Vehicle's pathfinder is lost.
VF_SERVINT_IS_CUSTOM, ///< Service interval is custom. VF_SERVINT_IS_CUSTOM, ///< Service interval is custom.
VF_SERVINT_IS_PERCENT, ///< Service interval is percent. VF_SERVINT_IS_PERCENT, ///< Service interval is percent.
VF_AUTOMATE_TIMETABLE, ///< Whether the vehicle should manage the timetable automatically.
}; };
/** Bit numbers used to indicate which of the #NewGRFCache values are valid. */ /** Bit numbers used to indicate which of the #NewGRFCache values are valid. */
@@ -191,7 +191,7 @@ public:
/* Used for timetabling. */ /* Used for timetabling. */
uint32 current_order_time; ///< How many ticks have passed since this order started. uint32 current_order_time; ///< How many ticks have passed since this order started.
uint32 current_loading_time; ///< How long loading took. Less than current_order_time if vehicle is early. uint32 current_loading_time; ///< How long loading took. Less than current_order_time if vehicle is early.
int32 lateness_counter; ///< How many ticks late (or early if negative) this vehicle is. int32 lateness_counter; ///< How many ticks late (or early if negative) this vehicle is.
Date timetable_start; ///< When the vehicle is supposed to start the timetable. Date timetable_start; ///< When the vehicle is supposed to start the timetable.