Merge branch 'master' into jgrpp
# Conflicts: # config.lib # projects/openttd_vs140.vcxproj # projects/openttd_vs140.vcxproj.filters # projects/openttd_vs141.vcxproj # projects/openttd_vs141.vcxproj.filters # projects/openttd_vs142.vcxproj # projects/openttd_vs142.vcxproj.filters # src/aircraft_cmd.cpp # src/base_station_base.h # src/core/pool_type.hpp # src/disaster_vehicle.cpp # src/economy.cpp # src/engine.cpp # src/group.h # src/group_cmd.cpp # src/group_gui.cpp # src/lang/english.txt # src/lang/german.txt # src/linkgraph/linkgraph_gui.cpp # src/network/network_command.cpp # src/network/network_server.cpp # src/openttd.cpp # src/order_cmd.cpp # src/road_cmd.cpp # src/saveload/afterload.cpp # src/saveload/cargopacket_sl.cpp # src/saveload/linkgraph_sl.cpp # src/saveload/order_sl.cpp # src/saveload/station_sl.cpp # src/saveload/town_sl.cpp # src/saveload/vehicle_sl.cpp # src/screenshot.cpp # src/screenshot.h # src/settings_gui.cpp # src/settings_type.h # src/smallmap_gui.cpp # src/station.cpp # src/station_cmd.cpp # src/table/settings.ini # src/toolbar_gui.cpp # src/town_cmd.cpp # src/train.h # src/train_cmd.cpp # src/train_gui.cpp # src/vehicle.cpp # src/vehicle_base.h # src/vehiclelist.cpp # src/window_type.h
This commit is contained in:
13
src/date.cpp
13
src/date.cpp
@@ -38,6 +38,8 @@ YearMonthDay _game_load_cur_date_ymd;
|
||||
DateFract _game_load_date_fract;
|
||||
uint8 _game_load_tick_skip_counter;
|
||||
|
||||
int32 _old_ending_year_slv_105; ///< Old ending year for savegames before SLV_105
|
||||
|
||||
/**
|
||||
* Set the date.
|
||||
* @param date New date
|
||||
@@ -216,21 +218,18 @@ static void OnNewYear()
|
||||
|
||||
if (_cur_year == _settings_client.gui.semaphore_build_before) ResetSignalVariant();
|
||||
|
||||
/* check if we reached end of the game */
|
||||
if (_cur_year == ORIGINAL_END_YEAR) {
|
||||
/* check if we reached end of the game (end of ending year) */
|
||||
if (_cur_year == _settings_game.game_creation.ending_year + 1) {
|
||||
ShowEndGameChart();
|
||||
/* check if we reached the maximum year, decrement dates by a year */
|
||||
} else if (_cur_year == MAX_YEAR + 1) {
|
||||
Vehicle *v;
|
||||
int days_this_year;
|
||||
|
||||
_cur_year--;
|
||||
days_this_year = IsLeapYear(_cur_year) ? DAYS_IN_LEAP_YEAR : DAYS_IN_YEAR;
|
||||
_date -= days_this_year;
|
||||
FOR_ALL_VEHICLES(v) v->date_of_last_service -= days_this_year;
|
||||
|
||||
LinkGraph *lg;
|
||||
FOR_ALL_LINK_GRAPHS(lg) lg->ShiftDates(-days_this_year);
|
||||
for (Vehicle *v : Vehicle::Iterate()) v->date_of_last_service -= days_this_year;
|
||||
for (LinkGraph *lg : LinkGraph::Iterate()) lg->ShiftDates(-days_this_year);
|
||||
|
||||
/* Because the _date wraps here, and text-messages expire by game-days, we have to clean out
|
||||
* all of them if the date is set back, else those messages will hang for ever */
|
||||
|
Reference in New Issue
Block a user