(svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
[NoAI] -Documentation: fixed the order of functions: SetNN before GetNN, Build after Set/Get, Remove after Build. This makes reading the docs more easy
[NoAI] -Documentation: Removed unneeded comments which were direct copy/paste all over the place
[NoAI] -Fix: missing $Id$ tags
--- a/src/ai/api/ai_abstractlist.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_abstractlist.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,7 @@
/* $Id$ */
-/** @file ai_abstractlist.hpp a linked list which can keep item/value pairs */
+/** @file ai_abstractlist.hpp A list which can keep item/value pairs, which you can walk. */
+/** @defgroup AIList Classes that create a list of items. */
#ifndef AI_ABSTRACTLIST_HPP
#define AI_ABSTRACTLIST_HPP
@@ -12,10 +13,12 @@
class AIAbstractListSorter;
/**
- * Class that creates a linked list which can keep item/value pairs.
+ * Class that creates a list which can keep item/value pairs, which you can walk.
*/
class AIAbstractList : public AIObject {
public:
+ static const char *GetClassName() { return "AIAbstractList"; }
+
/** Type of sorter */
enum SorterType {
SORT_BY_VALUE,
@@ -51,19 +54,7 @@
void RemoveItem(int32 item);
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
- static const char *GetClassName() { return "AIAbstractList"; }
-
- /**
- * Constructor of the AIAbstractList.
- */
AIAbstractList();
-
- /**
- * Destructor of the AIAbstractList.
- */
~AIAbstractList();
/**
--- a/src/ai/api/ai_accounting.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_accounting.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_accounting.hpp everything to handle AI accounting things */
+/** @file ai_accounting.hpp Everything to handle AI accounting things. */
#ifndef AI_ACCOUNTING_HPP
#define AI_ACCOUNTING_HPP
@@ -8,7 +8,8 @@
#include "ai_object.hpp"
/**
- * Class that handles all AI accounting related functions.
+ * Class that keeps track of the costs, so you can request how much a block of
+ * commands did cost in total. Works in both Execute as in Test mode.
* Example:
* {
* local costs = AIAccounting();
@@ -18,12 +19,7 @@
* }
*/
class AIAccounting : public AIObject {
-private:
- int32 last_costs;
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AIAccounting"; }
/**
@@ -49,6 +45,9 @@
* Reset the costs to zero.
*/
void ResetCosts();
+
+private:
+ int32 last_costs;
};
#endif /* AI_ACCOUNTING_HPP */
--- a/src/ai/api/ai_airport.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_airport.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_airport.hpp Everything to query and build airports */
+/** @file ai_airport.hpp Everything to query and build airports. */
#ifndef AI_AIRPORT_HPP
#define AI_AIRPORT_HPP
@@ -12,6 +12,8 @@
*/
class AIAirport : public AIObject {
public:
+ static const char *GetClassName() { return "AIAirport"; }
+
/**
* The types of airports available in the game.
*/
@@ -29,11 +31,6 @@
};
/**
- * The name of the class, needed by several sub-processes.
- */
- static const char *GetClassName() { return "AIAirport"; }
-
- /**
* Checks whether the given tile is actually a tile with a hangar.
* @param tile the tile to check.
* @pre AIMap::IsValidTile(tile).
@@ -77,6 +74,14 @@
static int32 GetAirportCoverageRadius(AirportType type);
/**
+ * Get the first hanger tile of the airport.
+ * @param tile any tile of the airport.
+ * @pre AIMap::IsValidTile(tile).
+ * @return the first hanger tile of the airport.
+ */
+ static TileIndex GetHangarOfAirport(TileIndex tile);
+
+ /**
* Builds a airport with tile at the topleft corner.
* @param tile the topleft corner of the airport.
* @param type the type of airport to build.
@@ -92,14 +97,6 @@
* @return whether the airport has been/can be removed or not.
*/
static bool RemoveAirport(TileIndex tile);
-
- /**
- * Get the first hanger tile of the airport.
- * @param tile any tile of the airport.
- * @pre AIMap::IsValidTile(tile).
- * @return the first hanger tile of the airport.
- */
- static TileIndex GetHangarOfAirport(TileIndex tile);
};
#endif /* AI_AIRPORT_HPP */
--- a/src/ai/api/ai_airport.hpp.sq Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_airport.hpp.sq Mon Mar 31 06:32:27 2008 +0000
@@ -35,9 +35,9 @@
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportWidth, "GetAirportWidth", 2, "xi");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportHeight, "GetAirportHeight", 2, "xi");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportCoverageRadius, "GetAirportCoverageRadius", 2, "xi");
+ SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetHangarOfAirport, "GetHangarOfAirport", 2, "xi");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::BuildAirport, "BuildAirport", 3, "xii");
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::RemoveAirport, "RemoveAirport", 2, "xi");
- SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetHangarOfAirport, "GetHangarOfAirport", 2, "xi");
SQAIAirport.PostRegister(engine);
}
--- a/src/ai/api/ai_base.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_base.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_base.hpp declaration of class for AIBase class */
+/** @file ai_base.hpp Everything to query basic things. */
#ifndef AI_BASE_HPP
#define AI_BASE_HPP
@@ -20,9 +20,6 @@
*/
class AIBase : public AIObject {
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AIBase"; }
/**
--- a/src/ai/api/ai_bridge.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_bridge.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_bridge.hpp Everything to query and build bridges */
+/** @file ai_bridge.hpp Everything to query and build bridges. */
#ifndef AI_BRIDGE_HPP
#define AI_BRIDGE_HPP
@@ -9,6 +9,7 @@
#include "ai_vehicle.hpp"
#include "../../bridge.h"
+/** In OpenTTD Core 'BridgeID' is called 'BridgeType', so map it to make this API more logic. */
typedef BridgeType BridgeID;
/**
@@ -16,9 +17,6 @@
*/
class AIBridge : public AIObject {
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AIBridge"; }
/**
@@ -37,30 +35,6 @@
static bool IsBridgeTile(TileIndex tile);
/**
- * Build a bridge from one tile to the other.
- * @param vehicle_type The vehicle-type of bridge to build.
- * @param bridge_id The bridge-type to build.
- * @param start Where to start the bridge.
- * @param end Where to end the bridge.
- * @pre AIMap::IsValidTile(start).
- * @pre AIMap::IsValidTile(end).
- * @pre start and end are in a straight line, i.e.
- * AIMap::GetTileX(start) == AIMap::GetTileX(end) or
- * AIMap::GetTileY(start) == AIMap::GetTileY(end).
- * @pre vehicleType is either AIVehicle::VEHICLE_RAIL or AIVEHICLE::VEHICLE_ROAD.
- * @return Whether the bridge has been/can be build or not.
- */
- static bool BuildBridge(AIVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end);
-
- /**
- * Removes a bridge, by executing it on either the start or end tile.
- * @param tile An end or start tile of the bridge.
- * @pre AIMap::IsValidTile(tile).
- * @return Whether the bridge has been/can be removed or not.
- */
- static bool RemoveBridge(TileIndex tile);
-
- /**
* Get the name of a bridge.
* @param bridge_id The bridge to get the name of.
* @pre IsValidBridge(bridge_id).
@@ -110,6 +84,30 @@
* @returns The year of availability the bridge has.
*/
static int32 GetYearAvailable(BridgeID bridge_id);
+
+ /**
+ * Build a bridge from one tile to the other.
+ * @param vehicle_type The vehicle-type of bridge to build.
+ * @param bridge_id The bridge-type to build.
+ * @param start Where to start the bridge.
+ * @param end Where to end the bridge.
+ * @pre AIMap::IsValidTile(start).
+ * @pre AIMap::IsValidTile(end).
+ * @pre start and end are in a straight line, i.e.
+ * AIMap::GetTileX(start) == AIMap::GetTileX(end) or
+ * AIMap::GetTileY(start) == AIMap::GetTileY(end).
+ * @pre vehicleType is either AIVehicle::VEHICLE_RAIL or AIVEHICLE::VEHICLE_ROAD.
+ * @return Whether the bridge has been/can be build or not.
+ */
+ static bool BuildBridge(AIVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end);
+
+ /**
+ * Removes a bridge, by executing it on either the start or end tile.
+ * @param tile An end or start tile of the bridge.
+ * @pre AIMap::IsValidTile(tile).
+ * @return Whether the bridge has been/can be removed or not.
+ */
+ static bool RemoveBridge(TileIndex tile);
};
#endif /* AI_BRIDGE_HPP */
--- a/src/ai/api/ai_bridge.hpp.sq Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_bridge.hpp.sq Mon Mar 31 06:32:27 2008 +0000
@@ -17,14 +17,14 @@
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetClassName, "GetClassName", 1, "x");
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::IsValidBridge, "IsValidBridge", 2, "xi");
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::IsBridgeTile, "IsBridgeTile", 2, "xi");
- SQAIBridge.DefSQStaticMethod(engine, &AIBridge::BuildBridge, "BuildBridge", 5, "xiiii");
- SQAIBridge.DefSQStaticMethod(engine, &AIBridge::RemoveBridge, "RemoveBridge", 2, "xi");
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetName, "GetName", 2, "xi");
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetMaxSpeed, "GetMaxSpeed", 2, "xi");
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetPrice, "GetPrice", 3, "xii");
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetMaxLength, "GetMaxLength", 2, "xi");
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetMinLength, "GetMinLength", 2, "xi");
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetYearAvailable, "GetYearAvailable", 2, "xi");
+ SQAIBridge.DefSQStaticMethod(engine, &AIBridge::BuildBridge, "BuildBridge", 5, "xiiii");
+ SQAIBridge.DefSQStaticMethod(engine, &AIBridge::RemoveBridge, "RemoveBridge", 2, "xi");
SQAIBridge.PostRegister(engine);
}
--- a/src/ai/api/ai_bridgelist.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_bridgelist.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,7 +1,6 @@
/* $Id$ */
-/** @file ai_bridgelist.hpp list all the bridges */
-/** @defgroup AIBridgeList AIBridgeList - Valuators and lists working on/with AIBridgeList */
+/** @file ai_bridgelist.hpp List all the bridges. */
#ifndef AI_BRIDGELIST_HPP
#define AI_BRIDGELIST_HPP
@@ -10,7 +9,7 @@
/**
* Create a list of bridges.
- * @ingroup AIBridgeList
+ * @ingroup AIList
*/
class AIBridgeList : public AIAbstractList {
public:
@@ -20,7 +19,7 @@
/**
* Create a list of bridges that can be built on a specific length.
- * @ingroup AIBridgeList
+ * @ingroup AIList
*/
class AIBridgeList_Length : public AIAbstractList {
public:
--- a/src/ai/api/ai_cargo.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_cargo.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_cargo.hpp Everything to query about cargos */
+/** @file ai_cargo.hpp Everything to query cargos. */
#ifndef AI_CARGO_HPP
#define AI_CARGO_HPP
@@ -12,9 +12,6 @@
*/
class AICargo : public AIObject {
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AICargo"; }
/**
--- a/src/ai/api/ai_cargolist.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_cargolist.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,5 +1,6 @@
-/** @file ai_cargolist.hpp list all the cargos */
-/** @defgroup AICargoList AICargoList - Valuators and lists working on/with AICargoList */
+/* $Id$ */
+
+/** @file ai_cargolist.hpp List all the cargos */
#ifndef AI_CARGOLIST_HPP
#define AI_CARGOLIST_HPP
@@ -8,7 +9,7 @@
/**
* Creates a list of cargos that can be produced in the current game.
- * @ingroup AICargoList
+ * @ingroup AIList
*/
class AICargoList : public AIAbstractList {
public:
--- a/src/ai/api/ai_company.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_company.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_company.hpp Everything to query a company's financials and statistics */
+/** @file ai_company.hpp Everything to query a company's financials and statistics or build company related buildings. */
#ifndef AI_COMPANY_HPP
#define AI_COMPANY_HPP
@@ -12,9 +12,6 @@
*/
class AICompany : public AIObject {
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AICompany"; }
/** Different constants related to companies */
@@ -71,20 +68,24 @@
static char *GetPresidentName(CompanyIndex company);
/**
- * Gets the current value of the given company.
- * @param company the company to get the company value of.
- * @pre ResolveCompanyIndex(company) != INVALID_COMPANY
- * @return the current value of the given company.
+ * Sets the amount to loan.
+ * @param loan the amount to loan (multiplier of GetLoanInterval()).
+ * @pre loan must be non-negative.
+ * @pre GetLoanInterval must be a multiplier of loan.
+ * @pre loan must be below GetMaxLoan().
+ * @pre loan - GetLoanAmount() + GetBankBalance() must be non-negative.
+ * @return true if the loan could be set to your requested amount.
*/
- static int32 GetCompanyValue(CompanyIndex company);
+ static bool SetLoanAmount(int32 loan);
/**
- * Gets the bank balance. In other words, the amount of money the given company can spent.
- * @param company the company to get the bank balance of.
- * @pre ResolveCompanyIndex(company) != INVALID_COMPANY
- * @return the actual bank balance.
+ * Sets the minimum amount to loan, i.e. the given amount of loan rounded up.
+ * @param loan the amount to loan (any positive number).
+ * @pre loan must be non-negative.
+ * @pre loan must be below GetMaxLoan().
+ * @return true if we could allocate a minimum of "loan" loan.
*/
- static int32 GetBankBalance(CompanyIndex company);
+ static bool SetMinimumLoanAmount(int32 loan);
/**
* Gets the amount your company have loaned.
@@ -110,24 +111,20 @@
static int32 GetLoanInterval();
/**
- * Sets the amount to loan.
- * @param loan the amount to loan (multiplier of GetLoanInterval()).
- * @pre loan must be non-negative.
- * @pre GetLoanInterval must be a multiplier of loan.
- * @pre loan must be below GetMaxLoan().
- * @pre loan - GetLoanAmount() + GetBankBalance() must be non-negative.
- * @return true if the loan could be set to your requested amount.
+ * Gets the current value of the given company.
+ * @param company the company to get the company value of.
+ * @pre ResolveCompanyIndex(company) != INVALID_COMPANY
+ * @return the current value of the given company.
*/
- static bool SetLoanAmount(int32 loan);
+ static int32 GetCompanyValue(CompanyIndex company);
/**
- * Sets the minimum amount to loan, i.e. the given amount of loan rounded up.
- * @param loan the amount to loan (any positive number).
- * @pre loan must be non-negative.
- * @pre loan must be below GetMaxLoan().
- * @return true if we could allocate a minimum of "loan" loan.
+ * Gets the bank balance. In other words, the amount of money the given company can spent.
+ * @param company the company to get the bank balance of.
+ * @pre ResolveCompanyIndex(company) != INVALID_COMPANY
+ * @return the actual bank balance.
*/
- static bool SetMinimumLoanAmount(int32 loan);
+ static int32 GetBankBalance(CompanyIndex company);
/**
* Build your company's HQ on the given tile.
--- a/src/ai/api/ai_company.hpp.sq Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_company.hpp.sq Mon Mar 31 06:32:27 2008 +0000
@@ -29,13 +29,13 @@
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetCompanyName, "GetCompanyName", 2, "xi");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetPresidentName, "SetPresidentName", 2, "xs");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetPresidentName, "GetPresidentName", 2, "xi");
- SQAICompany.DefSQStaticMethod(engine, &AICompany::GetCompanyValue, "GetCompanyValue", 2, "xi");
- SQAICompany.DefSQStaticMethod(engine, &AICompany::GetBankBalance, "GetBankBalance", 2, "xi");
+ SQAICompany.DefSQStaticMethod(engine, &AICompany::SetLoanAmount, "SetLoanAmount", 2, "xi");
+ SQAICompany.DefSQStaticMethod(engine, &AICompany::SetMinimumLoanAmount, "SetMinimumLoanAmount", 2, "xi");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetLoanAmount, "GetLoanAmount", 1, "x");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetMaxLoanAmount, "GetMaxLoanAmount", 1, "x");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetLoanInterval, "GetLoanInterval", 1, "x");
- SQAICompany.DefSQStaticMethod(engine, &AICompany::SetLoanAmount, "SetLoanAmount", 2, "xi");
- SQAICompany.DefSQStaticMethod(engine, &AICompany::SetMinimumLoanAmount, "SetMinimumLoanAmount", 2, "xi");
+ SQAICompany.DefSQStaticMethod(engine, &AICompany::GetCompanyValue, "GetCompanyValue", 2, "xi");
+ SQAICompany.DefSQStaticMethod(engine, &AICompany::GetBankBalance, "GetBankBalance", 2, "xi");
SQAICompany.DefSQStaticMethod(engine, &AICompany::BuildCompanyHQ, "BuildCompanyHQ", 2, "xi");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetCompanyHQ, "GetCompanyHQ", 2, "xi");
--- a/src/ai/api/ai_controller.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_controller.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_controller.hpp declaration of class for AIController class */
+/** @file ai_controller.hpp The controller of the AI. */
#ifndef AI_CONTROLLER_HPP
#define AI_CONTROLLER_HPP
--- a/src/ai/api/ai_date.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_date.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_date.hpp declaration of class for AIDate class */
+/** @file ai_date.hpp Everything to query and manipulate date related information. */
#ifndef AI_DATE_HPP
#define AI_DATE_HPP
@@ -19,9 +19,6 @@
*/
class AIDate : public AIObject {
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AIDate"; }
/**
--- a/src/ai/api/ai_engine.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_engine.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_engine.hpp Everything to query and build engines */
+/** @file ai_engine.hpp Everything to query and build engines. */
#ifndef AI_ENGINE_HPP
#define AI_ENGINE_HPP
@@ -13,9 +13,6 @@
*/
class AIEngine : public AIObject {
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AIEngine"; }
/**
--- a/src/ai/api/ai_enginelist.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_enginelist.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,7 +1,6 @@
/* $Id$ */
-/** @file ai_enginelist.hpp list all the engines */
-/** @defgroup AIEngineList AIEngineList - Valuators and lists working on/with AIEngineList */
+/** @file ai_enginelist.hpp List all the engines. */
#ifndef AI_ENGINELIST_HPP
#define AI_ENGINELIST_HPP
@@ -11,7 +10,7 @@
/**
* Create a list of engines based on a vehicle type.
- * @ingroup AIEngineList
+ * @ingroup AIList
*/
class AIEngineList : public AIAbstractList {
public:
--- a/src/ai/api/ai_event.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_event.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_event.hpp Everything to handle events from the game */
+/** @file ai_event.hpp Everything to handle events from the game. */
#ifndef AI_EVENT_HPP
#define AI_EVENT_HPP
@@ -8,12 +8,14 @@
#include "ai_object.hpp"
/**
- * A single event that can be triggered by the game.
+ * Class that handles all event related functions.
* You can lookup the type, and than convert it to the real event-class.
* That way you can request more detailed information about the event.
*/
class AIEvent : public AIObject {
public:
+ static const char *GetClassName() { return "AIEvent"; }
+
/**
* The type of event. Needed to lookup the detailed class.
*/
@@ -36,11 +38,6 @@
*/
AIEventType GetEventType() { return this->type; }
- /**
- * The name of the class, needed by several sub-processes.
- */
- static const char *GetClassName() { return "AIEvent"; }
-
protected:
/**
* The type of this event.
--- a/src/ai/api/ai_event_types.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_event_types.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_event_types.hpp The detailed types of all events */
+/** @file ai_event_types.hpp The detailed types of all events. */
#ifndef AI_EVENT_TYPES_HPP
#define AI_EVENT_TYPES_HPP
@@ -11,8 +11,8 @@
#include "ai_industry.hpp"
/**
- * A simple test event, to see if the event system is working. Triggered via
- * AIEventController::Test();
+ * Event Test: a simple test event, to see if the event system is working.
+ * Triggered via AIEventController::Test();
*/
class AIEventTest : public AIEvent {
public:
@@ -41,7 +41,7 @@
};
/**
- * A vehicle crashed, and because of that this event is triggered.
+ * Event Vehicle Crash, indicating a vehicle of yours is crashed.
* It contains both the crash site as the vehicle crashed. It has a nice
* helper that creates a new vehicle in a depot with the same type
* and orders as the crashed one. In case the vehicle type isn't available
@@ -89,9 +89,10 @@
};
/**
- * A subsidiary is offered. You can get the type of cargo the subsidiary is
- * for, if it is between towns or industry, and from where to where (which
- * is either in TownID or IndustryID).
+ * Event Subsidiary Offered, indicating someone offered a subsidiary.
+ * You can get the type of cargo the subsidiary is for, if it is between
+ * towns or industry, and from where to where (which is either in TownID
+ * or IndustryID).
*/
class AIEventSubsidiaryOffer : public AIEvent {
public:
--- a/src/ai/api/ai_execmode.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_execmode.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_execmode.hpp class to switch the AI to Execute mode */
+/** @file ai_execmode.hpp Switch the AI to Execute Mode. */
#ifndef AI_EXECMODE_HPP
#define AI_EXECMODE_HPP
@@ -8,13 +8,16 @@
#include "ai_object.hpp"
/**
- * Class to switch current mode to Execute mode.
+ * Class to switch current mode to Execute Mode.
* If you create an instance of this class, the mode will be switched to
* Execute. The original mode is stored and recovered from when ever the
* instance is destroyed.
* In Execute mode all commands you do are executed for real.
*/
class AIExecMode : public AIObject {
+public:
+ static const char *GetClassName() { return "AIExecMode"; }
+
private:
AIModeProc *last_mode;
AIObject *last_instance;
@@ -27,11 +30,6 @@
public:
/**
- * The name of the class, needed by several sub-processes.
- */
- static const char *GetClassName() { return "AIExecMode"; }
-
- /**
* Creating instance of this class switches the build mode to Execute.
* @note when the instance is destroyed, he restores the mode that was
* current when the instance was created!
--- a/src/ai/api/ai_industry.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_industry.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_industry.hpp Everything to query about industries */
+/** @file ai_industry.hpp Everything to query and build industries. */
#ifndef AI_INDUSTRY_HPP
#define AI_INDUSTRY_HPP
@@ -13,9 +13,6 @@
*/
class AIIndustry : public AIObject {
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AIIndustry"; }
/**
--- a/src/ai/api/ai_industrylist.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_industrylist.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,7 +1,6 @@
/* $Id$ */
-/** @file ai_industrylist.hpp list all the industries */
-/** @defgroup AIIndustryList AIIndustryList - Valuators and lists working on/with AIIndustryList */
+/** @file ai_industrylist.hpp List all the industries. */
#ifndef AI_INDUSTRYLIST_HPP
#define AI_INDUSTRYLIST_HPP
@@ -10,7 +9,7 @@
/**
* Creates a list of industries that are currently on the map.
- * @ingroup AIIndustryList
+ * @ingroup AIList
*/
class AIIndustryList : public AIAbstractList {
public:
@@ -20,7 +19,7 @@
/**
* Creates a list of industries that accepts a given cargo.
- * @ingroup AIIndustryList
+ * @ingroup AIList
*/
class AIIndustryList_CargoAccepting : public AIAbstractList {
public:
@@ -35,7 +34,7 @@
/**
* Creates a list of industries that can produce a given cargo.
* @note It also contains industries that currently produces 0 units of the cargo.
- * @ingroup AIIndustryList
+ * @ingroup AIList
*/
class AIIndustryList_CargoProducing : public AIAbstractList {
public:
--- a/src/ai/api/ai_list.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_list.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,7 +1,6 @@
/* $Id$ */
-/** @file ai_list.hpp a simple list which you can manipulate */
-/** @defgroup AIList AIList - Valuators and lists working on/with AIList */
+/** @file ai_list.hpp List custom entries. */
#ifndef AI_LIST_HPP
#define AI_LIST_HPP
--- a/src/ai/api/ai_map.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_map.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_map.hpp Everything to query map metadata */
+/** @file ai_map.hpp Everything to query and manipulate map metadata. */
#ifndef AI_MAP_HPP
#define AI_MAP_HPP
@@ -12,9 +12,6 @@
*/
class AIMap : public AIObject {
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AIMap"; }
/**
--- a/src/ai/api/ai_marine.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_marine.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_marine.hpp Everything to query and build marine */
+/** @file ai_marine.hpp Everything to query and build marine. */
#ifndef AI_MARINE_HPP
#define AI_MARINE_HPP
@@ -12,9 +12,6 @@
*/
class AIMarine : public AIObject {
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AIMarine"; }
/**
--- a/src/ai/api/ai_object.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_object.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_object.hpp declaration of class for AIObject class */
+/** @file ai_object.hpp Main object, on which all objects depend. */
#ifndef AI_OBJECT_HPP
#define AI_OBJECT_HPP
@@ -12,7 +12,7 @@
#ifndef _SQUIRREL_H_
/* Life becomes easier when we can tell about a function it needs the VM, but
* without really including 'squirrel.h'. */
-typedef void* HSQUIRRELVM;
+typedef void *HSQUIRRELVM;
typedef int SQInteger;
#endif
--- a/src/ai/api/ai_order.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_order.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_order.hpp Everything to query and build Orders */
+/** @file ai_order.hpp Everything to query and build orders. */
#ifndef AI_ORDER_HPP
#define AI_ORDER_HPP
@@ -12,9 +12,6 @@
*/
class AIOrder : public AIObject {
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AIOrder"; }
/**
--- a/src/ai/api/ai_road.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_road.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_road.hpp Everything to query and build roads */
+/** @file ai_road.hpp Everything to query and build roads. */
#ifndef AI_ROAD_HPP
#define AI_ROAD_HPP
@@ -12,9 +12,6 @@
*/
class AIRoad : public AIObject {
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AIRoad"; }
/**
--- a/src/ai/api/ai_settings.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_settings.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_settings.hpp everything to change AI settings */
+/** @file ai_settings.hpp Everything to change AI settings. */
#ifndef AI_SETTINGS_HPP
#define AI_SETTINGS_HPP
@@ -12,9 +12,6 @@
*/
class AISettings : public AIObject {
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AISettings"; }
/**
--- a/src/ai/api/ai_sign.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_sign.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_sign.hpp Everything to query and build signs */
+/** @file ai_sign.hpp Everything to query and build signs. */
#ifndef AI_SIGN_HPP
#define AI_SIGN_HPP
@@ -12,9 +12,6 @@
*/
class AISign : public AIObject {
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AISign"; }
/**
@@ -58,14 +55,6 @@
static TileIndex GetLocation(SignID sign_id);
/**
- * Removes a sign from the map.
- * @param sign_id the sign to remove.
- * @pre sign_id has to be valid (use IsValidSign()).
- * @return true if and only if the sign has been removed.
- */
- static bool RemoveSign(SignID sign_id);
-
- /**
* Builds a sign on the map.
* @param location the place to build the sign.
* @param text the text to place on the sign.
@@ -76,6 +65,14 @@
* failure.
*/
static SignID BuildSign(TileIndex location, const char *text);
+
+ /**
+ * Removes a sign from the map.
+ * @param sign_id the sign to remove.
+ * @pre sign_id has to be valid (use IsValidSign()).
+ * @return true if and only if the sign has been removed.
+ */
+ static bool RemoveSign(SignID sign_id);
};
#endif /* AI_SIGN_HPP */
--- a/src/ai/api/ai_sign.hpp.sq Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_sign.hpp.sq Mon Mar 31 06:32:27 2008 +0000
@@ -20,8 +20,8 @@
SQAISign.DefSQStaticMethod(engine, &AISign::IsValidSign, "IsValidSign", 2, "xi");
SQAISign.DefSQStaticMethod(engine, &AISign::GetText, "GetText", 2, "xi");
SQAISign.DefSQStaticMethod(engine, &AISign::GetLocation, "GetLocation", 2, "xi");
+ SQAISign.DefSQStaticMethod(engine, &AISign::BuildSign, "BuildSign", 3, "xis");
SQAISign.DefSQStaticMethod(engine, &AISign::RemoveSign, "RemoveSign", 2, "xi");
- SQAISign.DefSQStaticMethod(engine, &AISign::BuildSign, "BuildSign", 3, "xis");
SQAISign.PostRegister(engine);
}
--- a/src/ai/api/ai_station.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_station.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_station.hpp Everything to query and build stations */
+/** @file ai_station.hpp Everything to query and build stations. */
#ifndef AI_STATION_HPP
#define AI_STATION_HPP
@@ -12,6 +12,8 @@
*/
class AIStation : public AIObject {
public:
+ static const char *GetClassName() { return "AIStation"; }
+
/**
* Type of stations known in the game.
*/
@@ -25,11 +27,6 @@
};
/**
- * The name of the class, needed by several sub-processes.
- */
- static const char *GetClassName() { return "AIStation"; }
-
- /**
* Checks whether the given station is valid and owned by you.
* @param station_id the station to check.
* @return true if and only if the station is valid.
--- a/src/ai/api/ai_stationlist.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_stationlist.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,7 +1,6 @@
/* $Id$ */
-/** @file ai_stationlist.hpp list all the stations (you own) */
-/** @defgroup AIStationList AIStationList - Valuators and lists working on/with AIStationList */
+/** @file ai_stationlist.hpp List all the stations (you own). */
#ifndef AI_STATIONLIST_HPP
#define AI_STATIONLIST_HPP
@@ -11,7 +10,7 @@
/**
* Creates a list of stations of which you are the owner.
- * @ingroup AIStationList
+ * @ingroup AIList
*/
class AIStationList : public AIAbstractList {
public:
@@ -25,7 +24,7 @@
/**
* Creates a list of stations which the vehicle has in its orders.
- * @ingroup AIStationList
+ * @ingroup AIList
*/
class AIStationList_Vehicle : public AIAbstractList {
public:
--- a/src/ai/api/ai_testmode.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_testmode.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_testmode.hpp class to switch the AI to Testing mode */
+/** @file ai_testmode.hpp Switch the AI to Test Mode. */
#ifndef AI_TESTMODE_HPP
#define AI_TESTMODE_HPP
@@ -8,7 +8,7 @@
#include "ai_object.hpp"
/**
- * Class to switch current mode to Testing mode.
+ * Class to switch current mode to Test Mode.
* If you create an instance of this class, the mode will be switched to
* Testing. The original mode is stored and recovered from when ever the
* instance is destroyed.
@@ -17,6 +17,9 @@
* the cost would be.
*/
class AITestMode : public AIObject {
+public:
+ static const char *GetClassName() { return "AITestMode"; }
+
private:
AIModeProc *last_mode;
AIObject *last_instance;
@@ -29,11 +32,6 @@
public:
/**
- * The name of the class, needed by several sub-processes.
- */
- static const char *GetClassName() { return "AITestMode"; }
-
- /**
* Creating instance of this class switches the build mode to Testing.
* @note when the instance is destroyed, he restores the mode that was
* current when the instance was created!
--- a/src/ai/api/ai_tile.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_tile.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_tile.hpp tile related functions */
+/** @file ai_tile.hpp Everything to query and manipulate tiles. */
#ifndef AI_TILE_HPP
#define AI_TILE_HPP
@@ -12,6 +12,8 @@
*/
class AITile : public AIObject {
public:
+ static const char *GetClassName() { return "AITile"; }
+
/**
* Enumeration for the slope-type (from slopes.h).
*
@@ -45,11 +47,6 @@
};
/**
- * The name of the class, needed by several sub-processes.
- */
- static const char *GetClassName() { return "AITile"; }
-
- /**
* Check if this tile is buildable (e.g.: no things on it that needs removing).
* @note Road and rail are considered buildable.
* @param tile the tile to check on.
--- a/src/ai/api/ai_tilelist.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_tilelist.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,7 +1,6 @@
/* $Id$ */
-/** @file ai_tilelist.hpp a simple tilelist which you can manipulate */
-/** @defgroup AITileList AITileList - Valuators and lists working on/with AITileList */
+/** @file ai_tilelist.hpp List tiles. */
#ifndef AI_TILELIST_HPP
#define AI_TILELIST_HPP
@@ -11,7 +10,7 @@
/**
* Creates an empty list, in which you can add tiles.
- * @ingroup AITileList
+ * @ingroup AIList
*/
class AITileList : public AIAbstractList {
public:
@@ -63,7 +62,7 @@
/**
* Creates a list of tiles that will accept cargo for the given industry.
* @note If a simular industry is close, it might happen that this industry receives the cargo.
- * @ingroup AITileList
+ * @ingroup AIList
*/
class AITileList_IndustryAccepting : public AITileList {
public:
@@ -79,7 +78,7 @@
/**
* Creates a list of tiles which the industry checks to see if a station is
* there to receive cargo produced by this industry.
- * @ingroup AITileList
+ * @ingroup AIList
*/
class AITileList_IndustryProducing : public AITileList {
public:
--- a/src/ai/api/ai_town.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_town.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_town.hpp Everything to query towns */
+/** @file ai_town.hpp Everything to query towns. */
#ifndef AI_TOWN_HPP
#define AI_TOWN_HPP
@@ -13,9 +13,6 @@
*/
class AITown : public AIObject {
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AITown"; }
/**
--- a/src/ai/api/ai_townlist.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_townlist.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,7 +1,6 @@
/* $Id$ */
-/** @file ai_townlist.hpp list all the towns */
-/** @defgroup AITownList AITownList - Valuators and lists working on/with AITownList */
+/** @file ai_townlist.hpp List all the towns. */
#ifndef AI_TOWNLIST_HPP
#define AI_TOWNLIST_HPP
@@ -10,7 +9,7 @@
/**
* Creates a list of towns that are currently on the map.
- * @ingroup AITownList
+ * @ingroup AIList
*/
class AITownList : public AIAbstractList {
public:
--- a/src/ai/api/ai_transactionmode.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_transactionmode.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_transactionmode.hpp class to switch the AI to Transaction mode */
+/** @file ai_transactionmode.hpp Switch the AI to Transaction Mode. */
#ifndef AI_TRANSACTIONMODE_HPP
#define AI_TRANSACTIONMODE_HPP
@@ -21,6 +21,9 @@
* built things.
*/
class AITransactionMode : public AIObject {
+public:
+ static const char *GetClassName() { return "AITransactionMode"; }
+
private:
struct AITransactionModeCommand {
TileIndex tile;
@@ -45,11 +48,6 @@
public:
/**
- * The name of the class, needed by several sub-processes.
- */
- static const char *GetClassName() { return "AITransactionMode"; }
-
- /**
* Creating instance of this class switches the build mode to Transaction.
* @note when the instance is destroyed, he restores the mode that was
* current when the instance was created!
--- a/src/ai/api/ai_tunnel.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_tunnel.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,4 +1,6 @@
-/** @file ai_tunnel.hpp Used to query and build tunnels. */
+/* $Id$ */
+
+/** @file ai_tunnel.hpp Everything to query and build tunnels. */
#ifndef AI_TUNNEL_HPP
#define AI_TUNNEL_HPP
@@ -11,9 +13,6 @@
*/
class AITunnel : public AIObject {
public:
- /**
- * The name of the class, needed by several sub-processes.
- */
static const char *GetClassName() { return "AITunnel"; }
/**
--- a/src/ai/api/ai_vehicle.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_vehicle.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file ai_vehicle.hpp Everything to query and build vehicles */
+/** @file ai_vehicle.hpp Everything to query and build vehicles. */
#ifndef AI_VEHICLE_HPP
#define AI_VEHICLE_HPP
@@ -13,6 +13,8 @@
*/
class AIVehicle : public AIObject {
public:
+ static const char *GetClassName() { return "AIVehicle"; }
+
/**
* The type of a vehicle available in the game. Trams for example are
* road vehicles, as maglev is a rail vehicle.
@@ -27,11 +29,6 @@
};
/**
- * The name of the class, needed by several sub-processes.
- */
- static const char *GetClassName() { return "AIVehicle"; }
-
- /**
* Checks whether the given vehicle is valid and owned by you.
* @param vehicle_id the vehicle to check.
* @return true if and only if the vehicle is valid.
@@ -39,98 +36,6 @@
static bool IsValidVehicle(VehicleID vehicle_id);
/**
- * Builds a vehicle with the given engine at the given depot.
- * @param depot the depot where the vehicle will be build.
- * @param engine_id the engine to use for this vehicle.
- * @pre the tile at depot has a depot that can build the engine and
- * is owned by you.
- * @pre IsValidEngine(engine_id).
- * @return the VehicleID of the new vehicle, or an invalid VehicleID when
- * it failed. Check the return value using IsValidVehicle. In test-mode
- * 0 is returned if it was successful; any other value indicates failure.
- * @note in test-mode it means you can't assign orders yet to this vehicle,
- * as the vehicle isn't really built yet. Build it for real first before
- * assigning orders.
- */
- static VehicleID BuildVehicle(TileIndex depot, EngineID engine_id);
-
- /**
- * Clones a vehicle at the given depot, copying or cloning it's orders.
- * @param depot the depot where the vehicle will be build.
- * @param vehicle_id the vehicle to use as example for the new vehicle.
- * @param share_orders should the orders be copied or shared?
- * @pre the tile at depot has a depot.
- * @pre IsValidVehicle(vehicle_id).
- * @return the VehicleID of the new vehicle, or an invalid VehicleID when
- * it failed. Check the return value using IsValidVehicle. In test-mode
- * 0 is returned if it was successful; any other value indicates failure.
- */
- static VehicleID CloneVehicle(TileIndex depot, VehicleID vehicle_id, bool share_orders);
-
- /**
- * Refits a vehicle to the given cargo type
- * @param vehicle_id the vehicle to refit
- * @param cargo the cargo to refit to
- * @pre IsValidVehicle(vehicle_id).
- * @pre AICargo::IsValidCargo(cargo)
- * @pre you must own the vehicle
- * @pre the vehicle must be stopped in the depot
- * @return true if and only if the refit succeeded.
- */
- static bool RefitVehicle(VehicleID vehicle_id, CargoID cargo);
-
- /**
- * Sells the given vehicle.
- * @param vehicle_id the vehicle to sell.
- * @pre IsValidVehicle(vehicle_id).
- * @pre you must own the vehicle
- * @pre the vehicle must be stopped in the depot
- * @return true if and only if the vehicle has been sold.
- */
- static bool SellVehicle(VehicleID vehicle_id);
-
- /**
- * Sends the given vehicle to a depot.
- * @param vehicle_id the vehicle to send to a depot.
- * @pre IsValidVehicle(vehicle_id).
- * @return true if and only if the vehicle has been sent to a depot.
- */
- static bool SendVehicleToDepot(VehicleID vehicle_id);
-
- /**
- * Check if a vehicle is in a depot.
- * @param vehicle_id the vehicle to check.
- * @pre isValidVehicle(vehicle_id).
- * @return true if and only if the vehicle is in a depot.
- */
- static bool IsInDepot(VehicleID vehicle_id);
-
- /**
- * Check if a vehicle is in a depot and stopped.
- * @param vehicle_id the vehicle to check.
- * @pre isValidVehicle(vehicle_id).
- * @return true if and only if the vehicle is in a depot and stopped.
- */
- static bool IsStoppedInDepot(VehicleID vehicle_id);
-
- /**
- * Starts or stops the given vehicle depending on the current state.
- * @param vehicle_id the vehicle to start/stop.
- * @pre IsValidVehicle(vehicle_id).
- * @return true if and only if the vehicle has been started or stopped.
- */
- static bool StartStopVehicle(VehicleID vehicle_id);
-
- /**
- * Skips the current order of the given vehicle.
- * @param vehicle_id the vehicle to skip the order for.
- * @param order_id the selected order to which we want to skip.
- * @pre IsValidVehicleOrder(vehicle_id, order_id).
- * @return true if and only if the order has been skipped.
- */
- static bool SkipToVehicleOrder(VehicleID vehicle_id, uint32 order_id);
-
- /**
* Set the name of a vehicle.
* @param vehicle_id the vehicle to set the name for.
* @param name the name for the vehicle.
@@ -142,6 +47,14 @@
static bool SetName(VehicleID vehicle_id, const char *name);
/**
+ * Get the name of a vehicle.
+ * @param vehicle_id the vehicle to get the name of.
+ * @pre IsValidVehicle(vehicle_id).
+ * @return the name the vehicle has.
+ */
+ static char *GetName(VehicleID vehicle_id);
+
+ /**
* Get the current location of a vehicle.
* @param vehicle_id the vehicle to get the location of.
* @pre IsValidVehicle(vehicle_id).
@@ -166,14 +79,6 @@
static int32 GetUnitNumber(VehicleID vehicle_id);
/**
- * Get the name of a vehicle.
- * @param vehicle_id the vehicle to get the name of.
- * @pre IsValidVehicle(vehicle_id).
- * @return the name the vehicle has.
- */
- static char *GetName(VehicleID vehicle_id);
-
- /**
* Get the current age of a vehicle.
* @note age is in days.
* @param vehicle_id the vehicle to get the age of.
@@ -235,6 +140,97 @@
*/
static AIVehicle::VehicleType GetVehicleType(VehicleID vehicle_id);
+ /**
+ * Check if a vehicle is in a depot.
+ * @param vehicle_id the vehicle to check.
+ * @pre isValidVehicle(vehicle_id).
+ * @return true if and only if the vehicle is in a depot.
+ */
+ static bool IsInDepot(VehicleID vehicle_id);
+
+ /**
+ * Check if a vehicle is in a depot and stopped.
+ * @param vehicle_id the vehicle to check.
+ * @pre isValidVehicle(vehicle_id).
+ * @return true if and only if the vehicle is in a depot and stopped.
+ */
+ static bool IsStoppedInDepot(VehicleID vehicle_id);
+
+ /**
+ * Builds a vehicle with the given engine at the given depot.
+ * @param depot the depot where the vehicle will be build.
+ * @param engine_id the engine to use for this vehicle.
+ * @pre the tile at depot has a depot that can build the engine and
+ * is owned by you.
+ * @pre IsValidEngine(engine_id).
+ * @return the VehicleID of the new vehicle, or an invalid VehicleID when
+ * it failed. Check the return value using IsValidVehicle. In test-mode
+ * 0 is returned if it was successful; any other value indicates failure.
+ * @note in test-mode it means you can't assign orders yet to this vehicle,
+ * as the vehicle isn't really built yet. Build it for real first before
+ * assigning orders.
+ */
+ static VehicleID BuildVehicle(TileIndex depot, EngineID engine_id);
+
+ /**
+ * Clones a vehicle at the given depot, copying or cloning it's orders.
+ * @param depot the depot where the vehicle will be build.
+ * @param vehicle_id the vehicle to use as example for the new vehicle.
+ * @param share_orders should the orders be copied or shared?
+ * @pre the tile at depot has a depot.
+ * @pre IsValidVehicle(vehicle_id).
+ * @return the VehicleID of the new vehicle, or an invalid VehicleID when
+ * it failed. Check the return value using IsValidVehicle. In test-mode
+ * 0 is returned if it was successful; any other value indicates failure.
+ */
+ static VehicleID CloneVehicle(TileIndex depot, VehicleID vehicle_id, bool share_orders);
+
+ /**
+ * Refits a vehicle to the given cargo type
+ * @param vehicle_id the vehicle to refit
+ * @param cargo the cargo to refit to
+ * @pre IsValidVehicle(vehicle_id).
+ * @pre AICargo::IsValidCargo(cargo)
+ * @pre you must own the vehicle
+ * @pre the vehicle must be stopped in the depot
+ * @return true if and only if the refit succeeded.
+ */
+ static bool RefitVehicle(VehicleID vehicle_id, CargoID cargo);
+
+ /**
+ * Sells the given vehicle.
+ * @param vehicle_id the vehicle to sell.
+ * @pre IsValidVehicle(vehicle_id).
+ * @pre you must own the vehicle
+ * @pre the vehicle must be stopped in the depot
+ * @return true if and only if the vehicle has been sold.
+ */
+ static bool SellVehicle(VehicleID vehicle_id);
+
+ /**
+ * Sends the given vehicle to a depot.
+ * @param vehicle_id the vehicle to send to a depot.
+ * @pre IsValidVehicle(vehicle_id).
+ * @return true if and only if the vehicle has been sent to a depot.
+ */
+ static bool SendVehicleToDepot(VehicleID vehicle_id);
+
+ /**
+ * Starts or stops the given vehicle depending on the current state.
+ * @param vehicle_id the vehicle to start/stop.
+ * @pre IsValidVehicle(vehicle_id).
+ * @return true if and only if the vehicle has been started or stopped.
+ */
+ static bool StartStopVehicle(VehicleID vehicle_id);
+
+ /**
+ * Skips the current order of the given vehicle.
+ * @param vehicle_id the vehicle to skip the order for.
+ * @param order_id the selected order to which we want to skip.
+ * @pre IsValidVehicleOrder(vehicle_id, order_id).
+ * @return true if and only if the order has been skipped.
+ */
+ static bool SkipToVehicleOrder(VehicleID vehicle_id, uint32 order_id);
};
#endif /* AI_VEHICLE_HPP */
--- a/src/ai/api/ai_vehicle.hpp.sq Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_vehicle.hpp.sq Mon Mar 31 06:32:27 2008 +0000
@@ -26,20 +26,11 @@
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetClassName, "GetClassName", 1, "x");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsValidVehicle, "IsValidVehicle", 2, "xi");
- SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::BuildVehicle, "BuildVehicle", 3, "xii");
- SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::CloneVehicle, "CloneVehicle", 4, "xiib");
- SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::RefitVehicle, "RefitVehicle", 3, "xii");
- SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SellVehicle, "SellVehicle", 2, "xi");
- SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SendVehicleToDepot, "SendVehicleToDepot", 2, "xi");
- SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsInDepot, "IsInDepot", 2, "xi");
- SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsStoppedInDepot, "IsStoppedInDepot", 2, "xi");
- SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::StartStopVehicle, "StartStopVehicle", 2, "xi");
- SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SkipToVehicleOrder, "SkipToVehicleOrder", 3, "xii");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SetName, "SetName", 3, "xis");
+ SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetName, "GetName", 2, "xi");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetLocation, "GetLocation", 2, "xi");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetEngineType, "GetEngineType", 2, "xi");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetUnitNumber, "GetUnitNumber", 2, "xi");
- SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetName, "GetName", 2, "xi");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetAge, "GetAge", 2, "xi");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetMaxAge, "GetMaxAge", 2, "xi");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetAgeLeft, "GetAgeLeft", 2, "xi");
@@ -47,6 +38,15 @@
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetProfitThisYear, "GetProfitThisYear", 2, "xi");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetProfitLastYear, "GetProfitLastYear", 2, "xi");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetVehicleType, "GetVehicleType", 2, "xi");
+ SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsInDepot, "IsInDepot", 2, "xi");
+ SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsStoppedInDepot, "IsStoppedInDepot", 2, "xi");
+ SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::BuildVehicle, "BuildVehicle", 3, "xii");
+ SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::CloneVehicle, "CloneVehicle", 4, "xiib");
+ SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::RefitVehicle, "RefitVehicle", 3, "xii");
+ SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SellVehicle, "SellVehicle", 2, "xi");
+ SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SendVehicleToDepot, "SendVehicleToDepot", 2, "xi");
+ SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::StartStopVehicle, "StartStopVehicle", 2, "xi");
+ SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SkipToVehicleOrder, "SkipToVehicleOrder", 3, "xii");
SQAIVehicle.PostRegister(engine);
}
--- a/src/ai/api/ai_vehiclelist.hpp Sun Mar 30 20:58:41 2008 +0000
+++ b/src/ai/api/ai_vehiclelist.hpp Mon Mar 31 06:32:27 2008 +0000
@@ -1,7 +1,6 @@
/* $Id$ */
-/** @file ai_vehiclelist.hpp list all the vehicles (you own) */
-/** @defgroup AIVehicleList AIVehicleList - Valuators and lists working on/with AIVehicleList */
+/** @file ai_vehiclelist.hpp List all the vehicles (you own). */
#ifndef AI_VEHICLELIST_HPP
#define AI_VEHICLELIST_HPP
@@ -10,7 +9,7 @@
/**
* Creates a list of vehicles of which you are the owner.
- * @ingroup AIVehicleList
+ * @ingroup AIList
*/
class AIVehicleList : public AIAbstractList {
public:
@@ -20,7 +19,7 @@
/**
* Creates a list of vehicles that have orders to a given station.
- * @ingroup AIVehicleList
+ * @ingroup AIList
*/
class AIVehicleList_Station : public AIAbstractList {
public: