1
0
Fork 0

(svn r24009) [1.2] -Backport from trunk:

- Fix: [Script] AI used in names in API for GSOrder [FS#5088] (r24006)
release/1.2
rubidium 2012-03-04 16:56:41 +00:00
parent e19915d824
commit 5814764af9
29 changed files with 222 additions and 170 deletions

View File

@ -350,3 +350,20 @@ AIEvent.AI_ET_ENGINE_AVAILABLE <- AIEvent.ET_ENGINE_AVAILABLE;
AIEvent.AI_ET_STATION_FIRST_VEHICLE <- AIEvent.ET_STATION_FIRST_VEHICLE;
AIEvent.AI_ET_DISASTER_ZEPPELINER_CRASHED <- AIEvent.ET_DISASTER_ZEPPELINER_CRASHED;
AIEvent.AI_ET_DISASTER_ZEPPELINER_CLEARED <- AIEvent.ET_DISASTER_ZEPPELINER_CLEARED;
AIOrder.AIOF_NONE <- AIOrder.OF_NONE
AIOrder.AIOF_NON_STOP_INTERMEDIATE <- AIOrder.OF_NON_STOP_INTERMEDIATE
AIOrder.AIOF_NON_STOP_DESTINATION <- AIOrder.OF_NON_STOP_DESTINATION
AIOrder.AIOF_UNLOAD <- AIOrder.OF_UNLOAD
AIOrder.AIOF_TRANSFER <- AIOrder.OF_TRANSFER
AIOrder.AIOF_NO_UNLOAD <- AIOrder.OF_NO_UNLOAD
AIOrder.AIOF_FULL_LOAD <- AIOrder.OF_FULL_LOAD
AIOrder.AIOF_FULL_LOAD_ANY <- AIOrder.OF_FULL_LOAD_ANY
AIOrder.AIOF_NO_LOAD <- AIOrder.OF_NO_LOAD
AIOrder.AIOF_SERVICE_IF_NEEDED <- AIOrder.OF_SERVICE_IF_NEEDED
AIOrder.AIOF_STOP_IN_DEPOT <- AIOrder.OF_STOP_IN_DEPOT
AIOrder.AIOF_GOTO_NEAREST_DEPOT <- AIOrder.OF_GOTO_NEAREST_DEPOT
AIOrder.AIOF_NON_STOP_FLAGS <- AIOrder.OF_NON_STOP_FLAGS
AIOrder.AIOF_UNLOAD_FLAGS <- AIOrder.OF_UNLOAD_FLAGS
AIOrder.AIOF_LOAD_FLAGS <- AIOrder.OF_LOAD_FLAGS
AIOrder.AIOF_DEPOT_FLAGS <- AIOrder.OF_DEPOT_FLAGS
AIOrder.AIOF_INVALID <- AIOrder.OF_INVALID

View File

@ -102,3 +102,20 @@ AIEvent.AI_ET_ENGINE_AVAILABLE <- AIEvent.ET_ENGINE_AVAILABLE;
AIEvent.AI_ET_STATION_FIRST_VEHICLE <- AIEvent.ET_STATION_FIRST_VEHICLE;
AIEvent.AI_ET_DISASTER_ZEPPELINER_CRASHED <- AIEvent.ET_DISASTER_ZEPPELINER_CRASHED;
AIEvent.AI_ET_DISASTER_ZEPPELINER_CLEARED <- AIEvent.ET_DISASTER_ZEPPELINER_CLEARED;
AIOrder.AIOF_NONE <- AIOrder.OF_NONE
AIOrder.AIOF_NON_STOP_INTERMEDIATE <- AIOrder.OF_NON_STOP_INTERMEDIATE
AIOrder.AIOF_NON_STOP_DESTINATION <- AIOrder.OF_NON_STOP_DESTINATION
AIOrder.AIOF_UNLOAD <- AIOrder.OF_UNLOAD
AIOrder.AIOF_TRANSFER <- AIOrder.OF_TRANSFER
AIOrder.AIOF_NO_UNLOAD <- AIOrder.OF_NO_UNLOAD
AIOrder.AIOF_FULL_LOAD <- AIOrder.OF_FULL_LOAD
AIOrder.AIOF_FULL_LOAD_ANY <- AIOrder.OF_FULL_LOAD_ANY
AIOrder.AIOF_NO_LOAD <- AIOrder.OF_NO_LOAD
AIOrder.AIOF_SERVICE_IF_NEEDED <- AIOrder.OF_SERVICE_IF_NEEDED
AIOrder.AIOF_STOP_IN_DEPOT <- AIOrder.OF_STOP_IN_DEPOT
AIOrder.AIOF_GOTO_NEAREST_DEPOT <- AIOrder.OF_GOTO_NEAREST_DEPOT
AIOrder.AIOF_NON_STOP_FLAGS <- AIOrder.OF_NON_STOP_FLAGS
AIOrder.AIOF_UNLOAD_FLAGS <- AIOrder.OF_UNLOAD_FLAGS
AIOrder.AIOF_LOAD_FLAGS <- AIOrder.OF_LOAD_FLAGS
AIOrder.AIOF_DEPOT_FLAGS <- AIOrder.OF_DEPOT_FLAGS
AIOrder.AIOF_INVALID <- AIOrder.OF_INVALID

View File

@ -39,3 +39,20 @@ AIEvent.AI_ET_STATION_FIRST_VEHICLE <- AIEvent.ET_STATION_FIRST_VEHICLE;
AIEvent.AI_ET_DISASTER_ZEPPELINER_CRASHED <- AIEvent.ET_DISASTER_ZEPPELINER_CRASHED;
AIEvent.AI_ET_DISASTER_ZEPPELINER_CLEARED <- AIEvent.ET_DISASTER_ZEPPELINER_CLEARED;
AIEvent.AI_ET_TOWN_FOUNDED <- AIEvent.ET_TOWN_FOUNDED;
AIOrder.AIOF_NONE <- AIOrder.OF_NONE
AIOrder.AIOF_NON_STOP_INTERMEDIATE <- AIOrder.OF_NON_STOP_INTERMEDIATE
AIOrder.AIOF_NON_STOP_DESTINATION <- AIOrder.OF_NON_STOP_DESTINATION
AIOrder.AIOF_UNLOAD <- AIOrder.OF_UNLOAD
AIOrder.AIOF_TRANSFER <- AIOrder.OF_TRANSFER
AIOrder.AIOF_NO_UNLOAD <- AIOrder.OF_NO_UNLOAD
AIOrder.AIOF_FULL_LOAD <- AIOrder.OF_FULL_LOAD
AIOrder.AIOF_FULL_LOAD_ANY <- AIOrder.OF_FULL_LOAD_ANY
AIOrder.AIOF_NO_LOAD <- AIOrder.OF_NO_LOAD
AIOrder.AIOF_SERVICE_IF_NEEDED <- AIOrder.OF_SERVICE_IF_NEEDED
AIOrder.AIOF_STOP_IN_DEPOT <- AIOrder.OF_STOP_IN_DEPOT
AIOrder.AIOF_GOTO_NEAREST_DEPOT <- AIOrder.OF_GOTO_NEAREST_DEPOT
AIOrder.AIOF_NON_STOP_FLAGS <- AIOrder.OF_NON_STOP_FLAGS
AIOrder.AIOF_UNLOAD_FLAGS <- AIOrder.OF_UNLOAD_FLAGS
AIOrder.AIOF_LOAD_FLAGS <- AIOrder.OF_LOAD_FLAGS
AIOrder.AIOF_DEPOT_FLAGS <- AIOrder.OF_DEPOT_FLAGS
AIOrder.AIOF_INVALID <- AIOrder.OF_INVALID

View File

@ -923,12 +923,12 @@ function Regression::Order()
print("--Order--");
print(" GetOrderCount(): " + AIOrder.GetOrderCount(12));
print(" GetOrderDestination(): " + AIOrder.GetOrderDestination(12, 1));
print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33416, AIOrder.AIOF_TRANSFER));
print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33416, AIOrder.AIOF_TRANSFER | AIOrder.AIOF_UNLOAD));
print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33416, AIOrder.AIOF_TRANSFER | AIOrder.AIOF_FULL_LOAD));
print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33417, AIOrder.AIOF_SERVICE_IF_NEEDED));
print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33417, AIOrder.AIOF_STOP_IN_DEPOT));
print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(0, AIOrder.AIOF_SERVICE_IF_NEEDED | AIOrder.AIOF_GOTO_NEAREST_DEPOT));
print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33416, AIOrder.OF_TRANSFER));
print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33416, AIOrder.OF_TRANSFER | AIOrder.OF_UNLOAD));
print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33416, AIOrder.OF_TRANSFER | AIOrder.OF_FULL_LOAD));
print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33417, AIOrder.OF_SERVICE_IF_NEEDED));
print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(33417, AIOrder.OF_STOP_IN_DEPOT));
print(" AreOrderFlagsValid(): " + AIOrder.AreOrderFlagsValid(0, AIOrder.OF_SERVICE_IF_NEEDED | AIOrder.OF_GOTO_NEAREST_DEPOT));
print(" IsValidConditionalOrder(): " + AIOrder.IsValidConditionalOrder(AIOrder.OC_LOAD_PERCENTAGE, AIOrder.CF_EQUALS));
print(" IsValidConditionalOrder(): " + AIOrder.IsValidConditionalOrder(AIOrder.OC_RELIABILITY, AIOrder.CF_IS_TRUE));
print(" IsValidConditionalOrder(): " + AIOrder.IsValidConditionalOrder(AIOrder.OC_REQUIRES_SERVICE, AIOrder.CF_IS_FALSE));
@ -940,8 +940,8 @@ function Regression::Order()
print(" IsConditionalOrder(): " + AIOrder.IsConditionalOrder(12, 1));
print(" IsCurrentOrderPartOfOrderList(): " + AIOrder.IsCurrentOrderPartOfOrderList(12));
print(" GetOrderFlags(): " + AIOrder.GetOrderFlags(12, 1));
print(" AppendOrder(): " + AIOrder.AppendOrder(12, 33416, AIOrder.AIOF_TRANSFER));
print(" InsertOrder(): " + AIOrder.InsertOrder(12, 0, 33416, AIOrder.AIOF_TRANSFER));
print(" AppendOrder(): " + AIOrder.AppendOrder(12, 33416, AIOrder.OF_TRANSFER));
print(" InsertOrder(): " + AIOrder.InsertOrder(12, 0, 33416, AIOrder.OF_TRANSFER));
print(" GetOrderCount(): " + AIOrder.GetOrderCount(12));
print(" IsValidVehicleOrder(): " + AIOrder.IsValidVehicleOrder(12, 1));
print(" IsGotoStationOrder(): " + AIOrder.IsGotoStationOrder(12, 1));
@ -953,7 +953,7 @@ function Regression::Order()
print(" GetOrderFlags(): " + AIOrder.GetOrderFlags(12, 1));
print(" GetOrderJumpTo(): " + AIOrder.GetOrderJumpTo(12, 1));
print(" RemoveOrder(): " + AIOrder.RemoveOrder(12, 0));
print(" SetOrderFlags(): " + AIOrder.SetOrderFlags(12, 0, AIOrder.AIOF_FULL_LOAD));
print(" SetOrderFlags(): " + AIOrder.SetOrderFlags(12, 0, AIOrder.OF_FULL_LOAD));
print(" GetOrderFlags(): " + AIOrder.GetOrderFlags(12, 0));
print(" GetOrderDestination(): " + AIOrder.GetOrderDestination(12, 0));
print(" CopyOrders(): " + AIOrder.CopyOrders(12, 1));
@ -961,12 +961,12 @@ function Regression::Order()
print(" ShareOrders(): " + AIOrder.ShareOrders(13, 1));
print(" ShareOrders(): " + AIOrder.ShareOrders(13, 12));
print(" UnshareOrders(): " + AIOrder.UnshareOrders(13));
print(" AppendOrder(): " + AIOrder.AppendOrder(12, 33421, AIOrder.AIOF_NONE));
print(" AppendOrder(): " + AIOrder.AppendOrder(12, 33421, AIOrder.OF_NONE));
print(" GetStopLocation(): " + AIOrder.GetStopLocation(13, 0));
print(" BuildVehicle(): " + AIVehicle.BuildVehicle(23596, 8));
print(" BuildRailStation(): " + AIRail.BuildRailStation(7958, AIRail.RAILTRACK_NE_SW, 1, 1, AIStation.STATION_NEW));
print(" AppendOrder(): " + AIOrder.AppendOrder(20, 7958, AIOrder.AIOF_NONE));
print(" AppendOrder(): " + AIOrder.AppendOrder(20, 7958, AIOrder.OF_NONE));
print(" GetOrderCount(): " + AIOrder.GetOrderCount(20));
print(" GetStopLocation(): " + AIOrder.GetStopLocation(20, 0));
print(" SetStopLocation(): " + AIOrder.SetStopLocation(20, 0, AIOrder.STOPLOCATION_MIDDLE));

