mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
-Codechange: store all year related variables that are _not_ stored in a savegame/transported over the network in the same format as _cur_year
This commit is contained in:
parent
50e96f8ff9
commit
3cab5f30c0
|
@ -362,7 +362,7 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
v->service_interval = _patches.servint_aircraft;
|
||||
|
||||
v->date_of_last_service = _date;
|
||||
v->build_year = u->build_year = _cur_year;
|
||||
v->build_year = u->build_year = _cur_year - BASE_YEAR;
|
||||
|
||||
v->cur_image = u->cur_image = 0xEA0;
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ void DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number)
|
|||
y += 10;
|
||||
|
||||
/* Design date - Life length */
|
||||
SetDParam(0, BASE_YEAR + ymd.year);
|
||||
SetDParam(0, ymd.year);
|
||||
SetDParam(1, e->lifelength);
|
||||
DrawString(x, y, STR_PURCHASE_INFO_DESIGNED_LIFE, 0);
|
||||
y += 10;
|
||||
|
|
2
bridge.h
2
bridge.h
|
@ -12,7 +12,7 @@ enum {
|
|||
/** Struct containing information about a single bridge type
|
||||
*/
|
||||
typedef struct Bridge {
|
||||
byte avail_year; ///< the year in which the bridge becomes available
|
||||
Year avail_year; ///< the year in which the bridge becomes available
|
||||
byte min_length; ///< the minimum length of the bridge (not counting start and end tile)
|
||||
byte max_length; ///< the maximum length of the bridge (not counting start and end tile)
|
||||
uint16 price; ///< the relative price of the bridge
|
||||
|
|
|
@ -81,8 +81,8 @@ uint GetMaskOfAllowedCurrencies(void)
|
|||
for (i = 0; i != lengthof(_currency_specs); i++) {
|
||||
uint16 to_euro = _currency_specs[i].to_euro;
|
||||
|
||||
if (to_euro != CF_NOEURO && to_euro != CF_ISEURO && BASE_YEAR + _cur_year >= to_euro) continue;
|
||||
if (to_euro == CF_ISEURO && BASE_YEAR + _cur_year < 2000) continue;
|
||||
if (to_euro != CF_NOEURO && to_euro != CF_ISEURO && _cur_year >= to_euro) continue;
|
||||
if (to_euro == CF_ISEURO && _cur_year < 2000) continue;
|
||||
mask |= (1 << i);
|
||||
}
|
||||
mask |= (1 << CUSTOM_CURRENCY_ID); // always allow custom currency
|
||||
|
@ -94,7 +94,7 @@ void CheckSwitchToEuro(void)
|
|||
{
|
||||
if (_currency_specs[_opt.currency].to_euro != CF_NOEURO &&
|
||||
_currency_specs[_opt.currency].to_euro != CF_ISEURO &&
|
||||
BASE_YEAR + _cur_year >= _currency_specs[_opt.currency].to_euro) {
|
||||
_cur_year >= _currency_specs[_opt.currency].to_euro) {
|
||||
_opt.currency = 2; // this is the index of euro above.
|
||||
AddNewsItem(STR_EURO_INTRODUCE, NEWS_FLAGS(NM_NORMAL, 0, NT_ECONOMY, 0), 0, 0);
|
||||
}
|
||||
|
|
17
date.c
17
date.c
|
@ -88,7 +88,7 @@ void ConvertDateToYMD(Date date, YearMonthDay *ymd)
|
|||
if (rem >= 31 + 28) rem++;
|
||||
}
|
||||
|
||||
ymd->year = yr;
|
||||
ymd->year = BASE_YEAR + yr;
|
||||
|
||||
x = _month_date_from_year_day[rem];
|
||||
ymd->month = x >> 5;
|
||||
|
@ -104,15 +104,16 @@ void ConvertDateToYMD(Date date, YearMonthDay *ymd)
|
|||
Date ConvertYMDToDate(Year year, Month month, Day day)
|
||||
{
|
||||
uint rem;
|
||||
uint yr = year - BASE_YEAR;
|
||||
|
||||
/* day in the year */
|
||||
rem = _accum_days_for_month[month] + day - 1;
|
||||
|
||||
/* remove feb 29 from year 1,2,3 */
|
||||
if (year & 3) rem += (year & 3) * 365 + (rem < 31 + 29);
|
||||
if (yr & 3) rem += (yr & 3) * 365 + (rem < 31 + 29);
|
||||
|
||||
/* base date. */
|
||||
return (year >> 2) * (365 + 365 + 365 + 366) + rem;
|
||||
return (yr >> 2) * (365 + 365 + 365 + 366) + rem;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,14 +131,14 @@ Date ConvertIntDate(uint date)
|
|||
Day day = 1;
|
||||
|
||||
if (IS_INT_INSIDE(date, 1920, MAX_YEAR + 1)) {
|
||||
year = date - 1920;
|
||||
year = date;
|
||||
} else if (IS_INT_INSIDE(date, 192001, 209012 + 1)) {
|
||||
month = date % 100 - 1;
|
||||
year = date / 100 - 1920;
|
||||
year = date / 100;
|
||||
} else if (IS_INT_INSIDE(date, 19200101, 20901231 + 1)) {
|
||||
day = date % 100; date /= 100;
|
||||
month = date % 100 - 1;
|
||||
year = date / 100 - 1920;
|
||||
year = date / 100;
|
||||
} else if (IS_INT_INSIDE(date, 2091, 65536)) {
|
||||
return date;
|
||||
} else {
|
||||
|
@ -282,10 +283,10 @@ void IncreaseDate(void)
|
|||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
/* check if we reached end of the game */
|
||||
if (_cur_year == _patches.ending_year - MAX_YEAR) {
|
||||
if (_cur_year == _patches.ending_year) {
|
||||
ShowEndGameChart();
|
||||
/* check if we reached the maximum year, decrement dates by a year */
|
||||
} else if (BASE_YEAR + _cur_year == MAX_YEAR + 1) {
|
||||
} else if (_cur_year == MAX_YEAR + 1) {
|
||||
Vehicle *v;
|
||||
|
||||
_cur_year--;
|
||||
|
|
|
@ -951,33 +951,30 @@ static DisasterInitProc * const _disaster_initprocs[] = {
|
|||
Disaster7_Init,
|
||||
};
|
||||
|
||||
#define MK(a, b) { (a) - BASE_YEAR, (b) - BASE_YEAR }
|
||||
static const struct {
|
||||
byte min;
|
||||
byte max;
|
||||
Year min;
|
||||
Year max;
|
||||
} _dis_years[] = {
|
||||
MK(1930, 1955),
|
||||
MK(1940, 1970),
|
||||
MK(1960, 1990),
|
||||
MK(1970, 2000),
|
||||
MK(2000, 2100),
|
||||
MK(1940, 1965),
|
||||
MK(1975, 2010),
|
||||
MK(1950, 1985)
|
||||
{ 1930, 1955 },
|
||||
{ 1940, 1970 },
|
||||
{ 1960, 1990 },
|
||||
{ 1970, 2000 },
|
||||
{ 2000, 2100 },
|
||||
{ 1940, 1965 },
|
||||
{ 1975, 2010 },
|
||||
{ 1950, 1985 }
|
||||
};
|
||||
#undef MK
|
||||
|
||||
|
||||
static void DoDisaster(void)
|
||||
{
|
||||
byte buf[lengthof(_dis_years)];
|
||||
byte year = _cur_year;
|
||||
uint i;
|
||||
uint j;
|
||||
|
||||
j = 0;
|
||||
for (i = 0; i != lengthof(_dis_years); i++) {
|
||||
if (year >= _dis_years[i].min && year < _dis_years[i].max) buf[j++] = i;
|
||||
if (_cur_year >= _dis_years[i].min && _cur_year < _dis_years[i].max) buf[j++] = i;
|
||||
}
|
||||
|
||||
if (j == 0) return;
|
||||
|
|
|
@ -1394,7 +1394,7 @@ int LoadUnloadVehicle(Vehicle *v)
|
|||
|
||||
// if last speed is 0, we treat that as if no vehicle has ever visited the station.
|
||||
ge->last_speed = min(t, 255);
|
||||
ge->last_age = _cur_year - v->build_year;
|
||||
ge->last_age = (_cur_year - BASE_YEAR) - v->build_year;
|
||||
|
||||
// If there's goods waiting at the station, and the vehicle
|
||||
// has capacity for it, load it on the vehicle.
|
||||
|
@ -1482,7 +1482,7 @@ int LoadUnloadVehicle(Vehicle *v)
|
|||
void PlayersMonthlyLoop(void)
|
||||
{
|
||||
PlayersGenStatistics();
|
||||
if (_patches.inflation && BASE_YEAR + _cur_year < MAX_YEAR)
|
||||
if (_patches.inflation && _cur_year < MAX_YEAR)
|
||||
AddInflation();
|
||||
PlayersPayInterest();
|
||||
// Reset the _current_player flag
|
||||
|
@ -1546,7 +1546,7 @@ int32 CmdBuyShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
p = GetPlayer(p1);
|
||||
|
||||
/* Protect new companies from hostile takeovers */
|
||||
if (_cur_year - p->inaugurated_year < 6) return_cmd_error(STR_7080_PROTECTED);
|
||||
if ((_cur_year - BASE_YEAR) - p->inaugurated_year < 6) return_cmd_error(STR_7080_PROTECTED);
|
||||
|
||||
/* Those lines are here for network-protection (clients can be slow) */
|
||||
if (GetAmountOwnedBy(p, OWNER_SPECTATOR) == 0) return 0;
|
||||
|
|
4
engine.c
4
engine.c
|
@ -238,7 +238,7 @@ void EnginesDailyLoop(void)
|
|||
{
|
||||
EngineID i;
|
||||
|
||||
if (_cur_year >= 130) return;
|
||||
if (_cur_year >= 2050) return;
|
||||
|
||||
for (i = 0; i != lengthof(_engines); i++) {
|
||||
Engine *e = &_engines[i];
|
||||
|
@ -359,7 +359,7 @@ void EnginesMonthlyLoop(void)
|
|||
{
|
||||
Engine *e;
|
||||
|
||||
if (_cur_year < 130) {
|
||||
if (_cur_year < 2050) {
|
||||
for (e = _engines; e != endof(_engines); e++) {
|
||||
// Age the vehicle
|
||||
if (e->flags & ENGINE_AVAILABLE && e->age != 0xFFFF) {
|
||||
|
|
|
@ -30,7 +30,7 @@ typedef struct GraphDrawer {
|
|||
byte num_dataset;
|
||||
byte num_on_x_axis;
|
||||
byte month;
|
||||
byte year;
|
||||
Year year;
|
||||
bool include_neg;
|
||||
byte num_vert_lines;
|
||||
uint16 unk61A;
|
||||
|
@ -151,7 +151,7 @@ static void DrawGraph(const GraphDrawer *gw)
|
|||
x = gw->left + 44;
|
||||
y = gw->top + gw->height + 1;
|
||||
j = gw->month;
|
||||
k = BASE_YEAR + gw->year;
|
||||
k = gw->year;
|
||||
i = gw->num_on_x_axis;assert(i>0);
|
||||
do {
|
||||
SetDParam(2, k);
|
||||
|
|
|
@ -1330,7 +1330,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
|
|||
i->total_transported[0] = 0;
|
||||
i->total_transported[1] = 0;
|
||||
i->was_cargo_delivered = false;
|
||||
i->last_prod_year = _cur_year;
|
||||
i->last_prod_year = _cur_year - BASE_YEAR;
|
||||
i->total_production[0] = i->production_rate[0] * 8;
|
||||
i->total_production[1] = i->production_rate[1] * 8;
|
||||
|
||||
|
@ -1531,7 +1531,7 @@ static void ExtChangeIndustryProduction(Industry *i)
|
|||
return;
|
||||
|
||||
case INDUSTRYLIFE_CLOSABLE:
|
||||
if ((byte)(_cur_year - i->last_prod_year) < 5 || !CHANCE16(1, 180))
|
||||
if ((byte)((_cur_year - BASE_YEAR) - i->last_prod_year) < 5 || !CHANCE16(1, 180))
|
||||
closeit = false;
|
||||
break;
|
||||
|
||||
|
@ -1594,7 +1594,7 @@ static void UpdateIndustryStatistics(Industry *i)
|
|||
if (i->produced_cargo[0] != CT_INVALID) {
|
||||
pct = 0;
|
||||
if (i->last_mo_production[0] != 0) {
|
||||
i->last_prod_year = _cur_year;
|
||||
i->last_prod_year = _cur_year - BASE_YEAR;
|
||||
pct = min(i->last_mo_transported[0] * 256 / i->last_mo_production[0],255);
|
||||
}
|
||||
i->pct_transported[0] = pct;
|
||||
|
@ -1609,7 +1609,7 @@ static void UpdateIndustryStatistics(Industry *i)
|
|||
if (i->produced_cargo[1] != CT_INVALID) {
|
||||
pct = 0;
|
||||
if (i->last_mo_production[1] != 0) {
|
||||
i->last_prod_year = _cur_year;
|
||||
i->last_prod_year = _cur_year - BASE_YEAR;
|
||||
pct = min(i->last_mo_transported[1] * 256 / i->last_mo_production[1],255);
|
||||
}
|
||||
i->pct_transported[1] = pct;
|
||||
|
@ -1721,7 +1721,7 @@ static void ChangeIndustryProduction(Industry *i)
|
|||
|
||||
case INDUSTRYLIFE_CLOSABLE:
|
||||
/* maybe close */
|
||||
if ( (byte)(_cur_year - i->last_prod_year) >= 5 && CHANCE16(1,2)) {
|
||||
if ( (byte)((_cur_year - BASE_YEAR) - i->last_prod_year) >= 5 && CHANCE16(1,2)) {
|
||||
i->prod_level = 0;
|
||||
str = indspec->closure_text;
|
||||
}
|
||||
|
|
|
@ -1677,7 +1677,7 @@ static int32 ClickChangeDateCheat(int32 p1, int32 p2)
|
|||
YearMonthDay ymd;
|
||||
ConvertDateToYMD(_date, &ymd);
|
||||
|
||||
if ((BASE_YEAR + ymd.year == MIN_YEAR && p2 == -1) || (BASE_YEAR + ymd.year == MAX_YEAR && p2 == 1)) return _cur_year;
|
||||
if ((ymd.year == MIN_YEAR && p2 == -1) || (ymd.year == MAX_YEAR && p2 == 1)) return _cur_year;
|
||||
|
||||
SetDate(ConvertYMDToDate(_cur_year + p2, ymd.month, ymd.day));
|
||||
EnginesMonthlyLoop();
|
||||
|
|
|
@ -206,7 +206,7 @@ VARDEF bool _network_autoclean_companies;
|
|||
VARDEF uint8 _network_autoclean_unprotected; // Remove a company after X months
|
||||
VARDEF uint8 _network_autoclean_protected; // Unprotect a company after X months
|
||||
|
||||
VARDEF uint16 _network_restart_game_year; // If this year is reached, the server automaticly restarts
|
||||
VARDEF Year _network_restart_game_year; // If this year is reached, the server automaticly restarts
|
||||
|
||||
NetworkGameList *NetworkQueryServer(const char* host, unsigned short port, bool game_info);
|
||||
|
||||
|
|
|
@ -1208,7 +1208,7 @@ void NetworkPopulateCompanyInfo(void)
|
|||
GetString(_network_player_info[p->index].company_name, STR_JUST_STRING);
|
||||
|
||||
// Check the income
|
||||
if (_cur_year - 1 == p->inaugurated_year) {
|
||||
if (_cur_year - 1 == BASE_YEAR + p->inaugurated_year) {
|
||||
// The player is here just 1 year, so display [2], else display[1]
|
||||
for (i = 0; i < 13; i++) {
|
||||
_network_player_info[p->index].income -= p->yearly_expenses[2][i];
|
||||
|
@ -1313,8 +1313,8 @@ extern void SwitchMode(int new_mode);
|
|||
/* Check if we want to restart the map */
|
||||
static void NetworkCheckRestartMap(void)
|
||||
{
|
||||
if (_network_restart_game_year != 0 && BASE_YEAR + _cur_year >= _network_restart_game_year) {
|
||||
DEBUG(net, 0)("Auto-restarting map. Year %d reached.", BASE_YEAR + _cur_year);
|
||||
if (_network_restart_game_year != 0 && _cur_year >= _network_restart_game_year) {
|
||||
DEBUG(net, 0)("Auto-restarting map. Year %d reached.", _cur_year);
|
||||
|
||||
_random_seeds[0][0] = Random();
|
||||
_random_seeds[0][1] = InteractiveRandom();
|
||||
|
|
7
newgrf.c
7
newgrf.c
|
@ -23,6 +23,7 @@
|
|||
#include "vehicle.h"
|
||||
#include "newgrf_text.h"
|
||||
#include "table/sprites.h"
|
||||
#include "date.h"
|
||||
|
||||
#include "newgrf_spritegroup.h"
|
||||
|
||||
|
@ -1006,7 +1007,7 @@ static bool BridgeChangeInfo(uint brid, int numinfo, int prop, byte **bufp, int
|
|||
|
||||
switch (prop) {
|
||||
case 0x08: /* Year of availability */
|
||||
FOR_EACH_OBJECT _bridge[brid + i].avail_year = grf_load_byte(&buf);
|
||||
FOR_EACH_OBJECT _bridge[brid + i].avail_year = BASE_YEAR + grf_load_byte(&buf);
|
||||
break;
|
||||
|
||||
case 0x09: /* Minimum length */
|
||||
|
@ -1059,6 +1060,10 @@ static bool BridgeChangeInfo(uint brid, int numinfo, int prop, byte **bufp, int
|
|||
FOR_EACH_OBJECT _bridge[brid + i].flags = grf_load_byte(&buf);
|
||||
break;
|
||||
|
||||
case 0x0F: /* Long year -- must be set after property 8 */
|
||||
FOR_EACH_OBJECT _bridge[brid + i].avail_year = grf_load_word(&buf);
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = true;
|
||||
}
|
||||
|
|
|
@ -553,7 +553,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
|
|||
case 0x43: return _current_player; /* Owner information */
|
||||
case 0x46: return 0; /* Motion counter */
|
||||
case 0x48: return GetVehicleTypeInfo(object->u.vehicle.self_type); /* Vehicle Type Info */
|
||||
case 0xC4: return _cur_year; /* Build year */
|
||||
case 0xC4: return clamp(_cur_year, BASE_YEAR, MAX_YEAR) - BASE_YEAR; /* Build year */
|
||||
case 0xDA: return INVALID_VEHICLE; /* Next vehicle */
|
||||
case 0x7F: return GetGRFParameter(object->u.vehicle.self_type, parameter); /* Read GRF parameter */
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ static inline uint32 GetVariable(const ResolverObject *object, byte variable, by
|
|||
/* Return common variables */
|
||||
switch (variable) {
|
||||
case 0x00: return _date;
|
||||
case 0x01: return _cur_year;
|
||||
case 0x01: return clamp(_cur_year, BASE_YEAR, MAX_YEAR) - BASE_YEAR;
|
||||
case 0x02: return _cur_month;
|
||||
case 0x03: return _opt.landscape;
|
||||
case 0x09: return _date_fract;
|
||||
|
|
|
@ -258,7 +258,7 @@ void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b)
|
|||
ni->flags = (byte)(flags >> 8) | NF_NOEXPIRE;
|
||||
|
||||
// show this news message in color?
|
||||
if (_date >= ConvertIntDate(_patches.colored_news_year))
|
||||
if (_cur_year >= _patches.colored_news_year)
|
||||
ni->flags |= NF_INCOLOR;
|
||||
|
||||
ni->type = (byte)(flags >> 16);
|
||||
|
|
|
@ -316,7 +316,7 @@ int ttd_main(int argc, char *argv[])
|
|||
const char *optformat;
|
||||
char musicdriver[16], sounddriver[16], videodriver[16];
|
||||
int resolution[2] = {0,0};
|
||||
uint startyear = -1;
|
||||
Year startyear = INVALID_YEAR;
|
||||
|
||||
bool dedicated = false;
|
||||
bool network = false;
|
||||
|
@ -408,7 +408,7 @@ int ttd_main(int argc, char *argv[])
|
|||
if (sounddriver[0]) ttd_strlcpy(_ini_sounddriver, sounddriver, sizeof(_ini_sounddriver));
|
||||
if (videodriver[0]) ttd_strlcpy(_ini_videodriver, videodriver, sizeof(_ini_videodriver));
|
||||
if (resolution[0]) { _cur_resolution[0] = resolution[0]; _cur_resolution[1] = resolution[1]; }
|
||||
if (startyear != (uint)-1) _patches_newgame.starting_year = startyear;
|
||||
if (startyear != INVALID_YEAR) _patches_newgame.starting_year = startyear;
|
||||
|
||||
if (_dedicated_forks && !dedicated) _dedicated_forks = false;
|
||||
|
||||
|
|
|
@ -52,7 +52,12 @@ typedef uint16 UnitID; ///< All unitnumber stuff is of this type (or anyway, s
|
|||
typedef uint32 WindowNumber;
|
||||
typedef byte WindowClass;
|
||||
|
||||
typedef uint8 Year;
|
||||
enum {
|
||||
INVALID_YEAR = -1,
|
||||
INVALID_DATE = (uint16)-1,
|
||||
};
|
||||
|
||||
typedef int16 Year;
|
||||
typedef uint16 Date;
|
||||
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ static void DrawPlayerEconomyStats(const Player *p, byte mode)
|
|||
x = 215;
|
||||
tbl = p->yearly_expenses + 2;
|
||||
do {
|
||||
if (year >= p->inaugurated_year) {
|
||||
SetDParam(0, BASE_YEAR + year);
|
||||
if (year >= BASE_YEAR + p->inaugurated_year) {
|
||||
SetDParam(0, year);
|
||||
DrawStringCenterUnderline(x-17, 15, STR_7010, 0);
|
||||
sum = 0;
|
||||
for (i = 0; i != 13; i++) {
|
||||
|
|
|
@ -490,7 +490,7 @@ Player *DoStartupNewPlayer(bool is_ai)
|
|||
p->share_owners[0] = p->share_owners[1] = p->share_owners[2] = p->share_owners[3] = OWNER_SPECTATOR;
|
||||
|
||||
p->avail_railtypes = GetPlayerRailtypes(p->index);
|
||||
p->inaugurated_year = _cur_year;
|
||||
p->inaugurated_year = _cur_year - BASE_YEAR;
|
||||
p->face = Random();
|
||||
|
||||
/* Engine renewal settings */
|
||||
|
|
|
@ -184,7 +184,7 @@ int32 CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
v->service_interval = _patches.servint_roadveh;
|
||||
|
||||
v->date_of_last_service = _date;
|
||||
v->build_year = _cur_year;
|
||||
v->build_year = _cur_year - BASE_YEAR;
|
||||
|
||||
v->type = VEH_Road;
|
||||
v->cur_image = 0xC15;
|
||||
|
|
|
@ -54,7 +54,7 @@ void DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number)
|
|||
y += 10;
|
||||
|
||||
/* Design date - Life length */
|
||||
SetDParam(0, BASE_YEAR + ymd.year);
|
||||
SetDParam(0, ymd.year);
|
||||
SetDParam(1, e->lifelength);
|
||||
DrawString(x, y, STR_PURCHASE_INFO_DESIGNED_LIFE, 0);
|
||||
y += 10;
|
||||
|
|
|
@ -1206,7 +1206,7 @@ static const SettingDescGlobVarList _network_settings[] = {
|
|||
SDTG_BOOL("autoclean_companies", S, 0, _network_autoclean_companies, false, STR_NULL, NULL),
|
||||
SDTG_VAR("autoclean_unprotected",SLE_UINT8, S, 0, _network_autoclean_unprotected,12, 0, 60, STR_NULL, NULL),
|
||||
SDTG_VAR("autoclean_protected", SLE_UINT8, S, 0, _network_autoclean_protected, 36, 0, 180, STR_NULL, NULL),
|
||||
SDTG_VAR("restart_game_year", SLE_UINT16, S,D0, _network_restart_game_year, 0, MIN_YEAR, MAX_YEAR, STR_NULL, NULL),
|
||||
SDTG_VAR("restart_game_year", SLE_INT16, S,D0, _network_restart_game_year, 0, MIN_YEAR, MAX_YEAR, STR_NULL, NULL),
|
||||
SDTG_END()
|
||||
};
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
@ -1320,9 +1320,9 @@ const SettingDesc _patch_settings[] = {
|
|||
SDT_BOOL(Patches, same_industry_close, 0, 0, false, STR_CONFIG_PATCHES_SAMEINDCLOSE, NULL),
|
||||
SDT_BOOL(Patches, bribe, 0, 0, true, STR_CONFIG_PATCHES_BRIBE, NULL),
|
||||
SDT_VAR(Patches, snow_line_height,SLE_UINT8, 0, 0, 7, 2, 13, STR_CONFIG_PATCHES_SNOWLINE_HEIGHT, NULL),
|
||||
SDT_VAR(Patches, colored_news_year,SLE_UINT, 0,NC, 2000, MIN_YEAR, MAX_YEAR, STR_CONFIG_PATCHES_COLORED_NEWS_YEAR,NULL),
|
||||
SDT_VAR(Patches, starting_year, SLE_UINT, 0,NC, 1950, MIN_YEAR, MAX_YEAR, STR_CONFIG_PATCHES_STARTING_YEAR,NULL),
|
||||
SDT_VAR(Patches, ending_year, SLE_UINT,0,NC|NO,2051, MIN_YEAR, MAX_YEAR, STR_CONFIG_PATCHES_ENDING_YEAR, NULL),
|
||||
SDT_VAR(Patches, colored_news_year,SLE_FILE_U32 | SLE_VAR_I16, 0,NC, 2000, MIN_YEAR, MAX_YEAR, STR_CONFIG_PATCHES_COLORED_NEWS_YEAR,NULL),
|
||||
SDT_VAR(Patches, starting_year, SLE_FILE_U32 | SLE_VAR_I16, 0,NC, 1950, MIN_YEAR, MAX_YEAR, STR_CONFIG_PATCHES_STARTING_YEAR,NULL),
|
||||
SDT_VAR(Patches, ending_year, SLE_FILE_U32 | SLE_VAR_I16,0,NC|NO,2051, MIN_YEAR, MAX_YEAR, STR_CONFIG_PATCHES_ENDING_YEAR, NULL),
|
||||
SDT_BOOL(Patches, smooth_economy, 0, 0, true, STR_CONFIG_PATCHES_SMOOTH_ECONOMY, NULL),
|
||||
SDT_BOOL(Patches, allow_shares, 0, 0, true, STR_CONFIG_PATCHES_ALLOW_SHARES, NULL),
|
||||
|
||||
|
|
|
@ -901,7 +901,7 @@ int32 CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
|
||||
v->service_interval = _patches.servint_ships;
|
||||
v->date_of_last_service = _date;
|
||||
v->build_year = _cur_year;
|
||||
v->build_year = _cur_year - BASE_YEAR;
|
||||
v->cur_image = 0x0E5E;
|
||||
v->type = VEH_Ship;
|
||||
v->random_bits = VehicleRandomBits();
|
||||
|
|
|
@ -54,7 +54,7 @@ void DrawShipPurchaseInfo(int x, int y, EngineID engine_number)
|
|||
/* Design date - Life length */
|
||||
e = GetEngine(engine_number);
|
||||
ConvertDateToYMD(e->intro_date, &ymd);
|
||||
SetDParam(0, BASE_YEAR + ymd.year);
|
||||
SetDParam(0, ymd.year);
|
||||
SetDParam(1, e->lifelength);
|
||||
DrawString(x,y, STR_PURCHASE_INFO_DESIGNED_LIFE, 0);
|
||||
y += 10;
|
||||
|
|
|
@ -339,7 +339,7 @@ static char *FormatYmdString(char *buff, Date date)
|
|||
for (src = GetStringPtr(STR_0162_JAN + ymd.month); (*buff++ = *src++) != '\0';) {}
|
||||
buff[-1] = ' ';
|
||||
|
||||
return FormatNoCommaNumber(buff, BASE_YEAR + ymd.year);
|
||||
return FormatNoCommaNumber(buff, ymd.year);
|
||||
}
|
||||
|
||||
static char *FormatMonthAndYear(char *buff, Date date)
|
||||
|
@ -352,7 +352,7 @@ static char *FormatMonthAndYear(char *buff, Date date)
|
|||
for (src = GetStringPtr(STR_MONTH_JAN + ymd.month); (*buff++ = *src++) != '\0';) {}
|
||||
buff[-1] = ' ';
|
||||
|
||||
return FormatNoCommaNumber(buff, BASE_YEAR + ymd.year);
|
||||
return FormatNoCommaNumber(buff, ymd.year);
|
||||
}
|
||||
|
||||
static char *FormatTinyDate(char *buff, Date date)
|
||||
|
@ -360,7 +360,7 @@ static char *FormatTinyDate(char *buff, Date date)
|
|||
YearMonthDay ymd;
|
||||
|
||||
ConvertDateToYMD(date, &ymd);
|
||||
buff += sprintf(buff, " %02i-%02i-%04i", ymd.day, ymd.month + 1, BASE_YEAR + ymd.year);
|
||||
buff += sprintf(buff, " %02i-%02i-%04i", ymd.day, ymd.month + 1, ymd.year);
|
||||
|
||||
return buff;
|
||||
}
|
||||
|
|
|
@ -2019,120 +2019,120 @@ assert_compile(lengthof(_housetype_remove_ratingmod) == HOUSE_MAX);
|
|||
|
||||
|
||||
typedef struct {
|
||||
byte min,max;
|
||||
Year min, max;
|
||||
} HousetypeYear;
|
||||
|
||||
static const HousetypeYear _housetype_years[] = {
|
||||
{43, 255},
|
||||
{37, 255},
|
||||
{48, 255},
|
||||
{0, 255},
|
||||
{55, 255},
|
||||
{55, 255},
|
||||
{0, 255},
|
||||
{39, 255},
|
||||
{39, 255},
|
||||
{25, 255},
|
||||
{25, 255},
|
||||
{0, 255},
|
||||
{15, 255},
|
||||
{31, 255},
|
||||
{10, 40},
|
||||
{10, 40},
|
||||
{10, 40},
|
||||
{57, 255},
|
||||
{63, 255},
|
||||
{65, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 31},
|
||||
{0, 32},
|
||||
{11, 255},
|
||||
{15, 255},
|
||||
{43, 255},
|
||||
{0, 35},
|
||||
{53, 255},
|
||||
{0, 255},
|
||||
{38, 255},
|
||||
{38, 255},
|
||||
{38, 255},
|
||||
{38, 255},
|
||||
{80, 255},
|
||||
{0, 40},
|
||||
{0, 40},
|
||||
{25, 255},
|
||||
{63, 255},
|
||||
{63, 255},
|
||||
{63, 255},
|
||||
{63, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 43},
|
||||
{0, 43},
|
||||
{46, 255},
|
||||
{46, 255},
|
||||
{50, 255},
|
||||
{50, 255},
|
||||
{54, 255},
|
||||
{54, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 40},
|
||||
{0, 40},
|
||||
{52, 255},
|
||||
{52, 255},
|
||||
{52, 255},
|
||||
{52, 255},
|
||||
{43, 255},
|
||||
{43, 255},
|
||||
{58, 255},
|
||||
{58, 255},
|
||||
{47, 255},
|
||||
{47, 255},
|
||||
{47, 255},
|
||||
{47, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{53, 255},
|
||||
{42, 255},
|
||||
{64, 255},
|
||||
{64, 255},
|
||||
{0, 255},
|
||||
{73, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{0, 255},
|
||||
{ 1963, MAX_YEAR },
|
||||
{ 1957, MAX_YEAR },
|
||||
{ 1968, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 1975, MAX_YEAR },
|
||||
{ 1975, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 1959, MAX_YEAR },
|
||||
{ 1959, MAX_YEAR },
|
||||
{ 1945, MAX_YEAR },
|
||||
{ 1945, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 1935, MAX_YEAR },
|
||||
{ 1951, MAX_YEAR },
|
||||
{ 1930, 1960 },
|
||||
{ 1930, 1960 },
|
||||
{ 1930, 1960 },
|
||||
{ 1977, MAX_YEAR },
|
||||
{ 1983, MAX_YEAR },
|
||||
{ 1985, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, 1951 },
|
||||
{ 0, 1952 },
|
||||
{ 1941, MAX_YEAR },
|
||||
{ 1945, MAX_YEAR },
|
||||
{ 1963, MAX_YEAR },
|
||||
{ 0, 1955 },
|
||||
{ 1973, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 1958, MAX_YEAR },
|
||||
{ 1958, MAX_YEAR },
|
||||
{ 1958, MAX_YEAR },
|
||||
{ 1958, MAX_YEAR },
|
||||
{ 1950, MAX_YEAR },
|
||||
{ 0, 1960 },
|
||||
{ 0, 1960 },
|
||||
{ 1945, MAX_YEAR },
|
||||
{ 1983, MAX_YEAR },
|
||||
{ 1983, MAX_YEAR },
|
||||
{ 1983, MAX_YEAR },
|
||||
{ 1983, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, 1963 },
|
||||
{ 0, 1963 },
|
||||
{ 1966, MAX_YEAR },
|
||||
{ 1966, MAX_YEAR },
|
||||
{ 1970, MAX_YEAR },
|
||||
{ 1970, MAX_YEAR },
|
||||
{ 1974, MAX_YEAR },
|
||||
{ 1974, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, 1960 },
|
||||
{ 0, 1960 },
|
||||
{ 1972, MAX_YEAR },
|
||||
{ 1972, MAX_YEAR },
|
||||
{ 1972, MAX_YEAR },
|
||||
{ 1972, MAX_YEAR },
|
||||
{ 1963, MAX_YEAR },
|
||||
{ 1963, MAX_YEAR },
|
||||
{ 1978, MAX_YEAR },
|
||||
{ 1978, MAX_YEAR },
|
||||
{ 1967, MAX_YEAR },
|
||||
{ 1967, MAX_YEAR },
|
||||
{ 1967, MAX_YEAR },
|
||||
{ 1967, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 1973, MAX_YEAR },
|
||||
{ 1962, MAX_YEAR },
|
||||
{ 1984, MAX_YEAR },
|
||||
{ 1984, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 1993, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
{ 0, MAX_YEAR },
|
||||
};
|
||||
assert_compile(lengthof(_housetype_years) == HOUSE_MAX);
|
||||
|
||||
|
|
|
@ -623,7 +623,7 @@ static int32 CmdBuildRailWagon(EngineID engine, TileIndex tile, uint32 flags)
|
|||
|
||||
v->u.rail.railtype = GetEngine(engine)->railtype;
|
||||
|
||||
v->build_year = _cur_year;
|
||||
v->build_year = _cur_year - BASE_YEAR;
|
||||
v->type = VEH_Train;
|
||||
v->cur_image = 0xAC2;
|
||||
v->random_bits = VehicleRandomBits();
|
||||
|
@ -783,7 +783,7 @@ int32 CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
|
||||
v->service_interval = _patches.servint_trains;
|
||||
v->date_of_last_service = _date;
|
||||
v->build_year = _cur_year;
|
||||
v->build_year = _cur_year - BASE_YEAR;
|
||||
v->type = VEH_Train;
|
||||
v->cur_image = 0xAC2;
|
||||
v->random_bits = VehicleRandomBits();
|
||||
|
|
|
@ -73,7 +73,7 @@ void DrawTrainEnginePurchaseInfo(int x, int y, EngineID engine_number)
|
|||
y += 10;
|
||||
|
||||
/* Design date - Life length */
|
||||
SetDParam(0, BASE_YEAR + ymd.year);
|
||||
SetDParam(0, ymd.year);
|
||||
SetDParam(1, e->lifelength);
|
||||
DrawString(x,y, STR_PURCHASE_INFO_DESIGNED_LIFE, 0);
|
||||
y += 10;
|
||||
|
|
|
@ -38,26 +38,26 @@ extern void DrawCanalWater(TileIndex tile);
|
|||
|
||||
const Bridge orig_bridge[] = {
|
||||
/*
|
||||
year of availablity
|
||||
| minimum length
|
||||
| | maximum length
|
||||
| | | price
|
||||
| | | | maximum speed
|
||||
| | | | | sprite to use in GUI string with description
|
||||
| | | | | | | */
|
||||
{ 0, 0, 16, 80, 32, 0xA24 , STR_5012_WOODEN , NULL, 0 },
|
||||
{ 0, 0, 2, 112, 48, 0xA26 | PALETTE_TO_STRUCT_RED , STR_5013_CONCRETE , NULL, 0 },
|
||||
{ 10, 0, 5, 144, 64, 0xA25 , STR_500F_GIRDER_STEEL , NULL, 0 },
|
||||
{ 0, 2, 10, 168, 80, 0xA22 | PALETTE_TO_STRUCT_CONCRETE, STR_5011_SUSPENSION_CONCRETE, NULL, 0 },
|
||||
{ 10, 3, 16, 185, 96, 0xA22 , STR_500E_SUSPENSION_STEEL , NULL, 0 },
|
||||
{ 10, 3, 16, 192, 112, 0xA22 | PALETTE_TO_STRUCT_YELLOW , STR_500E_SUSPENSION_STEEL , NULL, 0 },
|
||||
{ 10, 3, 7, 224, 160, 0xA23 , STR_5010_CANTILEVER_STEEL , NULL, 0 },
|
||||
{ 10, 3, 8, 232, 208, 0xA23 | PALETTE_TO_STRUCT_BROWN , STR_5010_CANTILEVER_STEEL , NULL, 0 },
|
||||
{ 10, 3, 9, 248, 240, 0xA23 | PALETTE_TO_STRUCT_RED , STR_5010_CANTILEVER_STEEL , NULL, 0 },
|
||||
{ 10, 0, 2, 240, 256, 0xA27 , STR_500F_GIRDER_STEEL , NULL, 0 },
|
||||
{ 75, 2, 16, 255, 320, 0xA28 , STR_5014_TUBULAR_STEEL , NULL, 0 },
|
||||
{ 85, 2, 32, 380, 512, 0xA28 | PALETTE_TO_STRUCT_YELLOW , STR_5014_TUBULAR_STEEL , NULL, 0 },
|
||||
{ 90, 2, 32, 510, 608, 0xA28 | PALETTE_TO_STRUCT_GREY , STR_BRIDGE_TUBULAR_SILICON , NULL, 0 }
|
||||
year of availablity
|
||||
| minimum length
|
||||
| | maximum length
|
||||
| | | price
|
||||
| | | | maximum speed
|
||||
| | | | | sprite to use in GUI string with description
|
||||
| | | | | | | */
|
||||
{ 0, 0, 16, 80, 32, 0xA24 , STR_5012_WOODEN , NULL, 0 },
|
||||
{ 0, 0, 2, 112, 48, 0xA26 | PALETTE_TO_STRUCT_RED , STR_5013_CONCRETE , NULL, 0 },
|
||||
{ 1930, 0, 5, 144, 64, 0xA25 , STR_500F_GIRDER_STEEL , NULL, 0 },
|
||||
{ 0, 2, 10, 168, 80, 0xA22 | PALETTE_TO_STRUCT_CONCRETE, STR_5011_SUSPENSION_CONCRETE, NULL, 0 },
|
||||
{ 1930, 3, 16, 185, 96, 0xA22 , STR_500E_SUSPENSION_STEEL , NULL, 0 },
|
||||
{ 1930, 3, 16, 192, 112, 0xA22 | PALETTE_TO_STRUCT_YELLOW , STR_500E_SUSPENSION_STEEL , NULL, 0 },
|
||||
{ 1930, 3, 7, 224, 160, 0xA23 , STR_5010_CANTILEVER_STEEL , NULL, 0 },
|
||||
{ 1930, 3, 8, 232, 208, 0xA23 | PALETTE_TO_STRUCT_BROWN , STR_5010_CANTILEVER_STEEL , NULL, 0 },
|
||||
{ 1930, 3, 9, 248, 240, 0xA23 | PALETTE_TO_STRUCT_RED , STR_5010_CANTILEVER_STEEL , NULL, 0 },
|
||||
{ 1930, 0, 2, 240, 256, 0xA27 , STR_500F_GIRDER_STEEL , NULL, 0 },
|
||||
{ 1995, 2, 16, 255, 320, 0xA28 , STR_5014_TUBULAR_STEEL , NULL, 0 },
|
||||
{ 2005, 2, 32, 380, 512, 0xA28 | PALETTE_TO_STRUCT_YELLOW , STR_5014_TUBULAR_STEEL , NULL, 0 },
|
||||
{ 2010, 2, 32, 510, 608, 0xA28 | PALETTE_TO_STRUCT_GREY , STR_BRIDGE_TUBULAR_SILICON , NULL, 0 }
|
||||
};
|
||||
|
||||
Bridge _bridge[MAX_BRIDGES];
|
||||
|
|
|
@ -147,9 +147,9 @@ typedef struct Patches {
|
|||
bool ai_disable_veh_roadveh; // disable types for AI
|
||||
bool ai_disable_veh_aircraft; // disable types for AI
|
||||
bool ai_disable_veh_ship; // disable types for AI
|
||||
uint32 starting_year; // starting date
|
||||
uint32 ending_year; // end of the game (just show highscore)
|
||||
uint32 colored_news_year; // when does newspaper become colored?
|
||||
Year starting_year; // starting date
|
||||
Year ending_year; // end of the game (just show highscore)
|
||||
Year colored_news_year; // when does newspaper become colored?
|
||||
|
||||
bool keep_all_autosave; // name the autosave in a different way.
|
||||
bool autosave_on_exit; // save an autosave when you quit the game, but do not ask "Do you really want to quit?"
|
||||
|
|
Loading…
Reference in New Issue