(svn r11307) [NoAI] -Fix: AIIndustry::GetProduction should give the production_rate, not the this_month_production noai
authortruelight
Sat, 20 Oct 2007 10:14:05 +0000
branchnoai
changeset 9717 2c27f9be3fb9
parent 9716 5d25a5271050
child 9718 f82a4facea8b
(svn r11307) [NoAI] -Fix: AIIndustry::GetProduction should give the production_rate, not the this_month_production
[NoAI] -Fix: regression test didn't test GetProduction and IsCargoAccepted
bin/ai/regression/regression.nut
bin/ai/regression/regression.txt
src/ai/api/ai_industry.cpp
--- a/bin/ai/regression/regression.nut	Fri Oct 19 15:46:37 2007 +0000
+++ b/bin/ai/regression/regression.nut	Sat Oct 20 10:14:05 2007 +0000
@@ -262,6 +262,8 @@
 		print("    IsValidIndustry(): " + industry.IsValidIndustry(i));
 		print("    GetName():         " + industry.GetName(i));
 		print("    GetLocation():     " + industry.GetLocation(i));
+		print("    GetProduction():   " + industry.GetProduction(i, 1));
+		print("    IsCargoAccepted(): " + industry.IsCargoAccepted(i, 1));
 	}
 	print("  Valid Industries:    " + j);
 	print("  GetIndustryCount():  " + industry.GetIndustryCount());
--- a/bin/ai/regression/regression.txt	Fri Oct 19 15:46:37 2007 +0000
+++ b/bin/ai/regression/regression.txt	Sat Oct 20 10:14:05 2007 +0000
@@ -3291,294 +3291,440 @@
     IsValidIndustry(): false
     GetName():         (null : 0x00000000)
     GetLocation():     -1
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 0
     IsValidIndustry(): true
     GetName():         Kennville Oil Refinery
     GetLocation():     19695
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 1
     IsValidIndustry(): true
     GetName():         Sadtown Forest
     GetLocation():     45122
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 2
     IsValidIndustry(): true
     GetName():         Fudinghattan Forest
     GetLocation():     41929
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 3
     IsValidIndustry(): true
     GetName():         Benville Forest
     GetLocation():     44640
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 4
     IsValidIndustry(): true
     GetName():         Netfingbridge Forest
     GetLocation():     8793
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 5
     IsValidIndustry(): true
     GetName():         Hutfingford Forest
     GetLocation():     55429
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 6
     IsValidIndustry(): true
     GetName():         Great Hinninghall Forest
     GetLocation():     6533
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 7
     IsValidIndustry(): true
     GetName():         Tondston Forest
     GetLocation():     27609
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 8
     IsValidIndustry(): true
     GetName():         Planfield Sawmill
     GetLocation():     17318
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 9
     IsValidIndustry(): true
     GetName():         Hutfingford Sawmill
     GetLocation():     60050
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 10
     IsValidIndustry(): true
     GetName():         Naborough Sawmill
     GetLocation():     54184
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 11
     IsValidIndustry(): true
     GetName():         Prundinghall Sawmill
     GetLocation():     48499
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 12
     IsValidIndustry(): true
     GetName():         Fraston Sawmill
     GetLocation():     51419
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 13
     IsValidIndustry(): true
     GetName():         Fort Frindston Sawmill
     GetLocation():     15950
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 14
     IsValidIndustry(): true
     GetName():         Grinnway Sawmill
     GetLocation():     20001
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 15
     IsValidIndustry(): true
     GetName():         Trenningville Coal Mine
     GetLocation():     51854
+    GetProduction():   18
+    IsCargoAccepted(): false
   Industry 16
     IsValidIndustry(): true
     GetName():         Kennville Coal Mine
     GetLocation():     11734
+    GetProduction():   14
+    IsCargoAccepted(): false
   Industry 17
     IsValidIndustry(): true
     GetName():         Great Hinninghall Coal Mine
     GetLocation():     13947
+    GetProduction():   20
+    IsCargoAccepted(): false
   Industry 18
     IsValidIndustry(): true
     GetName():         Little Fruford Coal Mine
     GetLocation():     23682