View File

@ -25,23 +25,23 @@ void SQAIOrder_Register(Squirrel *engine)
SQAIOrder.DefSQConst(engine, ScriptOrder::ERR_ORDER_TOO_MANY, "ERR_ORDER_TOO_MANY");
SQAIOrder.DefSQConst(engine, ScriptOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, "ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION");
SQAIOrder.DefSQConst(engine, ScriptOrder::ERR_ORDER_AIRCRAFT_NOT_ENOUGH_RANGE, "ERR_ORDER_AIRCRAFT_NOT_ENOUGH_RANGE");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NONE, "AIOF_NONE");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NON_STOP_INTERMEDIATE, "AIOF_NON_STOP_INTERMEDIATE");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NON_STOP_DESTINATION, "AIOF_NON_STOP_DESTINATION");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_UNLOAD, "AIOF_UNLOAD");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_TRANSFER, "AIOF_TRANSFER");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NO_UNLOAD, "AIOF_NO_UNLOAD");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_FULL_LOAD, "AIOF_FULL_LOAD");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_FULL_LOAD_ANY, "AIOF_FULL_LOAD_ANY");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NO_LOAD, "AIOF_NO_LOAD");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_SERVICE_IF_NEEDED, "AIOF_SERVICE_IF_NEEDED");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_STOP_IN_DEPOT, "AIOF_STOP_IN_DEPOT");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_GOTO_NEAREST_DEPOT, "AIOF_GOTO_NEAREST_DEPOT");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_NON_STOP_FLAGS, "AIOF_NON_STOP_FLAGS");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_UNLOAD_FLAGS, "AIOF_UNLOAD_FLAGS");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_LOAD_FLAGS, "AIOF_LOAD_FLAGS");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_DEPOT_FLAGS, "AIOF_DEPOT_FLAGS");
SQAIOrder.DefSQConst(engine, ScriptOrder::AIOF_INVALID, "AIOF_INVALID");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_NONE, "OF_NONE");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_NON_STOP_INTERMEDIATE, "OF_NON_STOP_INTERMEDIATE");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_NON_STOP_DESTINATION, "OF_NON_STOP_DESTINATION");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_UNLOAD, "OF_UNLOAD");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_TRANSFER, "OF_TRANSFER");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_NO_UNLOAD, "OF_NO_UNLOAD");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_FULL_LOAD, "OF_FULL_LOAD");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_FULL_LOAD_ANY, "OF_FULL_LOAD_ANY");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_NO_LOAD, "OF_NO_LOAD");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_SERVICE_IF_NEEDED, "OF_SERVICE_IF_NEEDED");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_STOP_IN_DEPOT, "OF_STOP_IN_DEPOT");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_GOTO_NEAREST_DEPOT, "OF_GOTO_NEAREST_DEPOT");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_NON_STOP_FLAGS, "OF_NON_STOP_FLAGS");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_UNLOAD_FLAGS, "OF_UNLOAD_FLAGS");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_LOAD_FLAGS, "OF_LOAD_FLAGS");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_DEPOT_FLAGS, "OF_DEPOT_FLAGS");
SQAIOrder.DefSQConst(engine, ScriptOrder::OF_INVALID, "OF_INVALID");
SQAIOrder.DefSQConst(engine, ScriptOrder::OC_LOAD_PERCENTAGE, "OC_LOAD_PERCENTAGE");
SQAIOrder.DefSQConst(engine, ScriptOrder::OC_RELIABILITY, "OC_RELIABILITY");
SQAIOrder.DefSQConst(engine, ScriptOrder::OC_MAX_SPEED, "OC_MAX_SPEED");

