From 893d4ba9d4040b098bc6e0ac04068cda8ff608a2 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 20 Aug 2006 19:05:28 +0000 Subject: (svn r6002) -Cleanup: remove the now redundant BASE_YEAR constant. --- aircraft_cmd.c | 2 +- aircraft_gui.c | 2 +- console_cmds.c | 2 +- date.h | 3 --- economy.c | 4 ++-- industry_cmd.c | 10 +++++----- network_gui.c | 2 +- network_server.c | 2 +- player_gui.c | 4 ++-- roadveh_cmd.c | 2 +- roadveh_gui.c | 2 +- ship_cmd.c | 2 +- ship_gui.c | 2 +- train_cmd.c | 4 ++-- train_gui.c | 2 +- 15 files changed, 21 insertions(+), 24 deletions(-) diff --git a/aircraft_cmd.c b/aircraft_cmd.c index 2ff313731..0f2fc2f93 100644 --- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -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 - BASE_YEAR; + v->build_year = u->build_year = _cur_year; v->cur_image = u->cur_image = 0xEA0; diff --git a/aircraft_gui.c b/aircraft_gui.c index d18940cae..41710c10f 100644 --- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -402,7 +402,7 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e) do { if (v->subtype <= 2) { SetDParam(0, GetCustomEngineName(v->engine_type)); - SetDParam(1, BASE_YEAR + v->build_year); + SetDParam(1, v->build_year); SetDParam(2, v->value); DrawString(60, y, STR_A011_BUILT_VALUE, 0); y += 10; diff --git a/console_cmds.c b/console_cmds.c index ae716d79a..f1e0ca2c2 100644 --- a/console_cmds.c +++ b/console_cmds.c @@ -1202,7 +1202,7 @@ DEF_CONSOLE_CMD(ConPlayers) GetString(buffer, STR_00D1_DARK_BLUE + _player_colors[p->index]); IConsolePrintF(8, "#:%d(%s) Company Name: '%s' Year Founded: %d Money: %d Loan: %d Value: %" OTTD_PRINTF64 "d (T:%d, R:%d, P:%d, S:%d)", - p->index + 1, buffer, _network_player_info[p->index].company_name, BASE_YEAR + p->inaugurated_year, p->player_money, p->current_loan, CalculateCompanyValue(p), + p->index + 1, buffer, _network_player_info[p->index].company_name, p->inaugurated_year, p->player_money, p->current_loan, CalculateCompanyValue(p), /* trains */ _network_player_info[p->index].num_vehicle[0], /* lorry + bus */ _network_player_info[p->index].num_vehicle[1] + _network_player_info[p->index].num_vehicle[2], /* planes */ _network_player_info[p->index].num_vehicle[3], diff --git a/date.h b/date.h index 58f952a19..e32b4463b 100644 --- a/date.h +++ b/date.h @@ -26,9 +26,6 @@ */ #define DAYS_TILL_ORIGINAL_BASE_YEAR (365 * ORIGINAL_BASE_YEAR + ORIGINAL_BASE_YEAR / 4 - ORIGINAL_BASE_YEAR / 100 + ORIGINAL_BASE_YEAR / 400) -/* Temporary value to make transition to full past 2090 easier/more clear */ -#define BASE_YEAR 0 - /* The absolute minimum & maximum years in OTTD */ #define MIN_YEAR 0 /* MAX_YEAR, nicely rounded value of the number of years that can diff --git a/economy.c b/economy.c index 1987884c6..602417648 100644 --- a/economy.c +++ b/economy.c @@ -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 - BASE_YEAR) - v->build_year; + ge->last_age = _cur_year - v->build_year; // If there's goods waiting at the station, and the vehicle // has capacity for it, load it on the vehicle. @@ -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 - BASE_YEAR) - p->inaugurated_year < 6) return_cmd_error(STR_7080_PROTECTED); + if (_cur_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; diff --git a/industry_cmd.c b/industry_cmd.c index bb5c109e7..e614a6b52 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -1459,7 +1459,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 - BASE_YEAR; + i->last_prod_year = _cur_year; i->total_production[0] = i->production_rate[0] * 8; i->total_production[1] = i->production_rate[1] * 8; @@ -1661,7 +1661,7 @@ static void ExtChangeIndustryProduction(Industry *i) return; case INDUSTRYLIFE_CLOSABLE: - if ((byte)((_cur_year - BASE_YEAR) - i->last_prod_year) < 5 || !CHANCE16(1, 180)) + if ((byte)(_cur_year - i->last_prod_year) < 5 || !CHANCE16(1, 180)) closeit = false; break; @@ -1724,7 +1724,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 - BASE_YEAR; + i->last_prod_year = _cur_year; pct = min(i->last_mo_transported[0] * 256 / i->last_mo_production[0],255); } i->pct_transported[0] = pct; @@ -1739,7 +1739,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 - BASE_YEAR; + i->last_prod_year = _cur_year; pct = min(i->last_mo_transported[1] * 256 / i->last_mo_production[1],255); } i->pct_transported[1] = pct; @@ -1851,7 +1851,7 @@ static void ChangeIndustryProduction(Industry *i) case INDUSTRYLIFE_CLOSABLE: /* maybe close */ - if ( (byte)((_cur_year - BASE_YEAR) - i->last_prod_year) >= 5 && CHANCE16(1,2)) { + if ( (byte)(_cur_year - i->last_prod_year) >= 5 && CHANCE16(1,2)) { i->prod_level = 0; str = indspec->closure_text; } diff --git a/network_gui.c b/network_gui.c index 8a8b9d460..32624bd68 100644 --- a/network_gui.c +++ b/network_gui.c @@ -881,7 +881,7 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e) DrawStringTruncated(x, y, STR_NETWORK_COMPANY_NAME, 2, trunc_width); y += 10; - SetDParam(0, BASE_YEAR + _network_player_info[nd->company].inaugurated_year); + SetDParam(0, _network_player_info[nd->company].inaugurated_year); DrawString(x, y, STR_NETWORK_INAUGURATION_YEAR, 2); // inauguration year y += 10; diff --git a/network_server.c b/network_server.c index 3c18e75ff..96e644cd6 100644 --- a/network_server.c +++ b/network_server.c @@ -1209,7 +1209,7 @@ void NetworkPopulateCompanyInfo(void) GetString(_network_player_info[p->index].company_name, STR_JUST_STRING); // Check the income - if (_cur_year - 1 == BASE_YEAR + p->inaugurated_year) { + if (_cur_year - 1 == 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]; diff --git a/player_gui.c b/player_gui.c index 9f5aea362..e3fae50c9 100644 --- a/player_gui.c +++ b/player_gui.c @@ -46,7 +46,7 @@ static void DrawPlayerEconomyStats(const Player *p, byte mode) x = 215; tbl = p->yearly_expenses + 2; do { - if (year >= BASE_YEAR + p->inaugurated_year) { + if (year >= p->inaugurated_year) { SetDParam(0, year); DrawStringRightAlignedUnderline(x, 15, STR_7010, 0); sum = 0; @@ -537,7 +537,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e) w->disabled_state = dis; DrawWindowWidgets(w); - SetDParam(0, BASE_YEAR + p->inaugurated_year); + SetDParam(0, p->inaugurated_year); DrawString(110, 25, STR_7038_INAUGURATED, 0); DrawPlayerVehiclesAmount(w->window_number); diff --git a/roadveh_cmd.c b/roadveh_cmd.c index 8adc1a2f5..be1c091ac 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -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 - BASE_YEAR; + v->build_year = _cur_year; v->type = VEH_Road; v->cur_image = 0xC15; diff --git a/roadveh_gui.c b/roadveh_gui.c index e428014cf..dd9e52544 100644 --- a/roadveh_gui.c +++ b/roadveh_gui.c @@ -216,7 +216,7 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e) DrawRoadVehImage(v, 3, 57, INVALID_VEHICLE); SetDParam(0, GetCustomEngineName(v->engine_type)); - SetDParam(1, BASE_YEAR + v->build_year); + SetDParam(1, v->build_year); SetDParam(2, v->value); DrawString(34, 57, STR_9011_BUILT_VALUE, 0); diff --git a/ship_cmd.c b/ship_cmd.c index 5b74cd863..ac0492925 100644 --- a/ship_cmd.c +++ b/ship_cmd.c @@ -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 - BASE_YEAR; + v->build_year = _cur_year; v->cur_image = 0x0E5E; v->type = VEH_Ship; v->random_bits = VehicleRandomBits(); diff --git a/ship_gui.c b/ship_gui.c index 29d369a46..ff0c73d32 100644 --- a/ship_gui.c +++ b/ship_gui.c @@ -212,7 +212,7 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e) DrawShipImage(v, 3, 57, INVALID_VEHICLE); - SetDParam(1, BASE_YEAR + v->build_year); + SetDParam(1, v->build_year); SetDParam(0, GetCustomEngineName(v->engine_type)); SetDParam(2, v->value); DrawString(74, 57, STR_9816_BUILT_VALUE, 0); diff --git a/train_cmd.c b/train_cmd.c index 9b52ae75b..8d711befb 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -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 - BASE_YEAR; + v->build_year = _cur_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 - BASE_YEAR; + v->build_year = _cur_year; v->type = VEH_Train; v->cur_image = 0xAC2; v->random_bits = VehicleRandomBits(); diff --git a/train_gui.c b/train_gui.c index 3ffed34de..65424d228 100644 --- a/train_gui.c +++ b/train_gui.c @@ -1115,7 +1115,7 @@ static void TrainDetailsInfoTab(const Vehicle *v, int x, int y) if (!(rvi->flags & RVI_WAGON)) { SetDParam(0, GetCustomEngineName(v->engine_type)); - SetDParam(1, BASE_YEAR + v->build_year); + SetDParam(1, v->build_year); SetDParam(2, v->value); DrawString(x, y, STR_882C_BUILT_VALUE, 0x10); } else { -- cgit v1.2.3-70-g09d2