+    GetProduction():   17
+    IsCargoAccepted(): false
   Industry 19
     IsValidIndustry(): true
     GetName():         Hutfingford Coal Mine
     GetLocation():     57429
+    GetProduction():   14
+    IsCargoAccepted(): false
   Industry 20
     IsValidIndustry(): true
     GetName():         Mendingston Coal Mine
     GetLocation():     8562
+    GetProduction():   17
+    IsCargoAccepted(): false
   Industry 21
     IsValidIndustry(): true
     GetName():         Tondston Coal Mine
     GetLocation():     29147
+    GetProduction():   13
+    IsCargoAccepted(): false
   Industry 22
     IsValidIndustry(): true
     GetName():         Quartfingfield Coal Mine
     GetLocation():     27822
+    GetProduction():   19
+    IsCargoAccepted(): false
   Industry 23
     IsValidIndustry(): true
     GetName():         Muningville Coal Mine
     GetLocation():     43035
+    GetProduction():   12
+    IsCargoAccepted(): false
   Industry 24
     IsValidIndustry(): true
     GetName():         Grinnway Coal Mine
     GetLocation():     17943
+    GetProduction():   9
+    IsCargoAccepted(): false
   Industry 25
     IsValidIndustry(): true
     GetName():         Sadtown Power Station
     GetLocation():     48182
+    GetProduction():   -1
+    IsCargoAccepted(): true
   Industry 26
     IsValidIndustry(): true
     GetName():         Tunford Power Station
     GetLocation():     33934
+    GetProduction():   -1
+    IsCargoAccepted(): true
   Industry 27
     IsValidIndustry(): true
     GetName():         Quartfingfield Power Station
     GetLocation():     23714
+    GetProduction():   -1
+    IsCargoAccepted(): true
   Industry 28
     IsValidIndustry(): true
     GetName():         Kennville Power Station
     GetLocation():     20170
+    GetProduction():   -1
+    IsCargoAccepted(): true
   Industry 29
     IsValidIndustry(): true
     GetName():         Nuntfingburg Power Station
     GetLocation():     6685
+    GetProduction():   -1
+    IsCargoAccepted(): true
   Industry 30
     IsValidIndustry(): true
     GetName():         Bedburg Power Station
     GetLocation():     29022
+    GetProduction():   -1
+    IsCargoAccepted(): true
   Industry 31
     IsValidIndustry(): true
     GetName():         Benville Power Station
     GetLocation():     44160