View File

@ -58,6 +58,7 @@
* like CONFIG_RANDOM.
* \li AIEvent has all its types renamed from AI_ET_ prefix to just ET_ prefix,
* like ET_SUBSIDY_OFFER.
* \li AIOrder has all its types renamed from AIOF_ prefix to just OF_ prefix.
*
* API removals:
* \li AICompany::GetCompanyValue, use AICompany::GetQuarterlyCompanyValue instead.

View File

@ -25,23 +25,23 @@ void SQGSOrder_Register(Squirrel *engine)
SQGSOrder.DefSQConst(engine, ScriptOrder::ERR_ORDER_TOO_MANY, "ERR_ORDER_TOO_MANY");
SQGSOrder.DefSQConst(engine, ScriptOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, "ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION");
SQGSOrder.DefSQConst(engine, ScriptOrder::ERR_ORDER_AIRCRAFT_NOT_ENOUGH_RANGE, "ERR_ORDER_AIRCRAFT_NOT_ENOUGH_RANGE");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_NONE, "AIOF_NONE");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_NON_STOP_INTERMEDIATE, "AIOF_NON_STOP_INTERMEDIATE");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_NON_STOP_DESTINATION, "AIOF_NON_STOP_DESTINATION");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_UNLOAD, "AIOF_UNLOAD");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_TRANSFER, "AIOF_TRANSFER");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_NO_UNLOAD, "AIOF_NO_UNLOAD");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_FULL_LOAD, "AIOF_FULL_LOAD");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_FULL_LOAD_ANY, "AIOF_FULL_LOAD_ANY");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_NO_LOAD, "AIOF_NO_LOAD");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_SERVICE_IF_NEEDED, "AIOF_SERVICE_IF_NEEDED");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_STOP_IN_DEPOT, "AIOF_STOP_IN_DEPOT");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_GOTO_NEAREST_DEPOT, "AIOF_GOTO_NEAREST_DEPOT");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_NON_STOP_FLAGS, "AIOF_NON_STOP_FLAGS");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_UNLOAD_FLAGS, "AIOF_UNLOAD_FLAGS");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_LOAD_FLAGS, "AIOF_LOAD_FLAGS");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_DEPOT_FLAGS, "AIOF_DEPOT_FLAGS");
SQGSOrder.DefSQConst(engine, ScriptOrder::AIOF_INVALID, "AIOF_INVALID");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_NONE, "OF_NONE");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_NON_STOP_INTERMEDIATE, "OF_NON_STOP_INTERMEDIATE");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_NON_STOP_DESTINATION, "OF_NON_STOP_DESTINATION");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_UNLOAD, "OF_UNLOAD");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_TRANSFER, "OF_TRANSFER");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_NO_UNLOAD, "OF_NO_UNLOAD");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_FULL_LOAD, "OF_FULL_LOAD");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_FULL_LOAD_ANY, "OF_FULL_LOAD_ANY");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_NO_LOAD, "OF_NO_LOAD");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_SERVICE_IF_NEEDED, "OF_SERVICE_IF_NEEDED");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_STOP_IN_DEPOT, "OF_STOP_IN_DEPOT");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_GOTO_NEAREST_DEPOT, "OF_GOTO_NEAREST_DEPOT");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_NON_STOP_FLAGS, "OF_NON_STOP_FLAGS");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_UNLOAD_FLAGS, "OF_UNLOAD_FLAGS");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_LOAD_FLAGS, "OF_LOAD_FLAGS");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_DEPOT_FLAGS, "OF_DEPOT_FLAGS");
SQGSOrder.DefSQConst(engine, ScriptOrder::OF_INVALID, "OF_INVALID");
SQGSOrder.DefSQConst(engine, ScriptOrder::OC_LOAD_PERCENTAGE, "OC_LOAD_PERCENTAGE");
SQGSOrder.DefSQConst(engine, ScriptOrder::OC_RELIABILITY, "OC_RELIABILITY");
SQGSOrder.DefSQConst(engine, ScriptOrder::OC_MAX_SPEED, "OC_MAX_SPEED");

View File

@ -7,7 +7,7 @@
* 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_accounting.hpp Everything to handle AI accounting things. */
/** @file script_accounting.hpp Everything to handle script accounting things. */
#ifndef SCRIPT_ACCOUNTING_HPP
#define SCRIPT_ACCOUNTING_HPP

