summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-06-13 15:23:20 +0000
committeryexo <yexo@openttd.org>2011-06-13 15:23:20 +0000
commit0dc20c7d5fdc97e7aa5527ce2573806232ee09c6 (patch)
tree0eb2e1387146b0660ebb57c93cce02af65fed8ca /bin
parentf851a515cc30b715caad56b34fe9db7be636e951 (diff)
downloadopenttd-0dc20c7d5fdc97e7aa5527ce2573806232ee09c6.tar.xz
(svn r22584) -Add: [NoAI] several functions to AICompany to find out performance information (Morloth)
Diffstat (limited to 'bin')
-rw-r--r--bin/ai/compat_0.7.nut5
-rw-r--r--bin/ai/compat_1.0.nut5
-rw-r--r--bin/ai/compat_1.1.nut5
-rw-r--r--bin/ai/regression/regression.nut95
-rw-r--r--bin/ai/regression/regression.txt243
5 files changed, 265 insertions, 88 deletions
diff --git a/bin/ai/compat_0.7.nut b/bin/ai/compat_0.7.nut
index 75669eaf6..d85a5fbe0 100644
--- a/bin/ai/compat_0.7.nut
+++ b/bin/ai/compat_0.7.nut
@@ -321,3 +321,8 @@ AIAbstractList <- AIList;
AIList.ChangeItem <- AIList.SetValue;
AIRail.ERR_NONUNIFORM_STATIONS_DISABLED <- 0xFFFF;
+
+AICompany.GetCompanyValue <- function(company)
+{
+ return AICompany.GetQuarterlyCompanyValue(company, AICompany.CURRENT_QUARTER);
+}
diff --git a/bin/ai/compat_1.0.nut b/bin/ai/compat_1.0.nut
index 92eca47d8..ea76952f4 100644
--- a/bin/ai/compat_1.0.nut
+++ b/bin/ai/compat_1.0.nut
@@ -72,3 +72,8 @@ AIAbstractList <- AIList;
AIList.ChangeItem <- AIList.SetValue;
AIRail.ERR_NONUNIFORM_STATIONS_DISABLED <- 0xFFFF;
+
+AICompany.GetCompanyValue <- function(company)
+{
+ return AICompany.GetQuarterlyCompanyValue(company, AICompany.CURRENT_QUARTER);
+}
diff --git a/bin/ai/compat_1.1.nut b/bin/ai/compat_1.1.nut
index 16440bf92..8328e4b9a 100644
--- a/bin/ai/compat_1.1.nut
+++ b/bin/ai/compat_1.1.nut
@@ -8,3 +8,8 @@
*/
AILog.Info("1.1 API compatability in effect.");
+
+AICompany.GetCompanyValue <- function(company)
+{
+ return AICompany.GetQuarterlyCompanyValue(company, AICompany.CURRENT_QUARTER);
+}
diff --git a/bin/ai/regression/regression.nut b/bin/ai/regression/regression.nut
index 5494c1b7a..05243346a 100644
--- a/bin/ai/regression/regression.nut
+++ b/bin/ai/regression/regression.nut
@@ -394,50 +394,57 @@ function Regression::Company()
}
}
- print(" GetName(): " + AICompany.GetName(AICompany.COMPANY_SELF));
- print(" GetPresidentName(): " + AICompany.GetPresidentName(AICompany.COMPANY_SELF));
- print(" SetPresidentName(): " + AICompany.SetPresidentName("Regression AI"));
- print(" GetPresidentName(): " + AICompany.GetPresidentName(AICompany.COMPANY_SELF));
- print(" GetCompanyValue(): " + AICompany.GetCompanyValue(AICompany.COMPANY_SELF));
- print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
- print(" GetName(): " + AICompany.GetName(240));
- print(" GetLoanAmount(): " + AICompany.GetLoanAmount());
- print(" GetMaxLoanAmount(): " + AICompany.GetMaxLoanAmount());
- print(" GetLoanInterval(): " + AICompany.GetLoanInterval());
- print(" SetLoanAmount(1): " + AICompany.SetLoanAmount(1));
- print(" SetLoanAmount(100): " + AICompany.SetLoanAmount(100));
- print(" SetLoanAmount(10000): " + AICompany.SetLoanAmount(10000));
- print(" GetLastErrorString(): " + AIError.GetLastErrorString());
- print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
- print(" GetLoanAmount(): " + AICompany.GetLoanAmount());
- print(" SetMinimumLoanAmount(31337): " + AICompany.SetMinimumLoanAmount(31337));
- print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
- print(" GetLoanAmount(): " + AICompany.GetLoanAmount());
- print(" SetLoanAmount(10000): " + AICompany.SetLoanAmount(AICompany.GetMaxLoanAmount()));
- print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
- print(" GetLoanAmount(): " + AICompany.GetLoanAmount());
- print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.COMPANY_SELF));
- print(" BuildCompanyHQ(): " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(127, 129)));
- print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.COMPANY_SELF));
- print(" BuildCompanyHQ(): " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(129, 129)));
- print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.COMPANY_SELF));
- print(" BuildCompanyHQ(): " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(129, 128)));
- print(" GetLastErrorString(): " + AIError.GetLastErrorString());
- print(" GetAutoRenewStatus(); " + AICompany.GetAutoRenewStatus(AICompany.COMPANY_SELF));
- print(" SetAutoRenewStatus(true); " + AICompany.SetAutoRenewStatus(true));
- print(" GetAutoRenewStatus(); " + AICompany.GetAutoRenewStatus(AICompany.COMPANY_SELF));
- print(" SetAutoRenewStatus(true); " + AICompany.SetAutoRenewStatus(true));
- print(" SetAutoRenewStatus(false); " + AICompany.SetAutoRenewStatus(false));
- print(" GetAutoRenewMonths(); " + AICompany.GetAutoRenewMonths(AICompany.COMPANY_SELF));
- print(" SetAutoRenewMonths(-12); " + AICompany.SetAutoRenewMonths(-12));
- print(" GetAutoRenewMonths(); " + AICompany.GetAutoRenewMonths(AICompany.COMPANY_SELF));
- print(" SetAutoRenewMonths(-12); " + AICompany.SetAutoRenewMonths(-12));
- print(" SetAutoRenewMonths(6); " + AICompany.SetAutoRenewMonths(6));
- print(" GetAutoRenewMoney(); " + AICompany.GetAutoRenewMoney(AICompany.COMPANY_SELF));
- print(" SetAutoRenewMoney(200000); " + AICompany.SetAutoRenewMoney(200000));
- print(" GetAutoRenewMoney(); " + AICompany.GetAutoRenewMoney(AICompany.COMPANY_SELF));
- print(" SetAutoRenewMoney(200000); " + AICompany.SetAutoRenewMoney(200000));
- print(" SetAutoRenewMoney(100000); " + AICompany.SetAutoRenewMoney(100000));
+ print(" GetName(): " + AICompany.GetName(AICompany.COMPANY_SELF));
+ print(" GetPresidentName(): " + AICompany.GetPresidentName(AICompany.COMPANY_SELF));
+ print(" SetPresidentName(): " + AICompany.SetPresidentName("Regression AI"));
+ print(" GetPresidentName(): " + AICompany.GetPresidentName(AICompany.COMPANY_SELF));
+ print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
+ print(" GetName(): " + AICompany.GetName(240));
+ print(" GetLoanAmount(): " + AICompany.GetLoanAmount());
+ print(" GetMaxLoanAmount(): " + AICompany.GetMaxLoanAmount());
+ print(" GetLoanInterval(): " + AICompany.GetLoanInterval());
+ print(" SetLoanAmount(1): " + AICompany.SetLoanAmount(1));
+ print(" SetLoanAmount(100): " + AICompany.SetLoanAmount(100));
+ print(" SetLoanAmount(10000): " + AICompany.SetLoanAmount(10000));
+ print(" GetLastErrorString(): " + AIError.GetLastErrorString());
+ print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
+ print(" GetLoanAmount(): " + AICompany.GetLoanAmount());
+ print(" SetMinimumLoanAmount(31337): " + AICompany.SetMinimumLoanAmount(31337));
+ print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
+ print(" GetLoanAmount(): " + AICompany.GetLoanAmount());
+ print(" SetLoanAmount(10000): " + AICompany.SetLoanAmount(AICompany.GetMaxLoanAmount()));
+ print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
+ print(" GetLoanAmount(): " + AICompany.GetLoanAmount());
+ print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.COMPANY_SELF));
+ print(" BuildCompanyHQ(): " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(127, 129)));
+ print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.COMPANY_SELF));
+ print(" BuildCompanyHQ(): " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(129, 129)));
+ print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.COMPANY_SELF));
+ print(" BuildCompanyHQ(): " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(129, 128)));
+ print(" GetLastErrorString(): " + AIError.GetLastErrorString());
+ print(" GetAutoRenewStatus(); " + AICompany.GetAutoRenewStatus(AICompany.COMPANY_SELF));
+ print(" SetAutoRenewStatus(true); " + AICompany.SetAutoRenewStatus(true));
+ print(" GetAutoRenewStatus(); " + AICompany.GetAutoRenewStatus(AICompany.COMPANY_SELF));
+ print(" SetAutoRenewStatus(true); " + AICompany.SetAutoRenewStatus(true));
+ print(" SetAutoRenewStatus(false); " + AICompany.SetAutoRenewStatus(false));
+ print(" GetAutoRenewMonths(); " + AICompany.GetAutoRenewMonths(AICompany.COMPANY_SELF));
+ print(" SetAutoRenewMonths(-12); " + AICompany.SetAutoRenewMonths(-12));
+ print(" GetAutoRenewMonths(); " + AICompany.GetAutoRenewMonths(AICompany.COMPANY_SELF));
+ print(" SetAutoRenewMonths(-12); " + AICompany.SetAutoRenewMonths(-12));
+ print(" SetAutoRenewMonths(6); " + AICompany.SetAutoRenewMonths(6));
+ print(" GetAutoRenewMoney(); " + AICompany.GetAutoRenewMoney(AICompany.COMPANY_SELF));
+ print(" SetAutoRenewMoney(200000); " + AICompany.SetAutoRenewMoney(200000));
+ print(" GetAutoRenewMoney(); " + AICompany.GetAutoRenewMoney(AICompany.COMPANY_SELF));
+ print(" SetAutoRenewMoney(200000); " + AICompany.SetAutoRenewMoney(200000));
+ print(" SetAutoRenewMoney(100000); " + AICompany.SetAutoRenewMoney(100000));
+ for (local i = -1; i <= AICompany.EARLIEST_QUARTER; i++) {
+ print(" Quarter: " + i);
+ print(" GetQuarterlyIncome(); " + AICompany.GetQuarterlyIncome(AICompany.COMPANY_SELF, i));
+ print(" GetQuarterlyExpenses(); " + AICompany.GetQuarterlyExpenses(AICompany.COMPANY_SELF, i));
+ print(" GetQuarterlyCargoDelivered(); " + AICompany.GetQuarterlyCargoDelivered(AICompany.COMPANY_SELF, i));
+ print(" GetQuarterlyPerformanceRating(); " + AICompany.GetQuarterlyPerformanceRating(AICompany.COMPANY_SELF, i));
+ print(" GetQuarterlyCompanyValue(); " + AICompany.GetQuarterlyCompanyValue(AICompany.COMPANY_SELF, i));
+ }
}
function Regression::Engine()
diff --git a/bin/ai/regression/regression.txt b/bin/ai/regression/regression.txt
index 709667216..81b2699bf 100644
--- a/bin/ai/regression/regression.txt
+++ b/bin/ai/regression/regression.txt
@@ -584,50 +584,205 @@ ERROR: IsEnd() is invalid as Begin() is never called
SetName(): true
SetName(): false
GetLastErrorString(): ERR_NAME_IS_NOT_UNIQUE
- GetName(): Regression
- GetPresidentName(): I. McAlpine
- SetPresidentName(): true
- GetPresidentName(): Regression AI
- GetCompanyValue(): 1
- GetBankBalance(): 100000
- GetName(): (null : 0x00000000)
- GetLoanAmount(): 100000
- GetMaxLoanAmount(): 500000
- GetLoanInterval(): 10000
- SetLoanAmount(1): false
- SetLoanAmount(100): false
- SetLoanAmount(10000): true
- GetLastErrorString(): ERR_NONE
- GetBankBalance(): 10000
- GetLoanAmount(): 10000
- SetMinimumLoanAmount(31337): true
- GetBankBalance(): 40000
- GetLoanAmount(): 40000
- SetLoanAmount(10000): true
- GetBankBalance(): 500000
- GetLoanAmount(): 500000
- GetCompanyHQ(): -1
- BuildCompanyHQ(): true
- GetCompanyHQ(): 33151
- BuildCompanyHQ(): true
- GetCompanyHQ(): 33153
- BuildCompanyHQ(): false
- GetLastErrorString(): ERR_AREA_NOT_CLEAR
- GetAutoRenewStatus(); false
- SetAutoRenewStatus(true); true
- GetAutoRenewStatus(); true
- SetAutoRenewStatus(true); true
- SetAutoRenewStatus(false); true
- GetAutoRenewMonths(); 6
- SetAutoRenewMonths(-12); true
- GetAutoRenewMonths(); -12
- SetAutoRenewMonths(-12); true
- SetAutoRenewMonths(6); true
- GetAutoRenewMoney(); 100000
- SetAutoRenewMoney(200000); true
- GetAutoRenewMoney(); 200000
- SetAutoRenewMoney(200000); true
- SetAutoRenewMoney(100000); true
+ GetName(): Regression
+ GetPresidentName(): I. McAlpine
+ SetPresidentName(): true
+ GetPresidentName(): Regression AI
+ GetBankBalance(): 100000
+ GetName(): (null : 0x00000000)
+ GetLoanAmount(): 100000
+ GetMaxLoanAmount(): 500000
+ GetLoanInterval(): 10000
+ SetLoanAmount(1): false
+ SetLoanAmount(100): false
+ SetLoanAmount(10000): true
+ GetLastErrorString(): ERR_NONE
+ GetBankBalance(): 10000
+ GetLoanAmount(): 10000
+ SetMinimumLoanAmount(31337): true
+ GetBankBalance(): 40000
+ GetLoanAmount(): 40000
+ SetLoanAmount(10000): true
+ GetBankBalance(): 500000
+ GetLoanAmount(): 500000
+ GetCompanyHQ(): -1
+ BuildCompanyHQ(): true
+ GetCompanyHQ(): 33151
+ BuildCompanyHQ(): true
+ GetCompanyHQ(): 33153
+ BuildCompanyHQ(): false
+ GetLastErrorString(): ERR_AREA_NOT_CLEAR
+ GetAutoRenewStatus(); false
+ SetAutoRenewStatus(true); true
+ GetAutoRenewStatus(); true
+ SetAutoRenewStatus(true); true
+ SetAutoRenewStatus(false); true
+ GetAutoRenewMonths(); 6
+ SetAutoRenewMonths(-12); true
+ GetAutoRenewMonths(); -12
+ SetAutoRenewMonths(-12); true
+ SetAutoRenewMonths(6); true
+ GetAutoRenewMoney(); 100000
+ SetAutoRenewMoney(200000); true
+ GetAutoRenewMoney(); 200000
+ SetAutoRenewMoney(200000); true
+ SetAutoRenewMoney(100000); true
+ Quarter: -1
+ GetQuarterlyIncome(); -1
+ GetQuarterlyExpenses(); -1
+ GetQuarterlyCargoDelivered(); -1
+ GetQuarterlyPerformanceRating(); -1
+ GetQuarterlyCompanyValue(); -1
+ Quarter: 0
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); -210
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); -1
+ GetQuarterlyCompanyValue(); 1
+ Quarter: 1
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 2
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 3
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 4
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 5
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 6
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 7
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 8
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 9
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 10
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 11
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 12
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 13
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 14
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 15
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 16
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 17
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 18
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 19
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 20
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 21
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 22
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 23
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
+ Quarter: 24
+ GetQuarterlyIncome(); 0
+ GetQuarterlyExpenses(); 0
+ GetQuarterlyCargoDelivered(); 0
+ GetQuarterlyPerformanceRating(); 0
+ GetQuarterlyCompanyValue(); 0
--AIAirport--
IsHangarTile(): false