+    GetProduction():   -1
+    IsCargoAccepted(): true
   Industry 32
     IsValidIndustry(): true
     GetName():         Fort Frindston Oil Wells
     GetLocation():     14701
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 33
     IsValidIndustry(): true
     GetName():         Nuntfingburg Oil Wells
     GetLocation():     5659
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 34
     IsValidIndustry(): true
     GetName():         Benville Oil Wells
     GetLocation():     36728
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 35
     IsValidIndustry(): true
     GetName():         Grinnway Oil Wells
     GetLocation():     14361
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 36
     IsValidIndustry(): true
     GetName():         Muningville Oil Wells
     GetLocation():     36908
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 37
     IsValidIndustry(): true
     GetName():         Tondston Oil Wells
     GetLocation():     34237
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 38
     IsValidIndustry(): true
     GetName():         Fort Frindston Iron Ore Mine
     GetLocation():     17742
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 39
     IsValidIndustry(): true
     GetName():         Tondston Iron Ore Mine
     GetLocation():     25545
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 40
     IsValidIndustry(): true
     GetName():         Fudinghattan Iron Ore Mine
     GetLocation():     47838
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 41
     IsValidIndustry(): true
     GetName():         Nuntfingburg Iron Ore Mine
     GetLocation():     8763
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 42
     IsValidIndustry(): true
     GetName():         Lardborough Iron Ore Mine
     GetLocation():     60866
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 43
     IsValidIndustry(): true
     GetName():         Tunford Iron Ore Mine
     GetLocation():     41155
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 44
     IsValidIndustry(): true
     GetName():         Chentfingbourne Iron Ore Mine
     GetLocation():     19529
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 45
     IsValidIndustry(): true
     GetName():         Naborough Farm
     GetLocation():     52931
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 46
     IsValidIndustry(): true
     GetName():         Lardborough Farm
     GetLocation():     59604
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 47
     IsValidIndustry(): true
     GetName():         Chentfingbourne Farm
     GetLocation():     24366
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 48
     IsValidIndustry(): true
     GetName():         Wrundtown Farm
     GetLocation():     36847
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 49
     IsValidIndustry(): true
     GetName():         Little Fruford Farm
     GetLocation():     28287
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 50
     IsValidIndustry(): true
     GetName():         Hutfingford Farm
     GetLocation():     57432
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 51
     IsValidIndustry(): true
     GetName():         Tondston Farm
     GetLocation():     23519
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 52
     IsValidIndustry(): true
     GetName():         Nuntfingburg Farm
     GetLocation():     10773
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 53
     IsValidIndustry(): true
     GetName():         Sadtown Farm
     GetLocation():     48206
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 54
     IsValidIndustry(): true
     GetName():         Quartfingfield Farm
     GetLocation():     24005
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 55
     IsValidIndustry(): true
     GetName():         Little Fruford Steel Mill
     GetLocation():     21107
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 56
     IsValidIndustry(): true
     GetName():         Quartfingfield Steel Mill
     GetLocation():     23727
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 57
     IsValidIndustry(): true
     GetName():         Bedburg Steel Mill
     GetLocation():     41813
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 58
     IsValidIndustry(): true
     GetName():         Franinghead Steel Mill
     GetLocation():     8852
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 59
     IsValidIndustry(): true
     GetName():         Lardborough Steel Mill
     GetLocation():     59867
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 60
     IsValidIndustry(): true
     GetName():         Sadtown Steel Mill
     GetLocation():     55360
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 61
     IsValidIndustry(): true
     GetName():         Fraston Steel Mill
     GetLocation():     52953
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 62
     IsValidIndustry(): true
     GetName():         Chentfingbourne Factory
     GetLocation():     24893
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 63
     IsValidIndustry(): true
     GetName():         Fort Frindston Factory
     GetLocation():     20819
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 64
     IsValidIndustry(): true
     GetName():         Fudinghattan Factory
     GetLocation():     46278
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 65
     IsValidIndustry(): true
     GetName():         Prundinghall Factory
     GetLocation():     53096
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 66
     IsValidIndustry(): true
     GetName():         Kennville Factory
     GetLocation():     14818
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 67
     IsValidIndustry(): true
     GetName():         Muningville Factory
     GetLocation():     34375
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 68
     IsValidIndustry(): true
     GetName():         Trenningville Factory
     GetLocation():     44181
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 69
     IsValidIndustry(): false
     GetName():         (null : 0x00000000)
     GetLocation():     -1
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 70
     IsValidIndustry(): false
     GetName():         (null : 0x00000000)
     GetLocation():     -1
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Industry 71
     IsValidIndustry(): false
     GetName():         (null : 0x00000000)
     GetLocation():     -1
+    GetProduction():   -1
+    IsCargoAccepted(): false
   Valid Industries:    69
   GetIndustryCount():  69
 
--- a/src/ai/api/ai_industry.cpp	Fri Oct 19 15:46:37 2007 +0000
+++ b/src/ai/api/ai_industry.cpp	Sat Oct 20 10:14:05 2007 +0000
@@ -44,8 +44,8 @@
 	const Industry *i = ::GetIndustry(industry_id);
 	const IndustrySpec *indsp = GetIndustrySpec(i->type);
 
-	if (indsp->produced_cargo[0] == cargo_id) return i->this_month_production[0];
-	if (indsp->produced_cargo[1] == cargo_id) return i->this_month_production[1];
+	if (indsp->produced_cargo[0] == cargo_id) return i->production_rate[0];
+	if (indsp->produced_cargo[1] == cargo_id) return i->production_rate[1];
 	return -1;
 }