View File

@ -20,7 +20,7 @@
*
* @note The random functions are not called Random and RandomRange, because
* RANDOM_DEBUG does some tricky stuff, which messes with those names.
* @note In MP we cannot use Random because that will cause desyncs (AIs are
* @note In MP we cannot use Random because that will cause desyncs (scripts are
* ran on the server only, not on all clients). This means that
* we use InteractiveRandom in MP. Rand() takes care of this for you.
*/

View File

@ -36,7 +36,7 @@
/**
* Helper function to connect a just built bridge to nearby roads.
* @param instance The AI we have to built the road for.
* @param instance The script instance we have to built the road for.
*/
static void _DoCommandReturnBuildBridge2(class ScriptInstance *instance)
{
@ -52,7 +52,7 @@ static void _DoCommandReturnBuildBridge2(class ScriptInstance *instance)
/**
* Helper function to connect a just built bridge to nearby roads.
* @param instance The AI we have to built the road for.
* @param instance The script instance we have to built the road for.
*/
static void _DoCommandReturnBuildBridge1(class ScriptInstance *instance)
{

View File

@ -7,7 +7,7 @@
* 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_controller.cpp Implementation of AIControler. */
/** @file script_controller.cpp Implementation of ScriptControler. */
#include "../../stdafx.h"
#include "../../string_func.h"

View File

@ -7,7 +7,7 @@
* 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_controller.hpp The controller of the AI. */
/** @file script_controller.hpp The controller of the script. */
#ifndef SCRIPT_CONTROLLER_HPP
#define SCRIPT_CONTROLLER_HPP
@ -39,21 +39,21 @@ public:
~ScriptController();
/**
* This function is called to start your AI. Your AI starts here. If you
* return from this function, your AI dies, so make sure that doesn't
* This function is called to start your script. Your script starts here. If you
* return from this function, your script dies, so make sure that doesn't
* happen.
* @note Cannot be called from within your AI.
* @note Cannot be called from within your script.
*/
void Start();
/**
* Find at which tick your AI currently is.
* Find at which tick your script currently is.
* @return returns the current tick.
*/
static uint GetTick();
/**
* Get the number of operations the AI may still execute this tick.
* Get the number of operations the script may still execute this tick.
* @return The amount of operations left to execute.
* @note This number can go negative when certain uninteruptable
* operations are executed. The amount of operations that you go
@ -82,21 +82,21 @@ public:
static uint GetVersion();
/**
* Change the minimum amount of time the AI should be put in suspend mode
* Change the minimum amount of time the script should be put in suspend mode
* when you execute a command. Normally in SP this is 1, and in MP it is
* what ever delay the server has been programmed to delay commands
* (normally between 1 and 5). To give a more 'real' effect to your AI,
* (normally between 1 and 5). To give a more 'real' effect to your script,
* you can control that number here.
* @param ticks The minimum amount of ticks to wait.
* @pre Ticks should be positive. Too big values will influence performance of the AI.
* @pre Ticks should be positive. Too big values will influence performance of the script.
* @note If the number is lower than the MP setting, the MP setting wins.
*/
static void SetCommandDelay(int ticks);
/**
* Sleep for X ticks. The code continues after this line when the X AI ticks
* are passed. Mind that an AI tick is different from in-game ticks and
* differ per AI speed.
* Sleep for X ticks. The code continues after this line when the X script ticks
* are passed. Mind that an script tick is different from in-game ticks and
* differ per script speed.
* @param ticks the ticks to wait
* @pre ticks > 0.
* @post the value of GetTick() will be changed exactly 'ticks' in value after
@ -131,7 +131,7 @@ private:
int loaded_library_count; ///< The amount of libraries.
/**
* Register all classes that are known inside the NoAI API.
* Register all classes that are known inside the script API.
*/
void RegisterClasses();
};

View File

@ -16,7 +16,7 @@
#include <map>
/**
* Helper to write precondition enforcers for the AI API in an abbreviated manner.
* Helper to write precondition enforcers for the script API in an abbreviated manner.
* @param returnval The value to return on failure.
* @param condition The condition that must be obeyed.
*/
@ -27,7 +27,7 @@
}
/**
* Helper to write precondition enforcers for the AI API in an abbreviated manner.
* Helper to write precondition enforcers for the script API in an abbreviated manner.
* @param returnval The value to return on failure.
* @param condition The condition that must be obeyed.
* @param error_code The error code passed to ScriptObject::SetLastError.
@ -83,7 +83,7 @@ public:
ERR_PRECONDITION_STRING_TOO_LONG, // []
/** The company you use is invalid */
ERR_PRECONDITION_INVALID_COMPANY, // []
/** An error returned by a NewGRF. No possibility to get the exact error in an AI readable format */
/** An error returned by a NewGRF. No possibility to get the exact error in an script readable format */
ERR_NEWGRF_SUPPLIED_ERROR, // []
/** Base for general errors */
@ -149,31 +149,31 @@ public:
* Get the error based on the OpenTTD StringID.
* @api -all
* @param internal_string_id The string to convert.
* @return The NoAI equivalent error message.
* @return The script equivalent error message.
*/
static ScriptErrorType StringToError(StringID internal_string_id);
/**
* Map an internal OpenTTD error message to its NoAI equivalent.
* Map an internal OpenTTD error message to its script equivalent.
* @api -all
* @param internal_string_id The OpenTTD StringID used for an error.
* @param ai_error_msg The NoAI equivalent error message.
* @param ai_error_msg The script equivalent error message.
*/
static void RegisterErrorMap(StringID internal_string_id, ScriptErrorType ai_error_msg);
/**
* Map an internal OpenTTD error message to its NoAI equivalent.
* Map an internal OpenTTD error message to its script equivalent.
* @api -all
* @param ai_error_msg The NoAI error message representation.
* @param ai_error_msg The script error message representation.
* @param message The string representation of this error message, used for debug purposes.
*/
static void RegisterErrorMapString(ScriptErrorType ai_error_msg, const char *message);
private:
typedef std::map<StringID, ScriptErrorType> ScriptErrorMap; ///< The type for mapping between error (internal OpenTTD) StringID to the AI error type.
typedef std::map<StringID, ScriptErrorType> ScriptErrorMap; ///< The type for mapping between error (internal OpenTTD) StringID to the script error type.
typedef std::map<ScriptErrorType, const char *> ScriptErrorMapString; ///< The type for mapping between error type and textual representation.
static ScriptErrorMap error_map; ///< The mapping between error (internal OpenTTD) StringID to the AI error type.
static ScriptErrorMap error_map; ///< The mapping between error (internal OpenTTD) StringID to the script error type.
static ScriptErrorMapString error_map_string; ///< The mapping between error type and textual representation.
};

View File

@ -14,7 +14,7 @@
#include <queue>
/** The queue of events for an AI. */
/** The queue of events for a script. */
struct ScriptEventData {
std::queue<ScriptEvent *> stack; ///< The actual queue.
};

