mirror of https://github.com/OpenTTD/OpenTTD.git
Merge e5d30a3354
into 3b80a8255f
This commit is contained in:
commit
2f1e699985
|
@ -242,6 +242,60 @@ function Regression::Airport()
|
||||||
print(" BuildAirport(): " + AIAirport.BuildAirport(32116, 0, AIStation.STATION_JOIN_ADJACENT));
|
print(" BuildAirport(): " + AIAirport.BuildAirport(32116, 0, AIStation.STATION_JOIN_ADJACENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Regression::AirportTypeList()
|
||||||
|
{
|
||||||
|
local list = AIAirportTypeList();
|
||||||
|
|
||||||
|
print("");
|
||||||
|
print("--AirportTypeList--");
|
||||||
|
print(" Count(): " + list.Count());
|
||||||
|
list.Valuate(AIAirport.IsValidAirportType);
|
||||||
|
print(" IsValidAirportType ListDump:");
|
||||||
|
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||||
|
print(" " + i + " => " + list.GetValue(i));
|
||||||
|
}
|
||||||
|
list.Valuate(AIAirport.IsAirportInformationAvailable);
|
||||||
|
print(" IsAirportInformationAvailable ListDump:");
|
||||||
|
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||||
|
print(" " + i + " => " + list.GetValue(i));
|
||||||
|
}
|
||||||
|
list.Valuate(AIAirport.GetPrice);
|
||||||
|
print(" GetPrice ListDump:");
|
||||||
|
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||||
|
print(" " + i + " => " + list.GetValue(i));
|
||||||
|
}
|
||||||
|
list.Valuate(AIAirport.GetAirportWidth);
|
||||||
|
print(" GetAirportWidth ListDump:");
|
||||||
|
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||||
|
print(" " + i + " => " + list.GetValue(i));
|
||||||
|
}
|
||||||
|
list.Valuate(AIAirport.GetAirportHeight);
|
||||||
|
print(" GetAirportHeight ListDump:");
|
||||||
|
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||||
|
print(" " + i + " => " + list.GetValue(i));
|
||||||
|
}
|
||||||
|
list.Valuate(AIAirport.GetAirportCoverageRadius);
|
||||||
|
print(" GetAirportCoverageRadius ListDump:");
|
||||||
|
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||||
|
print(" " + i + " => " + list.GetValue(i));
|
||||||
|
}
|
||||||
|
list.Valuate(AIAirport.GetMaintenanceCostFactor);
|
||||||
|
print(" GetMaintenanceCostFactor ListDump:");
|
||||||
|
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||||
|
print(" " + i + " => " + list.GetValue(i));
|
||||||
|
}
|
||||||
|
list.Valuate(AIAirport.GetMonthlyMaintenanceCost);
|
||||||
|
print(" GetMonthlyMaintenanceCost ListDump:");
|
||||||
|
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||||
|
print(" " + i + " => " + list.GetValue(i));
|
||||||
|
}
|
||||||
|
list.Valuate(AIAirport.GetAirportNumHelipads);
|
||||||
|
print(" GetAirportNumHelipads ListDump:");
|
||||||
|
for (local i = list.Begin(); !list.IsEnd(); i = list.Next()) {
|
||||||
|
print(" " + i + " => " + list.GetValue(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Regression::Bridge()
|
function Regression::Bridge()
|
||||||
{
|
{
|
||||||
local j = 0;
|
local j = 0;
|
||||||
|
@ -1987,6 +2041,7 @@ function Regression::Start()
|
||||||
|
|
||||||
this.Commands();
|
this.Commands();
|
||||||
this.Airport();
|
this.Airport();
|
||||||
|
this.AirportTypeList()
|
||||||
this.Bridge();
|
this.Bridge();
|
||||||
this.BridgeList();
|
this.BridgeList();
|
||||||
this.Cargo();
|
this.Cargo();
|
||||||
|
|
|
@ -883,6 +883,27 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||||
GetBankBalance(): 1999989626
|
GetBankBalance(): 1999989626
|
||||||
BuildAirport(): true
|
BuildAirport(): true
|
||||||
|
|
||||||
|
--AirportTypeList--
|
||||||
|
Count(): 1
|
||||||
|
IsValidAirportType ListDump:
|
||||||
|
0 => 1
|
||||||
|
IsAirportInformationAvailable ListDump:
|
||||||
|
0 => 1
|
||||||
|
GetPrice ListDump:
|
||||||
|
0 => 5400
|
||||||
|
GetAirportWidth ListDump:
|
||||||
|
0 => 4
|
||||||
|
GetAirportHeight ListDump:
|
||||||
|
0 => 3
|
||||||
|
GetAirportCoverageRadius ListDump:
|
||||||
|
0 => 4
|
||||||
|
GetMaintenanceCostFactor ListDump:
|
||||||
|
0 => 7
|
||||||
|
GetMonthlyMaintenanceCost ListDump:
|
||||||
|
0 => 3281
|
||||||
|
GetAirportNumHelipads ListDump:
|
||||||
|
0 => 0
|
||||||
|
|
||||||
--Bridge--
|
--Bridge--
|
||||||
Bridge -1
|
Bridge -1
|
||||||
IsValidBridge(): false
|
IsValidBridge(): false
|
||||||
|
@ -9748,9 +9769,9 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||||
--Valuate() with excessive CPU usage--
|
--Valuate() with excessive CPU usage--
|
||||||
Your script made an error: excessive CPU usage in valuator function
|
Your script made an error: excessive CPU usage in valuator function
|
||||||
|
|
||||||
*FUNCTION [unknown()] regression/main.nut line [2051]
|
*FUNCTION [unknown()] regression/main.nut line [2106]
|
||||||
*FUNCTION [Valuate()] NATIVE line [-1]
|
*FUNCTION [Valuate()] NATIVE line [-1]
|
||||||
*FUNCTION [Start()] regression/main.nut line [2052]
|
*FUNCTION [Start()] regression/main.nut line [2107]
|
||||||
|
|
||||||
[id] 0
|
[id] 0
|
||||||
[this] TABLE
|
[this] TABLE
|
||||||
|
@ -9759,7 +9780,7 @@ Your script made an error: excessive CPU usage in valuator function
|
||||||
[this] INSTANCE
|
[this] INSTANCE
|
||||||
Your script made an error: excessive CPU usage in valuator function
|
Your script made an error: excessive CPU usage in valuator function
|
||||||
|
|
||||||
*FUNCTION [Start()] regression/main.nut line [2052]
|
*FUNCTION [Start()] regression/main.nut line [2107]
|
||||||
|
|
||||||
[Infinite] CLOSURE
|
[Infinite] CLOSURE
|
||||||
[list] INSTANCE
|
[list] INSTANCE
|
||||||
|
|
|
@ -146,6 +146,7 @@ add_files(
|
||||||
script_accounting.hpp
|
script_accounting.hpp
|
||||||
script_admin.hpp
|
script_admin.hpp
|
||||||
script_airport.hpp
|
script_airport.hpp
|
||||||
|
script_airporttypelist.hpp
|
||||||
script_asyncmode.hpp
|
script_asyncmode.hpp
|
||||||
script_base.hpp
|
script_base.hpp
|
||||||
script_basestation.hpp
|
script_basestation.hpp
|
||||||
|
@ -220,6 +221,7 @@ add_files(
|
||||||
script_accounting.cpp
|
script_accounting.cpp
|
||||||
script_admin.cpp
|
script_admin.cpp
|
||||||
script_airport.cpp
|
script_airport.cpp
|
||||||
|
script_airporttypelist.cpp
|
||||||
script_asyncmode.cpp
|
script_asyncmode.cpp
|
||||||
script_base.cpp
|
script_base.cpp
|
||||||
script_basestation.cpp
|
script_basestation.cpp
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
*
|
*
|
||||||
* This version is not yet released. The following changes are not set in stone yet.
|
* This version is not yet released. The following changes are not set in stone yet.
|
||||||
*
|
*
|
||||||
|
* API additions:
|
||||||
|
* \li AIAirportTypeList
|
||||||
|
*
|
||||||
* \b 14.0
|
* \b 14.0
|
||||||
*
|
*
|
||||||
* API additions:
|
* API additions:
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
*
|
*
|
||||||
* This version is not yet released. The following changes are not set in stone yet.
|
* This version is not yet released. The following changes are not set in stone yet.
|
||||||
*
|
*
|
||||||
|
* API additions:
|
||||||
|
* \li GSAirportTypeList
|
||||||
|
*
|
||||||
* \b 14.0
|
* \b 14.0
|
||||||
*
|
*
|
||||||
* API additions:
|
* API additions:
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* This file is part of OpenTTD.
|
||||||
|
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||||
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @file script_airporttypelist.cpp Implementation of ScriptAirportTypeList and friends. */
|
||||||
|
|
||||||
|
#include "../../stdafx.h"
|
||||||
|
#include "script_airporttypelist.hpp"
|
||||||
|
#include "script_error.hpp"
|
||||||
|
#include "../../newgrf_airport.h"
|
||||||
|
|
||||||
|
#include "../../safeguards.h"
|
||||||
|
|
||||||
|
|
||||||
|
ScriptAirportTypeList::ScriptAirportTypeList()
|
||||||
|
{
|
||||||
|
EnforceDeityOrCompanyModeValid_Void();
|
||||||
|
bool is_deity = ScriptCompanyMode::IsDeity();
|
||||||
|
for (uint8_t at = 0; at < ::NUM_AIRPORTS; at++) {
|
||||||
|
if ((is_deity && ::AirportSpec::Get(at)->enabled) || ::AirportSpec::Get(at)->IsAvailable()) this->AddItem(at);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* This file is part of OpenTTD.
|
||||||
|
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||||
|
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @file script_airporttypelist.hpp List all available airport types. */
|
||||||
|
|
||||||
|
#ifndef SCRIPT_AIRPORTTYPELIST_HPP
|
||||||
|
#define SCRIPT_AIRPORTTYPELIST_HPP
|
||||||
|
|
||||||
|
#include "script_list.hpp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a list of all available airport types.
|
||||||
|
* @api ai game
|
||||||
|
* @ingroup ScriptList
|
||||||
|
*/
|
||||||
|
class ScriptAirportTypeList : public ScriptList {
|
||||||
|
public:
|
||||||
|
ScriptAirportTypeList();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* SCRIPT_AIRPORTTYPELIST_HPP */
|
Loading…
Reference in New Issue