(svn r6002) -Cleanup: remove the now redundant BASE_YEAR constant.

This commit is contained in:
rubidium 2006-08-20 19:05:28 +00:00
parent 9e755051a1
commit 893d4ba9d4
15 changed files with 21 additions and 24 deletions

View File

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

View File

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

View File

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

3
date.h
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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