diff options
author | smatz <smatz@openttd.org> | 2009-01-04 18:34:23 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-01-04 18:34:23 +0000 |
commit | 67bf6a0998eb7e0be39449ca5b2563ace66b3a30 (patch) | |
tree | 24e7c278186d5ebd3bd6bce940783e6debc48253 /src | |
parent | f1cc20edc076a550615e1da3f1d453c47d6e55c2 (diff) | |
download | openttd-67bf6a0998eb7e0be39449ca5b2563ace66b3a30.tar.xz |
(svn r14835) -Change: apply the 'warn if train's income is negative' setting to other vehicle types, too
Diffstat (limited to 'src')
-rw-r--r-- | src/aircraft_cmd.cpp | 13 | ||||
-rw-r--r-- | src/date.cpp | 10 | ||||
-rw-r--r-- | src/lang/english.txt | 4 | ||||
-rw-r--r-- | src/roadveh_cmd.cpp | 14 | ||||
-rw-r--r-- | src/settings.cpp | 2 | ||||
-rw-r--r-- | src/settings_type.h | 2 | ||||
-rw-r--r-- | src/ship_cmd.cpp | 14 | ||||
-rw-r--r-- | src/train_cmd.cpp | 25 | ||||
-rw-r--r-- | src/vehicle.cpp | 26 |
9 files changed, 32 insertions, 78 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 41bc1663f..8589df295 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -654,19 +654,6 @@ void Aircraft::OnNewDay() InvalidateWindowClasses(WC_AIRCRAFT_LIST); } -void AircraftYearlyLoop() -{ - Vehicle *v; - - FOR_ALL_VEHICLES(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); - } - } -} - static void AgeAircraftCargo(Vehicle *v) { if (_age_cargo_skip_counter != 0) return; diff --git a/src/date.cpp b/src/date.cpp index 9d2f8e29f..f06640d80 100644 --- a/src/date.cpp +++ b/src/date.cpp @@ -165,10 +165,7 @@ extern void IndustryMonthlyLoop(); extern void StationMonthlyLoop(); extern void CompaniesYearlyLoop(); -extern void TrainsYearlyLoop(); -extern void RoadVehiclesYearlyLoop(); -extern void AircraftYearlyLoop(); -extern void ShipsYearlyLoop(); +extern void VehiclesYearlyLoop(); extern void TownsYearlyLoop(); extern void ShowEndGameChart(); @@ -270,10 +267,7 @@ void IncreaseDate() /* yes, call various yearly loops */ CompaniesYearlyLoop(); - TrainsYearlyLoop(); - RoadVehiclesYearlyLoop(); - AircraftYearlyLoop(); - ShipsYearlyLoop(); + VehiclesYearlyLoop(); TownsYearlyLoop(); #ifdef ENABLE_NETWORK if (_network_server) NetworkServerYearlyLoop(); diff --git a/src/lang/english.txt b/src/lang/english.txt index 3840a0816..bb2f83520 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -996,7 +996,7 @@ STR_END_OF_SHARED_ORDERS :{SETX 10}- - En STR_TRAIN_IS_STUCK :{WHITE}{VEHICLE} can't find a path to continue. STR_TRAIN_IS_LOST :{WHITE}{VEHICLE} is lost. -STR_TRAIN_IS_UNPROFITABLE :{WHITE}{VEHICLE}'s profit last year was {CURRENCY} +STR_VEHICLE_IS_UNPROFITABLE :{WHITE}{VEHICLE}'s profit last year was {CURRENCY} STR_EURO_INTRODUCE :{BLACK}{BIGFONT}European Monetary Union!{}{}The Euro is introduced as the sole currency for everyday transactions in your country! # Start of order review system. @@ -1062,7 +1062,7 @@ STR_CONFIG_PATCHES_ORDER_REVIEW :{LTBLUE}Review STR_CONFIG_PATCHES_ORDER_REVIEW_OFF :no STR_CONFIG_PATCHES_ORDER_REVIEW_EXDEPOT :yes, but exclude stopped vehicles STR_CONFIG_PATCHES_ORDER_REVIEW_ON :of all vehicles -STR_CONFIG_PATCHES_WARN_INCOME_LESS :{LTBLUE}Warn if a train's income is negative: {ORANGE}{STRING1} +STR_CONFIG_PATCHES_WARN_INCOME_LESS :{LTBLUE}Warn if a vehicle's income is negative: {ORANGE}{STRING1} STR_CONFIG_PATCHES_NEVER_EXPIRE_VEHICLES :{LTBLUE}Vehicles never expire: {ORANGE}{STRING1} STR_CONFIG_PATCHES_AUTORENEW_VEHICLE :{LTBLUE}Autorenew vehicle when it gets old STR_CONFIG_PATCHES_AUTORENEW_MONTHS :{LTBLUE}Autorenew when vehicle is {ORANGE}{STRING1}{LTBLUE} months before/after max age diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 2c1db2d1c..bc5414f0d 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -1981,20 +1981,6 @@ void RoadVehicle::OnNewDay() InvalidateWindowClasses(WC_ROADVEH_LIST); } - -void RoadVehiclesYearlyLoop() -{ - Vehicle *v; - - FOR_ALL_VEHICLES(v) { - if (v->type == VEH_ROAD) { - v->profit_last_year = v->profit_this_year; - v->profit_this_year = 0; - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); - } - } -} - /** Refit a road vehicle to the specified cargo type * @param tile unused * @param flags operation to perform diff --git a/src/settings.cpp b/src/settings.cpp index a7bea9cf0..3d1edde81 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1444,7 +1444,7 @@ const SettingDesc _patch_settings[] = { SDTC_BOOL(gui.enable_signal_gui, S, 0, false, STR_CONFIG_PATCHES_ENABLE_SIGNAL_GUI, CloseSignalGUI), SDTC_VAR(gui.drag_signals_density, SLE_UINT8, S, 0, 4, 1, 20, 0, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY, DragSignalsDensityChanged), SDTC_VAR(gui.semaphore_build_before, SLE_INT32, S, NC, 1975, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_SEMAPHORE_BUILD_BEFORE_DATE, ResetSignalVariant), - SDTC_BOOL(gui.train_income_warn, S, 0, true, STR_CONFIG_PATCHES_WARN_INCOME_LESS, NULL), + SDTC_BOOL(gui.vehicle_income_warn, S, 0, true, STR_CONFIG_PATCHES_WARN_INCOME_LESS, NULL), SDTC_VAR(gui.order_review_system, SLE_UINT8, S, MS, 2, 0, 2, 0, STR_CONFIG_PATCHES_ORDER_REVIEW, NULL), SDTC_BOOL(gui.lost_train_warn, S, 0, true, STR_CONFIG_PATCHES_WARN_LOST_TRAIN, NULL), SDTC_BOOL(gui.autorenew, S, 0, false, STR_CONFIG_PATCHES_AUTORENEW_VEHICLE, EngineRenewUpdate), diff --git a/src/settings_type.h b/src/settings_type.h index 974587c9c..f75fb2d30 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -39,7 +39,7 @@ struct GUISettings { bool sg_full_load_any; ///< new full load calculation, any cargo must be full read from pre v93 savegames bool lost_train_warn; ///< if a train can't find its destination, show a warning uint8 order_review_system; ///< perform order reviews on vehicles - bool train_income_warn; ///< if train is generating little income, show a warning + bool vehicle_income_warn; ///< if a vehicle isn't generating income, show a warning bool status_long_date; ///< always show long date in status bar bool show_finances; ///< show finances at end of year bool sg_new_nonstop; ///< ttdpatch compatible nonstop handling read from pre v93 savegames diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index 6edf7c7b2..ea7edb8e4 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -731,20 +731,6 @@ void Ship::Tick() ShipController(this); } - -void ShipsYearlyLoop() -{ - Vehicle *v; - - FOR_ALL_VEHICLES(v) { - if (v->type == VEH_SHIP) { - v->profit_last_year = v->profit_this_year; - v->profit_this_year = 0; - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); - } - } -} - /** Build a ship. * @param tile tile of depot where ship is built * @param flags type of operation diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 58981720c..5521b0b8f 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -4471,31 +4471,6 @@ void Train::OnNewDay() } } -void TrainsYearlyLoop() -{ - Vehicle *v; - - FOR_ALL_VEHICLES(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 (_settings_client.gui.train_income_warn && v->owner == _local_company && v->age >= 730 && v->GetDisplayProfitThisYear() < 0) { - SetDParam(1, v->GetDisplayProfitThisYear()); - SetDParam(0, v->index); - AddNewsItem( - STR_TRAIN_IS_UNPROFITABLE, - NS_ADVICE, - v->index, - 0); - } - - v->profit_last_year = v->profit_this_year; - v->profit_this_year = 0; - InvalidateWindow(WC_VEHICLE_DETAILS, v->index); - } - } -} - - void InitializeTrains() { _age_cargo_skip_counter = 1; diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 3769b1a7f..e88854bcc 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -2231,3 +2231,29 @@ void StopAllVehicles() InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); } } + +void VehiclesYearlyLoop() +{ + Vehicle *v; + FOR_ALL_VEHICLES(v) { + if (v->IsPrimaryVehicle()) { + /* show warning if vehicle is not generating enough income last 2 years (corresponds to a red icon in the vehicle list) */ + if (_settings_client.gui.vehicle_income_warn && v->owner == _local_company && v->age >= 730) { + Money profit = v->GetDisplayProfitThisYear(); + if (profit < 0) { + SetDParam(0, v->index); + SetDParam(1, profit); + AddNewsItem( + STR_VEHICLE_IS_UNPROFITABLE, + NS_ADVICE, + v->index, + 0); + } + } + + v->profit_last_year = v->profit_this_year; + v->profit_this_year = 0; + InvalidateWindow(WC_VEHICLE_DETAILS, v->index); + } + } +} |