View File

@ -79,7 +79,7 @@ protected:
* Class that handles all event related functions.
* @api ai game
* @note it is not needed to create an instance of ScriptEvent to access it, as
* all members are static, and all data is stored AI-wide.
* all members are static, and all data is stored script instance-wide.
*/
class ScriptEventController : public ScriptObject {
public:

View File

@ -31,9 +31,9 @@ ScriptExecMode::ScriptExecMode()
ScriptExecMode::~ScriptExecMode()
{
if (this->GetDoCommandModeInstance() != this) {
/* Ignore this error if the AI already died. */
/* Ignore this error if the script already died. */
if (!ScriptObject::GetActiveInstance()->IsDead()) {
throw Script_FatalError("ScriptExecMode object was removed while it was not the latest AI*Mode object created.");
throw Script_FatalError("ScriptExecMode object was removed while it was not the latest *Mode object created.");
}
}
this->SetDoCommandMode(this->last_mode, this->last_instance);

View File

@ -7,7 +7,7 @@
* 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_execmode.hpp Switch the AI to Execute Mode. */
/** @file script_execmode.hpp Switch the script to Execute Mode. */
#ifndef SCRIPT_EXECMODE_HPP
#define SCRIPT_EXECMODE_HPP

View File

@ -30,9 +30,9 @@
* @note The names of the setting for ScriptGameSettings::IsValid and
* ScriptGameSettings::GetValue are the same ones as those that are shown by
* the list_settings command in the in-game console. Settings that are
* string based are NOT supported and AIGAmeSettings::IsValid will return
* string based are NOT supported and GameSettings::IsValid will return
* false for them. These settings will not be supported either because
* they have no relevance for the AI (default client names, server IPs,
* they have no relevance for the script (default client names, server IPs,
* etc.).
*/
class ScriptGameSettings : public ScriptObject {
@ -73,7 +73,7 @@ public:
static bool SetValue(const char *setting, int value);
/**
* Checks whether the given vehicle-type is disabled for AIs.
* Checks whether the given vehicle-type is disabled for companies.
* @param vehicle_type The vehicle-type to check.
* @return True if the vehicle-type is disabled.
* @api -game

View File

@ -64,8 +64,8 @@ public:
class ScriptListSorterValueAscending : public ScriptListSorter {
private:
ScriptList::ScriptListBucket::iterator bucket_iter; ///< The iterator over the list to find the buckets.
ScriptList::AIItemList *bucket_list; ///< The current bucket list we're iterator over.
ScriptList::AIItemList::iterator bucket_list_iter; ///< The iterator over the bucket list.
ScriptList::ScriptItemList *bucket_list; ///< The current bucket list we're iterator over.
ScriptList::ScriptItemList::iterator bucket_list_iter; ///< The iterator over the bucket list.
public:
/**
@ -150,8 +150,8 @@ public:
class ScriptListSorterValueDescending : public ScriptListSorter {
private:
ScriptList::ScriptListBucket::iterator bucket_iter; ///< The iterator over the list to find the buckets.
ScriptList::AIItemList *bucket_list; ///< The current bucket list we're iterator over.
ScriptList::AIItemList::iterator bucket_list_iter; ///< The iterator over the bucket list.
ScriptList::ScriptItemList *bucket_list; ///< The current bucket list we're iterator over.
ScriptList::ScriptItemList::iterator bucket_list_iter; ///< The iterator over the bucket list.
public:
/**
@ -593,9 +593,9 @@ void ScriptList::RemoveTop(int32 count)
default: NOT_REACHED();
case SORT_BY_VALUE:
for (ScriptListBucket::iterator iter = this->buckets.begin(); iter != this->buckets.end(); iter = this->buckets.begin()) {
AIItemList *items = &(*iter).second;
ScriptItemList *items = &(*iter).second;
size_t size = items->size();
for (AIItemList::iterator iter = items->begin(); iter != items->end(); iter = items->begin()) {
for (ScriptItemList::iterator iter = items->begin(); iter != items->end(); iter = items->begin()) {
if (--count < 0) return;
this->RemoveItem(*iter);
/* When the last item is removed from the bucket, the bucket itself is removed.
@ -630,9 +630,9 @@ void ScriptList::RemoveBottom(int32 count)
default: NOT_REACHED();
case SORT_BY_VALUE:
for (ScriptListBucket::reverse_iterator iter = this->buckets.rbegin(); iter != this->buckets.rend(); iter = this->buckets.rbegin()) {
AIItemList *items = &(*iter).second;
ScriptItemList *items = &(*iter).second;
size_t size = items->size();
for (AIItemList::reverse_iterator iter = items->rbegin(); iter != items->rend(); iter = items->rbegin()) {
for (ScriptItemList::reverse_iterator iter = items->rbegin(); iter != items->rend(); iter = items->rbegin()) {
if (--count < 0) return;
this->RemoveItem(*iter);
/* When the last item is removed from the bucket, the bucket itself is removed.

View File

@ -44,9 +44,9 @@ private:
int modifications; ///< Number of modification that has been done. To prevent changing data while valuating.
public:
typedef std::set<int32> AIItemList; ///< The list of items inside the bucket
typedef std::map<int32, AIItemList> ScriptListBucket; ///< The bucket list per value
typedef std::map<int32, int32> ScriptListMap; ///< List per item
typedef std::set<int32> ScriptItemList; ///< The list of items inside the bucket
typedef std::map<int32, ScriptItemList> ScriptListBucket; ///< The bucket list per value
typedef std::map<int32, int32> ScriptListMap; ///< List per item
ScriptListMap items; ///< The items in the list
ScriptListBucket buckets; ///< The items in the list, sorted by value

View File

@ -20,13 +20,13 @@
*/
class ScriptLog : public ScriptObject {
/* ScriptController needs access to Enum and Log, in order to keep the flow from
* OpenTTD core to NoAI API clear and simple. */
* OpenTTD core to script API clear and simple. */
friend class ScriptController;
public:
/**
* Log levels; The value is also feed to DEBUG() lvl.
* This has no use for you, as AI writer.
* This has no use for you, as script writer.
* @api -all
*/
enum ScriptLogType {
@ -38,8 +38,8 @@ public:
};
/**
* Internal representation of the log-data inside the AI.
* This has no use for you, as AI writer.
* Internal representation of the log-data inside the script.
* This has no use for you, as script writer.
* @api -all
*/
struct LogData {

View File

@ -303,13 +303,13 @@ ScriptObject::ActiveInstance::~ActiveInstance()
if (callback != NULL) callback(GetActiveInstance());
return true;
} else if (_networking) {
/* Suspend the AI till the command is really executed. */
/* Suspend the script till the command is really executed. */
throw Script_Suspend(-(int)GetDoCommandDelay(), callback);
} else {
IncreaseDoCommandCosts(res.GetCost());
/* Suspend the AI player for 1+ ticks, so it simulates multiplayer. This
* both avoids confusion when a developer launched his AI in a
/* Suspend the script player for 1+ ticks, so it simulates multiplayer. This
* both avoids confusion when a developer launched his script in a
* multiplayer game, but also gives time for the GUI and human player
* to interact with the game. */
throw Script_Suspend(GetDoCommandDelay(), callback);

View File

@ -67,7 +67,7 @@ public:
protected:
/**
* Executes a raw DoCommand for the AI.
* Executes a raw DoCommand for the script.
*/
static bool DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text = NULL, Script_SuspendCallbackProc *callback = NULL);
@ -117,17 +117,17 @@ protected:
static RailType GetRailType();
/**
* Set the current mode of your AI to this proc.
* Set the current mode of your script to this proc.
*/
static void SetDoCommandMode(ScriptModeProc *proc, ScriptObject *instance);
/**
* Get the current mode your AI is currently under.
* Get the current mode your script is currently under.
*/
static ScriptModeProc *GetDoCommandMode();
/**
* Get the instance of the current mode your AI is currently under.
* Get the instance of the current mode your script is currently under.
*/
static ScriptObject *GetDoCommandModeInstance();
@ -223,7 +223,7 @@ protected:
static int GetCallbackVariable(int index);
/**
* Can we suspend the AI at this moment?
* Can we suspend the script at this moment?
*/
static bool CanSuspend();

View File

@ -182,23 +182,23 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
/* static */ bool ScriptOrder::AreOrderFlagsValid(TileIndex destination, ScriptOrderFlags order_flags)
{
OrderType ot = (order_flags & AIOF_GOTO_NEAREST_DEPOT) ? OT_GOTO_DEPOT : ::GetOrderTypeByTile(destination);
OrderType ot = (order_flags & OF_GOTO_NEAREST_DEPOT) ? OT_GOTO_DEPOT : ::GetOrderTypeByTile(destination);
switch (ot) {
case OT_GOTO_STATION:
return (order_flags & ~(AIOF_NON_STOP_FLAGS | AIOF_UNLOAD_FLAGS | AIOF_LOAD_FLAGS)) == 0 &&
return (order_flags & ~(OF_NON_STOP_FLAGS | OF_UNLOAD_FLAGS | OF_LOAD_FLAGS)) == 0 &&
/* Test the different mutual exclusive flags. */
((order_flags & AIOF_TRANSFER) == 0 || (order_flags & AIOF_UNLOAD) == 0) &&
((order_flags & AIOF_TRANSFER) == 0 || (order_flags & AIOF_NO_UNLOAD) == 0) &&
((order_flags & AIOF_UNLOAD) == 0 || (order_flags & AIOF_NO_UNLOAD) == 0) &&
((order_flags & AIOF_UNLOAD) == 0 || (order_flags & AIOF_NO_UNLOAD) == 0) &&
((order_flags & AIOF_NO_UNLOAD) == 0 || (order_flags & AIOF_NO_LOAD) == 0) &&
((order_flags & AIOF_FULL_LOAD_ANY) == 0 || (order_flags & AIOF_NO_LOAD) == 0);
((order_flags & OF_TRANSFER) == 0 || (order_flags & OF_UNLOAD) == 0) &&
((order_flags & OF_TRANSFER) == 0 || (order_flags & OF_NO_UNLOAD) == 0) &&
((order_flags & OF_UNLOAD) == 0 || (order_flags & OF_NO_UNLOAD) == 0) &&
((order_flags & OF_UNLOAD) == 0 || (order_flags & OF_NO_UNLOAD) == 0) &&
((order_flags & OF_NO_UNLOAD) == 0 || (order_flags & OF_NO_LOAD) == 0) &&
((order_flags & OF_FULL_LOAD_ANY) == 0 || (order_flags & OF_NO_LOAD) == 0);
case OT_GOTO_DEPOT:
return (order_flags & ~(AIOF_NON_STOP_FLAGS | AIOF_DEPOT_FLAGS)) == 0 &&
((order_flags & AIOF_SERVICE_IF_NEEDED) == 0 || (order_flags & AIOF_STOP_IN_DEPOT) == 0);
return (order_flags & ~(OF_NON_STOP_FLAGS | OF_DEPOT_FLAGS)) == 0 &&
((order_flags & OF_SERVICE_IF_NEEDED) == 0 || (order_flags & OF_STOP_IN_DEPOT) == 0);
case OT_GOTO_WAYPOINT: return (order_flags & ~(AIOF_NON_STOP_FLAGS)) == 0;
case OT_GOTO_WAYPOINT: return (order_flags & ~(OF_NON_STOP_FLAGS)) == 0;
default: return false;
}
}
@ -284,18 +284,18 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
/* static */ ScriptOrder::ScriptOrderFlags ScriptOrder::GetOrderFlags(VehicleID vehicle_id, OrderPosition order_position)
{
if (!IsValidVehicleOrder(vehicle_id, order_position)) return AIOF_INVALID;
if (!IsValidVehicleOrder(vehicle_id, order_position)) return OF_INVALID;
const Order *order = ::ResolveOrder(vehicle_id, order_position);
if (order == NULL || order->GetType() == OT_CONDITIONAL || order->GetType() == OT_DUMMY) return AIOF_INVALID;
if (order == NULL || order->GetType() == OT_CONDITIONAL || order->GetType() == OT_DUMMY) return OF_INVALID;
ScriptOrderFlags order_flags = AIOF_NONE;
ScriptOrderFlags order_flags = OF_NONE;
order_flags |= (ScriptOrderFlags)order->GetNonStopType();
switch (order->GetType()) {
case OT_GOTO_DEPOT:
if (order->GetDepotOrderType() & ODTFB_SERVICE) order_flags |= AIOF_SERVICE_IF_NEEDED;
if (order->GetDepotActionType() & ODATFB_HALT) order_flags |= AIOF_STOP_IN_DEPOT;
if (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) order_flags |= AIOF_GOTO_NEAREST_DEPOT;
if (order->GetDepotOrderType() & ODTFB_SERVICE) order_flags |= OF_SERVICE_IF_NEEDED;
if (order->GetDepotActionType() & ODATFB_HALT) order_flags |= OF_STOP_IN_DEPOT;
if (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) order_flags |= OF_GOTO_NEAREST_DEPOT;
break;
case OT_GOTO_STATION:
@ -458,14 +458,14 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
EnforcePrecondition(false, AreOrderFlagsValid(destination, order_flags));
Order order;
OrderType ot = (order_flags & AIOF_GOTO_NEAREST_DEPOT) ? OT_GOTO_DEPOT : ::GetOrderTypeByTile(destination);
OrderType ot = (order_flags & OF_GOTO_NEAREST_DEPOT) ? OT_GOTO_DEPOT : ::GetOrderTypeByTile(destination);
switch (ot) {
case OT_GOTO_DEPOT: {
OrderDepotTypeFlags odtf = (OrderDepotTypeFlags)(ODTFB_PART_OF_ORDERS | ((order_flags & AIOF_SERVICE_IF_NEEDED) ? ODTFB_SERVICE : 0));
OrderDepotActionFlags odaf = (OrderDepotActionFlags)(ODATF_SERVICE_ONLY | ((order_flags & AIOF_STOP_IN_DEPOT) ? ODATFB_HALT : 0));
if (order_flags & AIOF_GOTO_NEAREST_DEPOT) odaf |= ODATFB_NEAREST_DEPOT;
OrderNonStopFlags onsf = (OrderNonStopFlags)((order_flags & AIOF_NON_STOP_INTERMEDIATE) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
if (order_flags & AIOF_GOTO_NEAREST_DEPOT) {
OrderDepotTypeFlags odtf = (OrderDepotTypeFlags)(ODTFB_PART_OF_ORDERS | ((order_flags & OF_SERVICE_IF_NEEDED) ? ODTFB_SERVICE : 0));
OrderDepotActionFlags odaf = (OrderDepotActionFlags)(ODATF_SERVICE_ONLY | ((order_flags & OF_STOP_IN_DEPOT) ? ODATFB_HALT : 0));
if (order_flags & OF_GOTO_NEAREST_DEPOT) odaf |= ODATFB_NEAREST_DEPOT;
OrderNonStopFlags onsf = (OrderNonStopFlags)((order_flags & OF_NON_STOP_INTERMEDIATE) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
if (order_flags & OF_GOTO_NEAREST_DEPOT) {
order.MakeGoToDepot(0, odtf, onsf, odaf);
} else {
/* Check explicitly if the order is to a station (for aircraft) or
@ -544,7 +544,7 @@ static int ScriptOrderPositionToRealOrderPosition(VehicleID vehicle_id, ScriptOr
* command has completed before we know the next bits to change we need to
* call the function multiple times. Each time it'll reduce the difference
* between the wanted and the current order.
* @param instance The AI we are doing the callback for.
* @param instance The script instance we are doing the callback for.
*/
static void _DoCommandReturnSetOrderFlags(class ScriptInstance *instance)
{
@ -576,28 +576,28 @@ static void _DoCommandReturnSetOrderFlags(class ScriptInstance *instance)
ScriptOrderFlags current = GetOrderFlags(vehicle_id, order_position);
EnforcePrecondition(false, (order_flags & AIOF_GOTO_NEAREST_DEPOT) == (current & AIOF_GOTO_NEAREST_DEPOT));
EnforcePrecondition(false, (order_flags & OF_GOTO_NEAREST_DEPOT) == (current & OF_GOTO_NEAREST_DEPOT));
if ((current & AIOF_NON_STOP_FLAGS) != (order_flags & AIOF_NON_STOP_FLAGS)) {
return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & AIOF_NON_STOP_FLAGS) << 4 | MOF_NON_STOP, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags);
if ((current & OF_NON_STOP_FLAGS) != (order_flags & OF_NON_STOP_FLAGS)) {
return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & OF_NON_STOP_FLAGS) << 4 | MOF_NON_STOP, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags);
}
switch (order->GetType()) {
case OT_GOTO_DEPOT:
if ((current & AIOF_DEPOT_FLAGS) != (order_flags & AIOF_DEPOT_FLAGS)) {
if ((current & OF_DEPOT_FLAGS) != (order_flags & OF_DEPOT_FLAGS)) {
uint data = DA_ALWAYS_GO;
if (order_flags & AIOF_SERVICE_IF_NEEDED) data = DA_SERVICE;
if (order_flags & AIOF_STOP_IN_DEPOT) data = DA_STOP;
if (order_flags & OF_SERVICE_IF_NEEDED) data = DA_SERVICE;
if (order_flags & OF_STOP_IN_DEPOT) data = DA_STOP;
return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (data << 4) | MOF_DEPOT_ACTION, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags);
}
break;
case OT_GOTO_STATION:
if ((current & AIOF_UNLOAD_FLAGS) != (order_flags & AIOF_UNLOAD_FLAGS)) {
return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & AIOF_UNLOAD_FLAGS) << 2 | MOF_UNLOAD, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags);
if ((current & OF_UNLOAD_FLAGS) != (order_flags & OF_UNLOAD_FLAGS)) {
return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & OF_UNLOAD_FLAGS) << 2 | MOF_UNLOAD, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags);
}
if ((current & AIOF_LOAD_FLAGS) != (order_flags & AIOF_LOAD_FLAGS)) {
return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & AIOF_LOAD_FLAGS) >> 1 | MOF_LOAD, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags);
if ((current & OF_LOAD_FLAGS) != (order_flags & OF_LOAD_FLAGS)) {
return ScriptObject::DoCommand(0, vehicle_id | (order_pos << 20), (order_flags & OF_LOAD_FLAGS) >> 1 | MOF_LOAD, CMD_MODIFY_ORDER, NULL, &::_DoCommandReturnSetOrderFlags);
}
break;

View File

@ -43,45 +43,45 @@ public:
*/
enum ScriptOrderFlags {
/** Just go to the station/depot, stop unload if possible and load if needed. */
AIOF_NONE = 0,
OF_NONE = 0,
/** Do not stop at the stations that are passed when going to the destination. Only for trains and road vehicles. */
AIOF_NON_STOP_INTERMEDIATE = 1 << 0,
OF_NON_STOP_INTERMEDIATE = 1 << 0,
/** Do not stop at the destionation station. Only for trains and road vehicles. */
AIOF_NON_STOP_DESTINATION = 1 << 1,
OF_NON_STOP_DESTINATION = 1 << 1,
/** Always unload the vehicle; only for stations. Cannot be set when AIOF_TRANSFER or AIOF_NO_UNLOAD is set. */
AIOF_UNLOAD = 1 << 2,
/** Transfer instead of deliver the goods; only for stations. Cannot be set when AIOF_UNLOAD or AIOF_NO_UNLOAD is set. */
AIOF_TRANSFER = 1 << 3,
/** Never unload the vehicle; only for stations. Cannot be set when AIOF_UNLOAD, AIOF_TRANSFER or AIOF_NO_LOAD is set. */
AIOF_NO_UNLOAD = 1 << 4,
/** Always unload the vehicle; only for stations. Cannot be set when OF_TRANSFER or OF_NO_UNLOAD is set. */
OF_UNLOAD = 1 << 2,
/** Transfer instead of deliver the goods; only for stations. Cannot be set when OF_UNLOAD or OF_NO_UNLOAD is set. */
OF_TRANSFER = 1 << 3,
/** Never unload the vehicle; only for stations. Cannot be set when OF_UNLOAD, OF_TRANSFER or OF_NO_LOAD is set. */
OF_NO_UNLOAD = 1 << 4,
/** Wait till the vehicle is fully loaded; only for stations. Cannot be set when AIOF_NO_LOAD is set. */
AIOF_FULL_LOAD = 2 << 5,
/** Wait till at least one cargo of the vehicle is fully loaded; only for stations. Cannot be set when AIOF_NO_LOAD is set. */
AIOF_FULL_LOAD_ANY = 3 << 5,
/** Do not load any cargo; only for stations. Cannot be set when AIOF_NO_UNLOAD, AIOF_FULL_LOAD or AIOF_FULL_LOAD_ANY is set. */
AIOF_NO_LOAD = 1 << 7,
/** Wt till the vehicle is fully loaded; only for stations. Cannot be set when OF_NO_LOAD is set. */
OF_FULL_LOAD = 2 << 5,
/** Wt till at least one cargo of the vehicle is fully loaded; only for stations. Cannot be set when OF_NO_LOAD is set. */
OF_FULL_LOAD_ANY = 3 << 5,
/** Do not load any cargo; only for stations. Cannot be set when OF_NO_UNLOAD, OF_FULL_LOAD or OF_FULL_LOAD_ANY is set. */
OF_NO_LOAD = 1 << 7,
/** Service the vehicle when needed, otherwise skip this order; only for depots. */
AIOF_SERVICE_IF_NEEDED = 1 << 2,
OF_SERVICE_IF_NEEDED = 1 << 2,
/** Stop in the depot instead of only go there for servicing; only for depots. */
AIOF_STOP_IN_DEPOT = 1 << 3,
OF_STOP_IN_DEPOT = 1 << 3,
/** Go to nearest depot. */
AIOF_GOTO_NEAREST_DEPOT = 1 << 8,
OF_GOTO_NEAREST_DEPOT = 1 << 8,
/** All flags related to non-stop settings. */
AIOF_NON_STOP_FLAGS = AIOF_NON_STOP_INTERMEDIATE | AIOF_NON_STOP_DESTINATION,
OF_NON_STOP_FLAGS = OF_NON_STOP_INTERMEDIATE | OF_NON_STOP_DESTINATION,
/** All flags related to unloading. */
AIOF_UNLOAD_FLAGS = AIOF_TRANSFER | AIOF_UNLOAD | AIOF_NO_UNLOAD,
OF_UNLOAD_FLAGS = OF_TRANSFER | OF_UNLOAD | OF_NO_UNLOAD,
/** All flags related to loading. */
AIOF_LOAD_FLAGS = AIOF_FULL_LOAD | AIOF_FULL_LOAD_ANY | AIOF_NO_LOAD,
OF_LOAD_FLAGS = OF_FULL_LOAD | OF_FULL_LOAD_ANY | OF_NO_LOAD,
/** All flags related to depots. */
AIOF_DEPOT_FLAGS = AIOF_SERVICE_IF_NEEDED | AIOF_STOP_IN_DEPOT | AIOF_GOTO_NEAREST_DEPOT,
OF_DEPOT_FLAGS = OF_SERVICE_IF_NEEDED | OF_STOP_IN_DEPOT | OF_GOTO_NEAREST_DEPOT,
/** For marking invalid order flags */
AIOF_INVALID = 0xFFFF,
OF_INVALID = 0xFFFF,
};
/**
@ -123,7 +123,7 @@ public:
* Index in the list of orders for a vehicle. The first order has index 0, the second
* order index 1, etc. The current order can be queried by using ORDER_CURRENT. Do not
* use ORDER_INVALID yourself, it's used as return value by for example ResolveOrderPosition.
* @note Automatic orders are hidden from AIs, so OrderPosition 0 will always be the first
* @note Automatic orders are hidden from scripts, so OrderPosition 0 will always be the first
* manual order.
*/
enum OrderPosition {
@ -510,7 +510,7 @@ public:
* @param order_flags The new flags given to the order.
* @pre IsValidVehicleOrder(vehicle_id, order_position).
* @pre AreOrderFlagsValid(GetOrderDestination(vehicle_id, order_position), order_flags).
* @pre (order_flags & AIOF_GOTO_NEAREST_DEPOT) == (GetOrderFlags(vehicle_id, order_position) & AIOF_GOTO_NEAREST_DEPOT).
* @pre (order_flags & OF_GOTO_NEAREST_DEPOT) == (GetOrderFlags(vehicle_id, order_position) & OF_GOTO_NEAREST_DEPOT).
* @exception ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY
* @return True if and only if the order was changed.
* @api -game

View File

@ -31,9 +31,9 @@ ScriptTestMode::ScriptTestMode()
ScriptTestMode::~ScriptTestMode()
{
if (this->GetDoCommandModeInstance() != this) {
/* Ignore this error if the AI already died. */
/* Ignore this error if the script already died. */
if (!ScriptObject::GetActiveInstance()->IsDead()) {
throw Script_FatalError("AITestmode object was removed while it was not the latest AI*Mode object created.");
throw Script_FatalError("Testmode object was removed while it was not the latest *Mode object created.");
}
}
this->SetDoCommandMode(this->last_mode, this->last_instance);

View File

@ -7,7 +7,7 @@
* 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_testmode.hpp Switch the AI to Test Mode. */
/** @file script_testmode.hpp Switch the script instance to Test Mode. */
#ifndef SCRIPT_TESTMODE_HPP
#define SCRIPT_TESTMODE_HPP

View File

@ -47,7 +47,7 @@
/**
* Helper function to connect a just built tunnel to nearby roads.
* @param instance The AI we have to built the road for.
* @param instance The script instance we have to built the road for.
*/
static void _DoCommandReturnBuildTunnel2(class ScriptInstance *instance)
{
@ -63,7 +63,7 @@ static void _DoCommandReturnBuildTunnel2(class ScriptInstance *instance)
/**
* Helper function to connect a just built tunnel to nearby roads.
* @param instance The AI we have to built the road for.
* @param instance The script instance we have to built the road for.
*/
static void _DoCommandReturnBuildTunnel1(class ScriptInstance *instance)
{

View File

@ -95,7 +95,7 @@ typedef uint16 GoalID; ///< The ID of a goal.
typedef uint16 GroupID; ///< The ID of a group.
typedef uint16 IndustryID; ///< The ID of an industry.
typedef uint8 IndustryType; ///< The ID of an industry-type.
typedef OverflowSafeInt64 Money; ///< Money, stored in a 32bit/64bit safe way. For AIs money is always in pounds.
typedef OverflowSafeInt64 Money; ///< Money, stored in a 32bit/64bit safe way. For scripts money is always in pounds.
typedef uint16 SignID; ///< The ID of a sign.
typedef uint16 StationID; ///< The ID of a station.
typedef uint16 StringID; ///< The ID of a string.
@ -105,7 +105,7 @@ typedef uint16 TownID; ///< The ID of a town.
typedef uint32 VehicleID; ///< The ID of a vehicle.
/* Types we defined ourself, as the OpenTTD core doesn't have them (yet) */
typedef uint ScriptErrorType; ///< The types of errors inside the NoAI framework.
typedef uint ScriptErrorType;///< The types of errors inside the script framework.
typedef BridgeType BridgeID; ///< The ID of a bridge.
#endif /* SCRIPT_TYPES_HPP */