1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-19 12:39:11 +00:00

(svn r15101) -Change [API CHANGE]: more consistant naming for consts:

INVALID_TOWN_RATING        -> TOWN_RATING_INVALID
   INVALID_TRANSPORT          -> TRANSPORT_INVALID
   INVALID_ORDER              -> ORDER_INVALID
   INVALID_GROUP              -> GROUP_INVALID
   GROUP_ALL/DEFAULT          -> ALL/DEFAULT_GROUP
   VEHICLE_RAIL/ROAD/..       -> VT_RAIL/ROAD/..
   MY_COMPANY                 -> COMPANY_SELF
   FIRST/LAST/INVALID_COMPANY -> COMPANY_FIRST/LAST/INVALID
This commit is contained in:
truebrain
2009-01-16 00:05:26 +00:00
parent 5119132dda
commit 94dd36d1ec
32 changed files with 206 additions and 195 deletions

View File

@@ -341,7 +341,7 @@ function Rail::_GetTunnelsBridges(last_node, cur_node, bridge_dir)
for (local i = 2; i < this._max_bridge_length; i++) {
local bridge_list = AIBridgeList_Length(i + 1);
local target = cur_node + i * (cur_node - last_node);
if (!bridge_list.IsEmpty() && AIBridge.BuildBridge(AIVehicle.VEHICLE_RAIL, bridge_list.Begin(), cur_node, target)) {
if (!bridge_list.IsEmpty() && AIBridge.BuildBridge(AIVehicle.VT_RAIL, bridge_list.Begin(), cur_node, target)) {
tiles.push([target, bridge_dir]);
}
}
@@ -353,7 +353,7 @@ function Rail::_GetTunnelsBridges(last_node, cur_node, bridge_dir)
local tunnel_length = AIMap.DistanceManhattan(cur_node, other_tunnel_end);
local prev_tile = cur_node + (cur_node - other_tunnel_end) / tunnel_length;
if (AITunnel.GetOtherTunnelEnd(other_tunnel_end) == cur_node && tunnel_length >= 2 &&
prev_tile == last_node && tunnel_length < _max_tunnel_length && AITunnel.BuildTunnel(AIVehicle.VEHICLE_RAIL, cur_node)) {
prev_tile == last_node && tunnel_length < _max_tunnel_length && AITunnel.BuildTunnel(AIVehicle.VT_RAIL, cur_node)) {
tiles.push([other_tunnel_end, bridge_dir]);
}
return tiles;

View File

@@ -300,7 +300,7 @@ function Road::_GetTunnelsBridges(last_node, cur_node, bridge_dir)
for (local i = 2; i < this._max_bridge_length; i++) {
local bridge_list = AIBridgeList_Length(i + 1);
local target = cur_node + i * (cur_node - last_node);
if (!bridge_list.IsEmpty() && AIBridge.BuildBridge(AIVehicle.VEHICLE_ROAD, bridge_list.Begin(), cur_node, target)) {
if (!bridge_list.IsEmpty() && AIBridge.BuildBridge(AIVehicle.VT_ROAD, bridge_list.Begin(), cur_node, target)) {
tiles.push([target, bridge_dir]);
}
}
@@ -312,7 +312,7 @@ function Road::_GetTunnelsBridges(last_node, cur_node, bridge_dir)
local tunnel_length = AIMap.DistanceManhattan(cur_node, other_tunnel_end);
local prev_tile = cur_node + (cur_node - other_tunnel_end) / tunnel_length;
if (AITunnel.GetOtherTunnelEnd(other_tunnel_end) == cur_node && tunnel_length >= 2 &&
prev_tile == last_node && tunnel_length < _max_tunnel_length && AITunnel.BuildTunnel(AIVehicle.VEHICLE_ROAD, cur_node)) {
prev_tile == last_node && tunnel_length < _max_tunnel_length && AITunnel.BuildTunnel(AIVehicle.VT_ROAD, cur_node)) {
tiles.push([other_tunnel_end, bridge_dir]);
}
return tiles;

View File

@@ -226,7 +226,7 @@ function Regression::Airport()
print(" GetAirportCoverageRadius(" + i + "): " + AIAirport.GetAirportCoverageRadius(i));
}
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
print(" BuildAirport(): " + AIAirport.BuildAirport(32116, 0, true));
print(" IsHangarTile(): " + AIAirport.IsHangarTile(32116));
print(" IsAirportTile(): " + AIAirport.IsAirportTile(32116));
@@ -235,12 +235,12 @@ function Regression::Airport()
print(" IsHangarTile(): " + AIAirport.IsHangarTile(32119));
print(" IsAirportTile(): " + AIAirport.IsAirportTile(32119));
print(" GetAirportType(): " + AIAirport.GetAirportType(32119));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
print(" RemoveAirport(): " + AIAirport.RemoveAirport(32118));
print(" IsHangarTile(): " + AIAirport.IsHangarTile(32119));
print(" IsAirportTile(): " + AIAirport.IsAirportTile(32119));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
print(" BuildAirport(): " + AIAirport.BuildAirport(32116, 0, true));
}
@@ -267,11 +267,11 @@ function Regression::Bridge()
print(" RemoveBridge(): " + AIBridge.RemoveBridge(33155));
print(" GetLastErrorString(): " + AIError.GetLastErrorString());
print(" GetOtherBridgeEnd(): " + AIBridge.GetOtherBridgeEnd(33160));
print(" BuildBridge(): " + AIBridge.BuildBridge(AIVehicle.VEHICLE_ROAD, 5, 33160, 33155));
print(" BuildBridge(): " + AIBridge.BuildBridge(AIVehicle.VT_ROAD, 5, 33160, 33155));
print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33160));
print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33155));
print(" GetOtherBridgeEnd(): " + AIBridge.GetOtherBridgeEnd(33160));
print(" BuildBridge(): " + AIBridge.BuildBridge(AIVehicle.VEHICLE_ROAD, 5, 33160, 33155));
print(" BuildBridge(): " + AIBridge.BuildBridge(AIVehicle.VT_ROAD, 5, 33160, 33155));
print(" GetLastErrorString(): " + AIError.GetLastErrorString());
print(" RemoveBridge(): " + AIBridge.RemoveBridge(33155));
print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33160));
@@ -401,12 +401,12 @@ function Regression::Company()
}
}
print(" GetName(): " + AICompany.GetName(AICompany.MY_COMPANY));
print(" GetPresidentName(): " + AICompany.GetPresidentName(AICompany.MY_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.MY_COMPANY));
print(" GetCompanyValue(): " + AICompany.GetCompanyValue(AICompany.MY_COMPANY));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
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());
@@ -415,34 +415,34 @@ function Regression::Company()
print(" SetLoanAmount(100): " + AICompany.SetLoanAmount(100));
print(" SetLoanAmount(10000): " + AICompany.SetLoanAmount(10000));
print(" GetLastErrorString(): " + AIError.GetLastErrorString());
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
print(" GetLoanAmount(): " + AICompany.GetLoanAmount());
print(" SetMinimumLoanAmount(31337): " + AICompany.SetMinimumLoanAmount(31337));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
print(" GetLoanAmount(): " + AICompany.GetLoanAmount());
print(" SetLoanAmount(10000): " + AICompany.SetLoanAmount(AICompany.GetMaxLoanAmount()));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
print(" GetLoanAmount(): " + AICompany.GetLoanAmount());
print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.MY_COMPANY));
print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.COMPANY_SELF));
print(" BuildCompanyHQ(): " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(127, 129)));
print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.MY_COMPANY));
print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.COMPANY_SELF));
print(" BuildCompanyHQ(): " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(129, 129)));
print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.MY_COMPANY));
print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.COMPANY_SELF));
print(" BuildCompanyHQ(): " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(129, 128)));
print(" GetLastErrorString(): " + AIError.GetLastErrorString());
print(" GetAutoRenewStatus(); " + AICompany.GetAutoRenewStatus(AICompany.MY_COMPANY));
print(" GetAutoRenewStatus(); " + AICompany.GetAutoRenewStatus(AICompany.COMPANY_SELF));
print(" SetAutoRenewStatus(true); " + AICompany.SetAutoRenewStatus(true));
print(" GetAutoRenewStatus(); " + AICompany.GetAutoRenewStatus(AICompany.MY_COMPANY));
print(" GetAutoRenewStatus(); " + AICompany.GetAutoRenewStatus(AICompany.COMPANY_SELF));
print(" SetAutoRenewStatus(true); " + AICompany.SetAutoRenewStatus(true));
print(" SetAutoRenewStatus(false); " + AICompany.SetAutoRenewStatus(false));
print(" GetAutoRenewMonths(); " + AICompany.GetAutoRenewMonths(AICompany.MY_COMPANY));
print(" GetAutoRenewMonths(); " + AICompany.GetAutoRenewMonths(AICompany.COMPANY_SELF));
print(" SetAutoRenewMonths(-12); " + AICompany.SetAutoRenewMonths(-12));
print(" GetAutoRenewMonths(); " + AICompany.GetAutoRenewMonths(AICompany.MY_COMPANY));
print(" GetAutoRenewMonths(); " + AICompany.GetAutoRenewMonths(AICompany.COMPANY_SELF));
print(" SetAutoRenewMonths(-12); " + AICompany.SetAutoRenewMonths(-12));
print(" SetAutoRenewMonths(6); " + AICompany.SetAutoRenewMonths(6));
print(" GetAutoRenewMoney(); " + AICompany.GetAutoRenewMoney(AICompany.MY_COMPANY));
print(" GetAutoRenewMoney(); " + AICompany.GetAutoRenewMoney(AICompany.COMPANY_SELF));
print(" SetAutoRenewMoney(200000); " + AICompany.SetAutoRenewMoney(200000));
print(" GetAutoRenewMoney(); " + AICompany.GetAutoRenewMoney(AICompany.MY_COMPANY));
print(" GetAutoRenewMoney(); " + AICompany.GetAutoRenewMoney(AICompany.COMPANY_SELF));
print(" SetAutoRenewMoney(200000); " + AICompany.SetAutoRenewMoney(200000));
print(" SetAutoRenewMoney(100000); " + AICompany.SetAutoRenewMoney(100000));
}
@@ -476,7 +476,7 @@ function Regression::Engine()
function Regression::EngineList()
{
local list = AIEngineList(AIVehicle.VEHICLE_ROAD);
local list = AIEngineList(AIVehicle.VT_ROAD);
print("");
print("--EngineList--");
@@ -533,19 +533,19 @@ function Regression::Group()
{
print ("");
print("--Group--");
print(" SetAutoReplace(): " + AIGroup.SetAutoReplace(AIGroup.ALL_GROUP, 116, 117));
print(" GetEngineReplacement(): " + AIGroup.GetEngineReplacement(AIGroup.ALL_GROUP, 116));
print(" GetNumEngines(): " + AIGroup.GetNumEngines(AIGroup.ALL_GROUP, 116));
print(" SetAutoReplace(): " + AIGroup.SetAutoReplace(AIGroup.GROUP_ALL, 116, 117));
print(" GetEngineReplacement(): " + AIGroup.GetEngineReplacement(AIGroup.GROUP_ALL, 116));
print(" GetNumEngines(): " + AIGroup.GetNumEngines(AIGroup.GROUP_ALL, 116));
print(" AIRoad.BuildRoadDepot(): " + AIRoad.BuildRoadDepot(10000, 10001));
local vehicle = AIVehicle.BuildVehicle(10000, 116);
print(" AIVehicle.BuildVehicle(): " + vehicle);
print(" GetNumEngines(): " + AIGroup.GetNumEngines(AIGroup.ALL_GROUP, 116));
local group = AIGroup.CreateGroup(AIVehicle.VEHICLE_ROAD);
print(" GetNumEngines(): " + AIGroup.GetNumEngines(AIGroup.GROUP_ALL, 116));
local group = AIGroup.CreateGroup(AIVehicle.VT_ROAD);
print(" CreateGroup(): " + group);
print(" MoveVehicle(): " + AIGroup.MoveVehicle(group, vehicle));
print(" GetNumEngines(): " + AIGroup.GetNumEngines(group, 116));
print(" GetNumEngines(): " + AIGroup.GetNumEngines(AIGroup.ALL_GROUP, 116));
print(" GetNumEngines(): " + AIGroup.GetNumEngines(AIGroup.DEFAULT_GROUP, 116));
print(" GetNumEngines(): " + AIGroup.GetNumEngines(AIGroup.GROUP_ALL, 116));
print(" GetNumEngines(): " + AIGroup.GetNumEngines(AIGroup.GROUP_DEFAULT, 116));
print(" GetName(): " + AIGroup.GetName(0));
print(" GetName(): " + AIGroup.GetName(1));
print(" AIVehicle.SellVehicle(): " + AIVehicle.SellVehicle(vehicle));
@@ -815,7 +815,7 @@ function Regression::Marine()
print(" IsLockTile(): " + AIMarine.IsLockTile(32116));
print(" IsCanalTile(): " + AIMarine.IsCanalTile(32116));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
print(" BuildWaterDepot(): " + AIMarine.BuildWaterDepot(28479, false));
print(" BuildDock(): " + AIMarine.BuildDock(29253, true));
print(" BuildBuoy(): " + AIMarine.BuildBuoy(28481));
@@ -828,7 +828,7 @@ function Regression::Marine()
print(" IsBuoyTile(): " + AIMarine.IsBuoyTile(28481));
print(" IsLockTile(): " + AIMarine.IsLockTile(28487));
print(" IsCanalTile(): " + AIMarine.IsCanalTile(32127));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
print(" RemoveWaterDepot(): " + AIMarine.RemoveWaterDepot(28479));
print(" RemoveDock(): " + AIMarine.RemoveDock(29253));
@@ -840,7 +840,7 @@ function Regression::Marine()
print(" IsBuoyTile(): " + AIMarine.IsBuoyTile(28481));
print(" IsLockTile(): " + AIMarine.IsLockTile(28487));
print(" IsCanalTile(): " + AIMarine.IsCanalTile(32127));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.MY_COMPANY));
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
print(" BuildWaterDepot(): " + AIMarine.BuildWaterDepot(28479, false));
print(" BuildDock(): " + AIMarine.BuildDock(29253, true));
@@ -1414,7 +1414,7 @@ function Regression::Town()
print(" GetPopulation(): " + AITown.GetPopulation(i));
print(" GetLocation(): " + AITown.GetLocation(i));
print(" GetHouseCount(): " + AITown.GetHouseCount(i));
print(" GetRating(): " + AITown.GetRating(i, AICompany.MY_COMPANY));
print(" GetRating(): " + AITown.GetRating(i, AICompany.COMPANY_SELF));
}
print(" Valid Towns: " + j);
print(" GetTownCount(): " + AITown.GetTownCount());
@@ -1478,7 +1478,7 @@ function Regression::Tunnel()
print(" IsTunnelTile(): " + AITunnel.IsTunnelTile(29050));
print(" RemoveTunnel(): " + AITunnel.RemoveTunnel(29050));
print(" GetOtherTunnelEnd(): " + AITunnel.GetOtherTunnelEnd(29050));
print(" BuildTunnel(): " + AITunnel.BuildTunnel(AIVehicle.VEHICLE_ROAD, 29050));
print(" BuildTunnel(): " + AITunnel.BuildTunnel(AIVehicle.VT_ROAD, 29050));
print(" GetOtherTunnelEnd(): " + AITunnel.GetOtherTunnelEnd(29050));
print(" IsTunnelTile(): " + AITunnel.IsTunnelTile(29050));
print(" IsTunnelTile(): " + AITunnel.IsTunnelTile(28026));
@@ -1486,8 +1486,8 @@ function Regression::Tunnel()
print(" IsTunnelTile(): " + AITunnel.IsTunnelTile(29050));
print(" --Errors--");
print(" BuildTunnel(): " + AITunnel.BuildTunnel(AIVehicle.VEHICLE_ROAD, 7529));
print(" BuildTunnel(): " + AITunnel.BuildTunnel(AIVehicle.VEHICLE_ROAD, 8043));
print(" BuildTunnel(): " + AITunnel.BuildTunnel(AIVehicle.VT_ROAD, 7529));
print(" BuildTunnel(): " + AITunnel.BuildTunnel(AIVehicle.VT_ROAD, 8043));
print(" GetLastErrorString(): " + AIError.GetLastErrorString());
print(" RemoveTunnel(): " + AITunnel.RemoveTunnel(7529));
}
@@ -1503,20 +1503,20 @@ function Regression::Vehicle()
print(" IsValidVehicle(12): " + AIVehicle.IsValidVehicle(12));
print(" ISValidVehicle(9999): " + AIVehicle.IsValidVehicle(9999));
local bank = AICompany.GetBankBalance(AICompany.MY_COMPANY);
local bank = AICompany.GetBankBalance(AICompany.COMPANY_SELF);
print(" BuildVehicle(): " + AIVehicle.BuildVehicle(33417, 153));
print(" IsValidVehicle(12): " + AIVehicle.IsValidVehicle(12));
print(" CloneVehicle(): " + AIVehicle.CloneVehicle(33417, 12, true));
local bank_after = AICompany.GetBankBalance(AICompany.MY_COMPANY);
local bank_after = AICompany.GetBankBalance(AICompany.COMPANY_SELF);
print(" --Accounting--");
print(" GetCosts(): " + accounting.GetCosts());
print(" Should be: " + (bank - bank_after));
print(" ResetCosts(): " + accounting.ResetCosts());
bank = AICompany.GetBankBalance(AICompany.MY_COMPANY);
bank = AICompany.GetBankBalance(AICompany.COMPANY_SELF);
print(" SellVehicle(13): " + AIVehicle.SellVehicle(13));
print(" IsInDepot(): " + AIVehicle.IsInDepot(12));
@@ -1528,7 +1528,7 @@ function Regression::Vehicle()
print(" IsInDepot(): " + AIVehicle.IsInDepot(12));
print(" IsStoppedInDepot(): " + AIVehicle.IsStoppedInDepot(12));
bank_after = AICompany.GetBankBalance(AICompany.MY_COMPANY);
bank_after = AICompany.GetBankBalance(AICompany.COMPANY_SELF);
print(" --Accounting--");
print(" GetCosts(): " + accounting.GetCosts());

