(svn r14835) -Change: apply the 'warn if train's income is negative' setting to other vehicle types, too

pull/155/head
smatz 16 years ago
parent 87b71b3872
commit ec7ebf2170

@ -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;

@ -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();

@ -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

@ -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

@ -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),

@ -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

@ -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

@ -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;

@ -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);
}
}
}

Loading…
Cancel
Save