(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:
rubidium
2006-08-16 11:39:55 +00:00
parent 50e96f8ff9
commit 3cab5f30c0
32 changed files with 211 additions and 203 deletions

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