View File

@@ -6161,8 +6161,8 @@
GetTileIndex(): 123
GetTileIndex(): 31488
GetTileIndex(): 0
GetTileIndex(): -1
GetTileIndex(): -1
GetTileIndex(): -257
GetTileIndex(): 2570000
IsValidTile(123): true
GetTileX(124): 124
GetTileY(124): 0
@@ -6225,12 +6225,12 @@
Tile 45469
Tile 45468
Tile 45467
Tile 45211
Tile 44955
Tile 44699
Tile 44443
Tile 44187
Tile 43931
Tile 45466
Tile 45210
Tile 44954
Tile 44698
Tile 44442
Tile 44186
Tile 43930
Tile 43929
Tile 43928
@@ -7229,7 +7229,7 @@
GetPopulation(): 180
GetLocation(): 14935
GetHouseCount(): 13
GetRating(): 0
GetRating(): 5
Town 12
IsValidTown(): true
GetName(): Ginborough
@@ -7243,7 +7243,7 @@
GetPopulation(): 310
GetLocation(): 9595
GetHouseCount(): 14
GetRating(): 0
GetRating(): 5
Town 14
IsValidTown(): true
GetName(): Prundinghall
@@ -7278,7 +7278,7 @@
GetPopulation(): 262
GetLocation(): 10574
GetHouseCount(): 13
GetRating(): 0
GetRating(): 5
Town 19
IsValidTown(): true
GetName(): Mendingston
@@ -7299,7 +7299,7 @@
GetPopulation(): 802
GetLocation(): 9634
GetHouseCount(): 27
GetRating(): 0
GetRating(): 5
Town 22
IsValidTown(): true
GetName(): Naborough
@@ -7590,12 +7590,12 @@
GetLocation(): 33417
GetEngineType(): 153
GetUnitNumber(): 1
GetAge(): 1
GetAge(): 0
GetMaxAge(): 5490
GetAgeLeft(): 5489
GetAgeLeft(): 5490
GetCurrentSpeed(): 4
GetRunningCost(): 14
GetProfitThisYear(): -1
GetProfitThisYear(): 0
GetProfitLastYear(): 0
GetCurrentValue(): 466
GetVehicleType(): 1
@@ -7605,7 +7605,7 @@
IsInDepot(): false
GetNumWagons(): 1
GetWagonEngineType(): 153
GetWagonAge(): 1
GetWagonAge(): 0
GetLength(): 8
GetOwner(): 1
BuildVehicle(): 14
@@ -7663,11 +7663,11 @@
14 => 1
12 => 1
Age ListDump:
14 => 1
13 => 1
12 => 1
17 => 0
16 => 0
14 => 0
13 => 0
12 => 0
MaxAge ListDump:
16 => 10980
14 => 10980
@@ -7676,10 +7676,10 @@
12 => 5490
AgeLeft ListDump:
16 => 10980
14 => 10979
14 => 10980
17 => 7320
13 => 5489
12 => 5489
13 => 5490
12 => 5490
CurrentSpeed ListDump:
12 => 13
17 => 0
@@ -7697,7 +7697,7 @@
16 => 0
14 => 0
13 => 0
12 => -1
12 => 0
ProfitLastYear ListDump:
17 => 0
16 => 0

