summaryrefslogtreecommitdiff
path: root/industry_cmd.c
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2006-08-16 11:39:55 +0000
committerrubidium <rubidium@openttd.org>2006-08-16 11:39:55 +0000
commit3cab5f30c06035034bcf5b513c2eee57b8ec11e9 (patch)
tree90102c4cf1f03e52dfe00d3cd1315b6cd9e6b399 /industry_cmd.c
parent50e96f8ff92bad28741ca3d360a4e7366072748d (diff)
downloadopenttd-3cab5f30c06035034bcf5b513c2eee57b8ec11e9.tar.xz
(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
Diffstat (limited to 'industry_cmd.c')
-rw-r--r--industry_cmd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/industry_cmd.c b/industry_cmd.c
index b140be9c9..6fce8dc8f 100644
--- a/industry_cmd.c
+++ b/industry_cmd.c
@@ -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;
}