|
@@ -36,12 +36,13 @@
|
|
|
#include "newgrf_object.h"
|
|
|
#include "rev.h"
|
|
|
#include "fios.h"
|
|
|
#include "strings_func.h"
|
|
|
#include "date_func.h"
|
|
|
#include "timer/timer_game_tick.h"
|
|
|
#include "timer/timer_game_calendar.h"
|
|
|
#include "string_func.h"
|
|
|
#include "network/core/config.h"
|
|
|
#include <map>
|
|
|
#include "smallmap_gui.h"
|
|
|
#include "genworld.h"
|
|
|
#include "error.h"
|
|
@@ -2757,13 +2758,13 @@ static ChangeInfoResult GlobalVarChangeI
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
case 0x0F: { // Euro introduction dates
|
|
|
uint curidx = GetNewgrfCurrencyIdConverted(gvid + i);
|
|
|
Year year_euro = buf->ReadWord();
|
|
|
TimerGameCalendar::Year year_euro = buf->ReadWord();
|
|
|
|
|
|
if (curidx < CURRENCY_END) {
|
|
|
_currency_specs[curidx].to_euro = year_euro;
|
|
|
} else {
|
|
|
GrfMsg(1, "GlobalVarChangeInfo: Euro intro date {} out of range, ignoring", curidx);
|
|
|
}
|
|
@@ -6511,13 +6512,13 @@ bool GetGlobalVariable(byte param, uint3
|
|
|
*value = Clamp(TimerGameCalendar::year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR;
|
|
|
return true;
|
|
|
|
|
|
case 0x02: { // detailed date information: month of year (bit 0-7), day of month (bit 8-12), leap year (bit 15), day of year (bit 16-24)
|
|
|
YearMonthDay ymd;
|
|
|
ConvertDateToYMD(TimerGameCalendar::date, &ymd);
|
|
|
Date start_of_year = ConvertYMDToDate(ymd.year, 0, 1);
|
|
|
TimerGameCalendar::Date start_of_year = ConvertYMDToDate(ymd.year, 0, 1);
|
|
|
*value = ymd.month | (ymd.day - 1) << 8 | (IsLeapYear(ymd.year) ? 1 << 15 : 0) | (TimerGameCalendar::date - start_of_year) << 16;
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
case 0x03: // current climate, 0=temp, 1=arctic, 2=trop, 3=toyland
|
|
|
*value = _settings_game.game_creation.landscape;
|
|
@@ -9237,13 +9238,13 @@ static bool IsHouseSpecValid(HouseSpec *
|
|
|
* climate / housezone combination.
|
|
|
* @param bitmask The climate and housezone to check for. Exactly one climate
|
|
|
* bit and one housezone bit should be set.
|
|
|
*/
|
|
|
static void EnsureEarlyHouse(HouseZones bitmask)
|
|
|
{
|
|
|
Year min_year = MAX_YEAR;
|
|
|
TimerGameCalendar::Year min_year = MAX_YEAR;
|
|
|
|
|
|
for (int i = 0; i < NUM_HOUSES; i++) {
|
|
|
HouseSpec *hs = HouseSpec::Get(i);
|
|
|
if (hs == nullptr || !hs->enabled) continue;
|
|
|
if ((hs->building_availability & bitmask) != bitmask) continue;
|
|
|
if (hs->min_year < min_year) min_year = hs->min_year;
|
|
@@ -9935,15 +9936,15 @@ static void AfterLoadGRFs()
|
|
|
void LoadNewGRF(uint load_index, uint num_baseset)
|
|
|
{
|
|
|
/* In case of networking we need to "sync" the start values
|
|
|
* so all NewGRFs are loaded equally. For this we use the
|
|
|
* start date of the game and we set the counters, etc. to
|
|
|
* 0 so they're the same too. */
|
|
|
Date date = TimerGameCalendar::date;
|
|
|
Year year = TimerGameCalendar::year;
|
|
|
DateFract date_fract = TimerGameCalendar::date_fract;
|
|
|
TimerGameCalendar::Date date = TimerGameCalendar::date;
|
|
|
TimerGameCalendar::Year year = TimerGameCalendar::year;
|
|
|
TimerGameCalendar::DateFract date_fract = TimerGameCalendar::date_fract;
|
|
|
uint64 tick_counter = TimerGameTick::counter;
|
|
|
byte display_opt = _display_opt;
|
|
|
|
|
|
if (_networking) {
|
|
|
TimerGameCalendar::year = _settings_game.game_creation.starting_year;
|
|
|
TimerGameCalendar::date = ConvertYMDToDate(TimerGameCalendar::year, 0, 1);
|