View File

@@ -32,7 +32,7 @@ class WrightAI extends AIController {
*/
function WrightAI::HasMoney(money)
{
if (AICompany.GetBankBalance(AICompany.MY_COMPANY) + (AICompany.GetMaxLoanAmount() - AICompany.GetLoanAmount()) > money) return true;
if (AICompany.GetBankBalance(AICompany.COMPANY_SELF) + (AICompany.GetMaxLoanAmount() - AICompany.GetLoanAmount()) > money) return true;
return false;
}
@@ -42,9 +42,9 @@ function WrightAI::HasMoney(money)
function WrightAI::GetMoney(money)
{
if (!this.HasMoney(money)) return;
if (AICompany.GetBankBalance(AICompany.MY_COMPANY) > money) return;
if (AICompany.GetBankBalance(AICompany.COMPANY_SELF) > money) return;
local loan = money - AICompany.GetBankBalance(AICompany.MY_COMPANY) + AICompany.GetLoanInterval() + AICompany.GetLoanAmount();
local loan = money - AICompany.GetBankBalance(AICompany.COMPANY_SELF) + AICompany.GetLoanInterval() + AICompany.GetLoanAmount();
loan = loan - loan % AICompany.GetLoanInterval();
AILog.Info("Need a loan to get " + money + ": " + loan);
AICompany.SetLoanAmount(loan);
@@ -109,10 +109,10 @@ function WrightAI::BuildAircraft(tile_1, tile_2)
local hangar = AIAirport.GetHangarOfAirport(tile_1);
local engine = null;
local engine_list = AIEngineList(AIVehicle.VEHICLE_AIR);
local engine_list = AIEngineList(AIVehicle.VT_AIR);
/* When bank balance < 300000, buy cheaper planes */
local balance = AICompany.GetBankBalance(AICompany.MY_COMPANY);
local balance = AICompany.GetBankBalance(AICompany.COMPANY_SELF);
engine_list.Valuate(AIEngine.GetPrice);
engine_list.KeepBelowValue(balance < 300000 ? 50000 : (balance < 1000000 ? 300000 : 1000000));
@@ -335,7 +335,7 @@ function WrightAI::Start()
i++;
}
}
this.name = AICompany.GetName(AICompany.MY_COMPANY);
this.name = AICompany.GetName(AICompany.COMPANY_SELF);
/* Say hello to the user */
AILog.Info("Welcome to WrightAI. I will be building airports all day long.");
AILog.Info(" - Minimum Town Size: " + GetSetting("min_town_size"));