Changeset - r18663:632e3fd65819
[Not reviewed]
master
0 17 0
rubidium - 12 years ago 2011-12-15 18:40:15
rubidium@openttd.org
(svn r23521) -Codechange: use the actual enum values from the 'core' in the API when they refer to the in-game values in the cases where that is possible and sensible
17 files changed with 180 insertions and 154 deletions:
0 comments (0 inline, 0 general)
bin/ai/regression/regression.txt
Show inline comments
 
@@ -791,7 +791,7 @@ ERROR: IsEnd() is invalid as Begin() is 
 
  IsHangarTile():       false
 
  IsAirportTile():      false
 
  GetHangarOfAirport(): -1
 
  GetAirportType():     255
 
  GetAirportType():     254
 
  IsAirportInformationAvailable(-1): false
 
  IsValidAirportType(-1):            false
 
  GetAirportWidth(-1):               -1
src/script/api/ai/ai_company.hpp.sq
Show inline comments
 
@@ -25,8 +25,8 @@ void SQAICompany_Register(Squirrel *engi
 
	SQAICompany.DefSQConst(engine, ScriptCompany::EARLIEST_QUARTER, "EARLIEST_QUARTER");
 
	SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_FIRST,    "COMPANY_FIRST");
 
	SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_LAST,     "COMPANY_LAST");
 
	SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_INVALID,  "COMPANY_INVALID");
 
	SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_SELF,     "COMPANY_SELF");
 
	SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_INVALID,  "COMPANY_INVALID");
 
	SQAICompany.DefSQConst(engine, ScriptCompany::GENDER_MALE,      "GENDER_MALE");
 
	SQAICompany.DefSQConst(engine, ScriptCompany::GENDER_FEMALE,    "GENDER_FEMALE");
 
	SQAICompany.DefSQConst(engine, ScriptCompany::GENDER_INVALID,   "GENDER_INVALID");
src/script/api/ai/ai_waypoint.hpp.sq
Show inline comments
 
@@ -21,12 +21,12 @@ void SQAIWaypoint_Register(Squirrel *eng
 
	SQAIWaypoint.PreRegister(engine, "AIBaseStation");
 
	SQAIWaypoint.AddConstructor<void (ScriptWaypoint::*)(), 1>(engine, "x");
 

	
 
	SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_BASE,                          "ERR_WAYPOINT_BASE");
 
	SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, "ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT");
 
	SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS,    "ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS");
 
	SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::WAYPOINT_RAIL,                              "WAYPOINT_RAIL");
 
	SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::WAYPOINT_BUOY,                              "WAYPOINT_BUOY");
 
	SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::WAYPOINT_ANY,                               "WAYPOINT_ANY");
 
	SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_BASE,                          "ERR_WAYPOINT_BASE");
 
	SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, "ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT");
 
	SQAIWaypoint.DefSQConst(engine, ScriptWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS,    "ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS");
 

	
 
	ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_WAYPOINT,           ScriptWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT);
 
	ScriptError::RegisterErrorMap(STR_ERROR_WAYPOINT_ADJOINS_MORE_THAN_ONE_EXISTING, ScriptWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS);
src/script/api/script_airport.hpp
Show inline comments
 
@@ -13,6 +13,7 @@
 
#define SCRIPT_AIRPORT_HPP
 

	
 
#include "script_object.hpp"
 
#include "../../airport.h"
 

	
 
/**
 
 * Class that handles all airport related functions.
 
@@ -24,27 +25,24 @@ public:
 
	 * The types of airports available in the game.
 
	 */
 
	enum AirportType {
 
		/* Note: the values _are_ important as they represent an in-game value */
 
		AT_SMALL         =   0, ///< The small airport.
 
		AT_LARGE         =   1, ///< The large airport.
 
		AT_METROPOLITAN  =   3, ///< The metropolitan airport.
 
		AT_INTERNATIONAL =   4, ///< The international airport.
 
		AT_COMMUTER      =   5, ///< The commuter airport.
 
		AT_INTERCON      =   7, ///< The intercontinental airport.
 

	
 
		/* Next are the airports which only have helicopter platforms */
 
		AT_HELIPORT      =   2, ///< The heliport.
 
		AT_HELISTATION   =   8, ///< The helistation.
 
		AT_HELIDEPOT     =   6, ///< The helidepot.
 

	
 
		AT_INVALID       = 255, ///< Invalid airport.
 
		/* Note: these values represent part of the in-game AirportTypes enum */
 
		AT_SMALL         = ::AT_SMALL,         ///< The small airport.
 
		AT_LARGE         = ::AT_LARGE,         ///< The large airport.
 
		AT_METROPOLITAN  = ::AT_METROPOLITAN,  ///< The metropolitan airport.
 
		AT_INTERNATIONAL = ::AT_INTERNATIONAL, ///< The international airport.
 
		AT_COMMUTER      = ::AT_COMMUTER,      ///< The commuter airport.
 
		AT_INTERCON      = ::AT_INTERCON,      ///< The intercontinental airport.
 
		AT_HELIPORT      = ::AT_HELIPORT,      ///< The heliport.
 
		AT_HELISTATION   = ::AT_HELISTATION,   ///< The helistation.
 
		AT_HELIDEPOT     = ::AT_HELIDEPOT,     ///< The helidepot.
 
		AT_INVALID       = ::AT_INVALID,       ///< Invalid airport.
 
	};
 

	
 
	/**
 
	 * All plane types available.
 
	 */
 
	enum PlaneType {
 
		/* Note: the values _are_ important as they represent an in-game value */
 
		/* Note: these values represent part of the in-game values, which are not defined in an enum */
 
		PT_HELICOPTER    =   0, ///< A helicopter.
 
		PT_SMALL_PLANE   =   1, ///< A small plane.
 
		PT_BIG_PLANE     =   3, ///< A big plane.
src/script/api/script_bridgelist.hpp
Show inline comments
 
@@ -15,7 +15,7 @@
 
#include "script_list.hpp"
 

	
 
/**
 
 * Create a list of bridges.
 
 * Create a list of bridges types.
 
 * @api ai
 
 * @ingroup ScriptList
 
 */
 
@@ -25,7 +25,7 @@ public:
 
};
 

	
 
/**
 
 * Create a list of bridges that can be built on a specific length.
 
 * Create a list of bridges types that can be built on a specific length.
 
 * @api ai
 
 * @ingroup ScriptList
 
 */
src/script/api/script_cargo.hpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#define SCRIPT_CARGO_HPP
 

	
 
#include "script_object.hpp"
 
#include "../../cargotype.h"
 
#include "../../cargo_type.h"
 

	
 
/**
 
 * Class that handles all cargo related functions.
 
@@ -21,39 +23,42 @@
 
class ScriptCargo : public ScriptObject {
 
public:
 
	/**
 
	 * The classes of cargo (from newgrf_cargo.h).
 
	 * The classes of cargo.
 
	 */
 
	enum CargoClass {
 
		CC_PASSENGERS   = 1 <<  0, ///< Passengers. Cargos of this class appear at bus stops. Cargos not of this class appear at truck stops.
 
		CC_MAIL         = 1 <<  1, ///< Mail
 
		CC_EXPRESS      = 1 <<  2, ///< Express cargo (Goods, Food, Candy, but also possible for passengers)
 
		CC_ARMOURED     = 1 <<  3, ///< Armoured cargo (Valuables, Gold, Diamonds)
 
		CC_BULK         = 1 <<  4, ///< Bulk cargo (Coal, Grain etc., Ores, Fruit)
 
		CC_PIECE_GOODS  = 1 <<  5, ///< Piece goods (Livestock, Wood, Steel, Paper)
 
		CC_LIQUID       = 1 <<  6, ///< Liquids (Oil, Water, Rubber)
 
		CC_REFRIGERATED = 1 <<  7, ///< Refrigerated cargo (Food, Fruit)
 
		CC_HAZARDOUS    = 1 <<  8, ///< Hazardous cargo (Nuclear Fuel, Explosives, etc.)
 
		CC_COVERED      = 1 <<  9, ///< Covered/Sheltered Freight (Transporation in Box Vans, Silo Wagons, etc.)
 
		/* Note: these values represent part of the in-game CargoClass enum */
 
		CC_PASSENGERS   = ::CC_PASSENGERS,   ///< Passengers. Cargos of this class appear at bus stops. Cargos not of this class appear at truck stops.
 
		CC_MAIL         = ::CC_MAIL,         ///< Mail
 
		CC_EXPRESS      = ::CC_EXPRESS,      ///< Express cargo (Goods, Food, Candy, but also possible for passengers)
 
		CC_ARMOURED     = ::CC_ARMOURED,     ///< Armoured cargo (Valuables, Gold, Diamonds)
 
		CC_BULK         = ::CC_BULK,         ///< Bulk cargo (Coal, Grain etc., Ores, Fruit)
 
		CC_PIECE_GOODS  = ::CC_PIECE_GOODS,  ///< Piece goods (Livestock, Wood, Steel, Paper)
 
		CC_LIQUID       = ::CC_LIQUID,       ///< Liquids (Oil, Water, Rubber)
 
		CC_REFRIGERATED = ::CC_REFRIGERATED, ///< Refrigerated cargo (Food, Fruit)
 
		CC_HAZARDOUS    = ::CC_HAZARDOUS,    ///< Hazardous cargo (Nuclear Fuel, Explosives, etc.)
 
		CC_COVERED      = ::CC_COVERED,      ///< Covered/Sheltered Freight (Transporation in Box Vans, Silo Wagons, etc.)
 
	};
 

	
 
	/**
 
	 * The effects a cargo can have on a town.
 
	 */
 
	enum TownEffect {
 
		TE_NONE       = 0, ///< This cargo has no effect on a town
 
		TE_PASSENGERS = 1, ///< This cargo supplies passengers to a town
 
		TE_MAIL       = 2, ///< This cargo supplies mail to a town
 
		TE_GOODS      = 3, ///< This cargo supplies goods to a town
 
		TE_WATER      = 4, ///< This cargo supplies water to a town
 
		TE_FOOD       = 5, ///< This cargo supplies food to a town
 
		/* Note: these values represent part of the in-game TownEffect enum */
 
		TE_NONE       = ::TE_NONE,       ///< This cargo has no effect on a town
 
		TE_PASSENGERS = ::TE_PASSENGERS, ///< This cargo supplies passengers to a town
 
		TE_MAIL       = ::TE_MAIL,       ///< This cargo supplies mail to a town
 
		TE_GOODS      = ::TE_GOODS,      ///< This cargo supplies goods to a town
 
		TE_WATER      = ::TE_WATER,      ///< This cargo supplies water to a town
 
		TE_FOOD       = ::TE_FOOD,       ///< This cargo supplies food to a town
 
	};
 

	
 
	/**
 
	 * Special cargo types.
 
	 */
 
	enum SpecialCargoID {
 
		CT_AUTO_REFIT = 0xFD, ///< Automatically choose cargo type when doing auto-refitting.
 
		CT_NO_REFIT   = 0xFE, ///< Do not refit cargo of a vehicle.
 
		/* Note: these values represent part of the in-game CargoTypes enum */
 
		CT_AUTO_REFIT = ::CT_AUTO_REFIT, ///< Automatically choose cargo type when doing auto-refitting.
 
		CT_NO_REFIT   = ::CT_NO_REFIT,   ///< Do not refit cargo of a vehicle.
 
	};
 

	
 
	/**
src/script/api/script_company.hpp
Show inline comments
 
@@ -22,16 +22,19 @@ class ScriptCompany : public ScriptObjec
 
public:
 
	/** The range of possible quarters to get company information of. */
 
	enum Quarter {
 
		CURRENT_QUARTER = 0,                     ///< The current quarter.
 
		EARLIEST_QUARTER = MAX_HISTORY_QUARTERS, ///< The earliest quarter company information is available for.
 
		CURRENT_QUARTER  = 0,                      ///< The current quarter.
 
		EARLIEST_QUARTER = ::MAX_HISTORY_QUARTERS, ///< The earliest quarter company information is available for.
 
	};
 

	
 
	/** Different constants related to CompanyID. */
 
	enum CompanyID {
 
		COMPANY_FIRST   = 0,               ///< The first available company.
 
		COMPANY_LAST    = ::MAX_COMPANIES, ///< The last available company.
 
		COMPANY_SELF    = 254,             ///< Constant that gets resolved to the correct company index for your company.
 
		COMPANY_INVALID = -1,              ///< An invalid company.
 
		/* Note: these values represent part of the in-game Owner enum */
 
		COMPANY_FIRST   = ::COMPANY_FIRST,   ///< The first available company.
 
		COMPANY_LAST    = ::MAX_COMPANIES,   ///< The last available company.
 

	
 
		/* Custom added value, only valid for this API */
 
		COMPANY_INVALID = -1,                ///< An invalid company.
 
		COMPANY_SELF    = 254,               ///< Constant that gets resolved to the correct company index for your company.
 
	};
 

	
 
	/** Possible genders for company presidents. */
src/script/api/script_group.hpp
Show inline comments
 
@@ -13,6 +13,7 @@
 
#define SCRIPT_GROUP_HPP
 

	
 
#include "script_vehicle.hpp"
 
#include "../../group_type.h"
 

	
 
/**
 
 * Class that handles all group related functions.
 
@@ -24,10 +25,10 @@ public:
 
	 * The group IDs of some special groups.
 
	 */
 
	enum GroupID {
 
		/* Values are important, as they represent the internal state of the game (see group_type.h). */
 
		GROUP_ALL = 0xFFFD,     ///< All vehicles are in this group.
 
		GROUP_DEFAULT = 0xFFFE, ///< Vehicles not put in any other group are in this one.
 
		GROUP_INVALID = 0xFFFF, ///< An invalid group id.
 
		/* Note: these values represent part of the in-game static values */
 
		GROUP_ALL     = ::ALL_GROUP,     ///< All vehicles are in this group.
 
		GROUP_DEFAULT = ::DEFAULT_GROUP, ///< Vehicles not put in any other group are in this one.
 
		GROUP_INVALID = ::INVALID_GROUP, ///< An invalid group id.
 
	};
 

	
 
	/**
src/script/api/script_order.hpp
Show inline comments
 
@@ -14,6 +14,7 @@
 

	
 
#include "script_error.hpp"
 
#include "script_vehicle.hpp"
 
#include "../../order_type.h"
 

	
 
/**
 
 * Class that handles all order related functions.
 
@@ -88,31 +89,35 @@ public:
 
	 * All conditions a conditional order can depend on.
 
	 */
 
	enum OrderCondition {
 
		/* Order _is_ important, as it's based on OrderConditionVariable in order_type.h. */
 
		OC_LOAD_PERCENTAGE,    ///< Skip based on the amount of load, value is in tons.
 
		OC_RELIABILITY,        ///< Skip based on the reliability, value is percent (0..100).
 
		OC_MAX_SPEED,          ///< Skip based on the maximum speed, value is in OpenTTD's internal speed unit, see ScriptEngine::GetMaxSpeed.
 
		OC_AGE,                ///< Skip based on the age, value is in years.
 
		OC_REQUIRES_SERVICE,   ///< Skip when the vehicle requires service, no value.
 
		OC_UNCONDITIONALLY,    ///< Always skip, no compare function, no value.
 
		OC_REMAINING_LIFETIME, ///< Skip based on the remaining lifetime
 
		OC_INVALID = -1,       ///< An invalid condition, do not use.
 
		/* Note: these values represent part of the in-game OrderConditionVariable enum */
 
		OC_LOAD_PERCENTAGE     = ::OCV_LOAD_PERCENTAGE,    ///< Skip based on the amount of load, value is in tons.
 
		OC_RELIABILITY         = ::OCV_RELIABILITY,        ///< Skip based on the reliability, value is percent (0..100).
 
		OC_MAX_SPEED           = ::OCV_MAX_SPEED,          ///< Skip based on the maximum speed, value is in OpenTTD's internal speed unit, see ScriptEngine::GetMaxSpeed.
 
		OC_AGE                 = ::OCV_AGE,                ///< Skip based on the age, value is in years.
 
		OC_REQUIRES_SERVICE    = ::OCV_REQUIRES_SERVICE,   ///< Skip when the vehicle requires service, no value.
 
		OC_UNCONDITIONALLY     = ::OCV_UNCONDITIONALLY,    ///< Always skip, no compare function, no value.
 
		OC_REMAINING_LIFETIME  = ::OCV_REMAINING_LIFETIME, ///< Skip based on the remaining lifetime
 

	
 
		/* Custom added value, only valid for this API */
 
		OC_INVALID             = -1,                       ///< An invalid condition, do not use.
 
	};
 

	
 
	/**
 
	 * Comparators for conditional orders.
 
	 */
 
	enum CompareFunction {
 
		/* Order _is_ important, as it's based on OrderConditionComparator in order_type.h. */
 
		CF_EQUALS,       ///< Skip if both values are equal
 
		CF_NOT_EQUALS,   ///< Skip if both values are not equal
 
		CF_LESS_THAN,    ///< Skip if the value is less than the limit
 
		CF_LESS_EQUALS,  ///< Skip if the value is less or equal to the limit
 
		CF_MORE_THAN,    ///< Skip if the value is more than the limit
 
		CF_MORE_EQUALS,  ///< Skip if the value is more or equal to the limit
 
		CF_IS_TRUE,      ///< Skip if the variable is true
 
		CF_IS_FALSE,     ///< Skip if the variable is false
 
		CF_INVALID = -1, ///< Invalid compare function, do not use.
 
		/* Note: these values represent part of the in-game OrderConditionComparator enum */
 
		CF_EQUALS        = ::OCC_EQUALS,       ///< Skip if both values are equal
 
		CF_NOT_EQUALS    = ::OCC_NOT_EQUALS,   ///< Skip if both values are not equal
 
		CF_LESS_THAN     = ::OCC_LESS_THAN,    ///< Skip if the value is less than the limit
 
		CF_LESS_EQUALS   = ::OCC_LESS_EQUALS,  ///< Skip if the value is less or equal to the limit
 
		CF_MORE_THAN     = ::OCC_MORE_THAN,    ///< Skip if the value is more than the limit
 
		CF_MORE_EQUALS   = ::OCC_MORE_EQUALS,  ///< Skip if the value is more or equal to the limit
 
		CF_IS_TRUE       = ::OCC_IS_TRUE,      ///< Skip if the variable is true
 
		CF_IS_FALSE      = ::OCC_IS_FALSE,     ///< Skip if the variable is false
 

	
 
		/* Custom added value, only valid for this API */
 
		CF_INVALID       = -1,                 ///< Invalid compare function, do not use.
 
	};
 

	
 
	/**
src/script/api/script_rail.hpp
Show inline comments
 
@@ -13,6 +13,8 @@
 
#define SCRIPT_RAIL_HPP
 

	
 
#include "script_tile.hpp"
 
#include "../../signal_type.h"
 
#include "../../track_type.h"
 

	
 
/**
 
 * Class that handles all rail related functions.
 
@@ -41,40 +43,42 @@ public:
 
	 * Types of rail known to the game.
 
	 */
 
	enum RailType {
 
		/* Note: the values _are_ important as they represent an in-game value */
 
		RAILTYPE_INVALID  = 0xFF, ///< Invalid RailType.
 
		/* Note: these values represent part of the in-game static values */
 
		RAILTYPE_INVALID  = ::INVALID_RAILTYPE, ///< Invalid RailType.
 
	};
 

	
 
	/**
 
	 * A bitmap with all possible rail tracks on a tile.
 
	 */
 
	enum RailTrack {
 
		/* Note: the values _are_ important as they represent an in-game value */
 
		RAILTRACK_NE_SW   = 1 << 0, ///< Track along the x-axis (north-east to south-west).
 
		RAILTRACK_NW_SE   = 1 << 1, ///< Track along the y-axis (north-west to south-east).
 
		RAILTRACK_NW_NE   = 1 << 2, ///< Track in the upper corner of the tile (north).
 
		RAILTRACK_SW_SE   = 1 << 3, ///< Track in the lower corner of the tile (south).
 
		RAILTRACK_NW_SW   = 1 << 4, ///< Track in the left corner of the tile (west).
 
		RAILTRACK_NE_SE   = 1 << 5, ///< Track in the right corner of the tile (east).
 
		RAILTRACK_INVALID = 0xFF,   ///< Flag for an invalid track.
 
		/* Note: these values represent part of the in-game TrackBits enum */
 
		RAILTRACK_NE_SW   = ::TRACK_BIT_X,       ///< Track along the x-axis (north-east to south-west).
 
		RAILTRACK_NW_SE   = ::TRACK_BIT_Y,       ///< Track along the y-axis (north-west to south-east).
 
		RAILTRACK_NW_NE   = ::TRACK_BIT_UPPER,   ///< Track in the upper corner of the tile (north).
 
		RAILTRACK_SW_SE   = ::TRACK_BIT_LOWER,   ///< Track in the lower corner of the tile (south).
 
		RAILTRACK_NW_SW   = ::TRACK_BIT_LEFT,    ///< Track in the left corner of the tile (west).
 
		RAILTRACK_NE_SE   = ::TRACK_BIT_RIGHT,   ///< Track in the right corner of the tile (east).
 
		RAILTRACK_INVALID = ::INVALID_TRACK_BIT, ///< Flag for an invalid track.
 
	};
 

	
 
	/**
 
	 * Types of signal known to the game.
 
	 */
 
	enum SignalType {
 
		/* Note: the values _are_ important as they represent an in-game value */
 
		SIGNALTYPE_NORMAL        = 0, ///< Normal signal.
 
		SIGNALTYPE_ENTRY         = 1, ///< Entry presignal.
 
		SIGNALTYPE_EXIT          = 2, ///< Exit signal.
 
		SIGNALTYPE_COMBO         = 3, ///< Combo signal.
 
		SIGNALTYPE_PBS           = 4, ///< Normal PBS signal.
 
		SIGNALTYPE_PBS_ONEWAY    = 5, ///< No-entry PBS signal.
 
		/* Note: these values represent part of the in-game SignalType enum */
 
		SIGNALTYPE_NORMAL        = ::SIGTYPE_NORMAL,     ///< Normal signal.
 
		SIGNALTYPE_ENTRY         = ::SIGTYPE_ENTRY,      ///< Entry presignal.
 
		SIGNALTYPE_EXIT          = ::SIGTYPE_EXIT,       ///< Exit signal.
 
		SIGNALTYPE_COMBO         = ::SIGTYPE_COMBO,      ///< Combo signal.
 
		SIGNALTYPE_PBS           = ::SIGTYPE_PBS,        ///< Normal PBS signal.
 
		SIGNALTYPE_PBS_ONEWAY    = ::SIGTYPE_PBS_ONEWAY, ///< No-entry PBS signal.
 

	
 
		SIGNALTYPE_TWOWAY        = 8, ///< Bit mask for twoway signal.
 
		SIGNALTYPE_NORMAL_TWOWAY = SIGNALTYPE_NORMAL | SIGNALTYPE_TWOWAY, ///< Normal twoway signal.
 
		SIGNALTYPE_ENTRY_TWOWAY  = SIGNALTYPE_ENTRY | SIGNALTYPE_TWOWAY,  ///< Entry twoway signal.
 
		SIGNALTYPE_EXIT_TWOWAY   = SIGNALTYPE_EXIT | SIGNALTYPE_TWOWAY,   ///< Exit twoway signal.
 
		SIGNALTYPE_COMBO_TWOWAY  = SIGNALTYPE_COMBO | SIGNALTYPE_TWOWAY,  ///< Combo twoway signal.
 
		SIGNALTYPE_ENTRY_TWOWAY  = SIGNALTYPE_ENTRY  | SIGNALTYPE_TWOWAY, ///< Entry twoway signal.
 
		SIGNALTYPE_EXIT_TWOWAY   = SIGNALTYPE_EXIT   | SIGNALTYPE_TWOWAY, ///< Exit twoway signal.
 
		SIGNALTYPE_COMBO_TWOWAY  = SIGNALTYPE_COMBO  | SIGNALTYPE_TWOWAY, ///< Combo twoway signal.
 

	
 
		SIGNALTYPE_NONE          = 0xFF, ///< No signal.
 
	};
 

	
src/script/api/script_road.hpp
Show inline comments
 
@@ -45,11 +45,12 @@ public:
 
	 * Types of road known to the game.
 
	 */
 
	enum RoadType {
 
		/* Values are important, as they represent the internal state of the game. */
 
		ROADTYPE_ROAD = 0, ///< Build road objects.
 
		ROADTYPE_TRAM = 1, ///< Build tram objects.
 
		/* Note: these values represent part of the in-game RoadType enum */
 
		ROADTYPE_ROAD    = ::ROADTYPE_ROAD,    ///< Build road objects.
 
		ROADTYPE_TRAM    = ::ROADTYPE_TRAM,    ///< Build tram objects.
 

	
 
		ROADTYPE_INVALID = -1, ///< Invalid RoadType.
 
		/* Custom added value, only valid for this API */
 
		ROADTYPE_INVALID = -1,                 ///< Invalid RoadType.
 
	};
 

	
 
	/**
src/script/api/script_station.hpp
Show inline comments
 
@@ -14,6 +14,7 @@
 

	
 
#include "script_road.hpp"
 
#include "script_basestation.hpp"
 
#include "../../station_type.h"
 

	
 
/**
 
 * Class that handles all station related functions.
 
@@ -42,13 +43,13 @@ public:
 
	 * Type of stations known in the game.
 
	 */
 
	enum StationType {
 
		/* Values are important, as they represent the internal state of the game. */
 
		STATION_TRAIN      = 0x01, ///< Train station
 
		STATION_TRUCK_STOP = 0x02, ///< Truck station
 
		STATION_BUS_STOP   = 0x04, ///< Bus station
 
		STATION_AIRPORT    = 0x08, ///< Airport
 
		STATION_DOCK       = 0x10, ///< Dock
 
		STATION_ANY        = 0x1F, ///< All station types
 
		/* Note: these values represent part of the in-game StationFacility enum */
 
		STATION_TRAIN      = ::FACIL_TRAIN,      ///< Train station
 
		STATION_TRUCK_STOP = ::FACIL_TRUCK_STOP, ///< Truck station
 
		STATION_BUS_STOP   = ::FACIL_BUS_STOP,   ///< Bus station
 
		STATION_AIRPORT    = ::FACIL_AIRPORT,    ///< Airport
 
		STATION_DOCK       = ::FACIL_DOCK,       ///< Dock
 
		STATION_ANY        = STATION_TRAIN | STATION_TRUCK_STOP | STATION_BUS_STOP | STATION_AIRPORT | STATION_DOCK, ///< All station types
 
	};
 

	
 
	/**
src/script/api/script_tile.hpp
Show inline comments
 
@@ -14,6 +14,8 @@
 

	
 
#include "script_error.hpp"
 
#include "script_company.hpp"
 
#include "../../slope_type.h"
 
#include "../../transport_type.h"
 

	
 
/**
 
 * Class that handles all tile related functions.
 
@@ -46,12 +48,13 @@ public:
 
	 * Enumeration for corners of tiles.
 
	 */
 
	enum Corner {
 
		CORNER_W       = 0,      ///< West corner
 
		CORNER_S       = 1,      ///< South corner
 
		CORNER_E       = 2,      ///< East corner
 
		CORNER_N       = 3,      ///< North corner
 
		/* Note: these values represent part of the in-game Corner enum */
 
		CORNER_W       = ::CORNER_W,       ///< West corner
 
		CORNER_S       = ::CORNER_S,       ///< South corner
 
		CORNER_E       = ::CORNER_E,       ///< East corner
 
		CORNER_N       = ::CORNER_N,       ///< North corner
 

	
 
		CORNER_INVALID = 0xFF,
 
		CORNER_INVALID = ::CORNER_INVALID, ///< An invalid corner
 
	};
 

	
 
	/**
 
@@ -62,42 +65,44 @@ public:
 
	 *  is the north-part of the tile.
 
	 */
 
	enum Slope {
 
		/* Values are important, as they represent the internal state of the game. */
 
		SLOPE_FLAT     = 0x00,                                  ///< A flat tile
 
		SLOPE_W        = 1 << CORNER_W,                         ///< The west corner of the tile is raised
 
		SLOPE_S        = 1 << CORNER_S,                         ///< The south corner of the tile is raised
 
		SLOPE_E        = 1 << CORNER_E,                         ///< The east corner of the tile is raised
 
		SLOPE_N        = 1 << CORNER_N,                         ///< The north corner of the tile is raised
 
		SLOPE_STEEP    = 0x10,                                  ///< Indicates the slope is steep (The corner opposite of the not-raised corner is raised two times)
 
		SLOPE_NW       = SLOPE_N | SLOPE_W,                     ///< North and west corner are raised
 
		SLOPE_SW       = SLOPE_S | SLOPE_W,                     ///< South and west corner are raised
 
		SLOPE_SE       = SLOPE_S | SLOPE_E,                     ///< South and east corner are raised
 
		SLOPE_NE       = SLOPE_N | SLOPE_E,                     ///< North and east corner are raised
 
		SLOPE_EW       = SLOPE_E | SLOPE_W,                     ///< East and west corner are raised
 
		SLOPE_NS       = SLOPE_N | SLOPE_S,                     ///< North and south corner are raised
 
		SLOPE_ELEVATED = SLOPE_N | SLOPE_E | SLOPE_S | SLOPE_W, ///< Bit mask containing all 'simple' slopes. Does not appear as a slope.
 
		SLOPE_NWS      = SLOPE_N | SLOPE_W | SLOPE_S,           ///< North, west and south corner are raised
 
		SLOPE_WSE      = SLOPE_W | SLOPE_S | SLOPE_E,           ///< West, south and east corner are raised
 
		SLOPE_SEN      = SLOPE_S | SLOPE_E | SLOPE_N,           ///< South, east and north corner are raised
 
		SLOPE_ENW      = SLOPE_E | SLOPE_N | SLOPE_W,           ///< East, north and west corner are raised
 
		SLOPE_STEEP_W  = SLOPE_STEEP | SLOPE_NWS,               ///< A steep slope falling to east (from west)
 
		SLOPE_STEEP_S  = SLOPE_STEEP | SLOPE_WSE,               ///< A steep slope falling to north (from south)
 
		SLOPE_STEEP_E  = SLOPE_STEEP | SLOPE_SEN,               ///< A steep slope falling to west (from east)
 
		SLOPE_STEEP_N  = SLOPE_STEEP | SLOPE_ENW,               ///< A steep slope falling to south (from north)
 
		/* Note: these values represent part of the in-game Slope enum */
 
		SLOPE_FLAT     = ::SLOPE_FLAT,     ///< A flat tile
 
		SLOPE_W        = ::SLOPE_W,        ///< The west corner of the tile is raised
 
		SLOPE_S        = ::SLOPE_S,        ///< The south corner of the tile is raised
 
		SLOPE_E        = ::SLOPE_E,        ///< The east corner of the tile is raised
 
		SLOPE_N        = ::SLOPE_N,        ///< The north corner of the tile is raised
 
		SLOPE_STEEP    = ::SLOPE_STEEP,    ///< Indicates the slope is steep (The corner opposite of the not-raised corner is raised two times)
 
		SLOPE_NW       = ::SLOPE_NW,       ///< North and west corner are raised
 
		SLOPE_SW       = ::SLOPE_SW,       ///< South and west corner are raised
 
		SLOPE_SE       = ::SLOPE_SE,       ///< South and east corner are raised
 
		SLOPE_NE       = ::SLOPE_NE,       ///< North and east corner are raised
 
		SLOPE_EW       = ::SLOPE_EW,       ///< East and west corner are raised
 
		SLOPE_NS       = ::SLOPE_NS,       ///< North and south corner are raised
 
		SLOPE_ELEVATED = ::SLOPE_ELEVATED, ///< Bit mask containing all 'simple' slopes. Does not appear as a slope.
 
		SLOPE_NWS      = ::SLOPE_NWS,      ///< North, west and south corner are raised
 
		SLOPE_WSE      = ::SLOPE_WSE,      ///< West, south and east corner are raised
 
		SLOPE_SEN      = ::SLOPE_SEN,      ///< South, east and north corner are raised
 
		SLOPE_ENW      = ::SLOPE_ENW,      ///< East, north and west corner are raised
 
		SLOPE_STEEP_W  = ::SLOPE_STEEP_W,  ///< A steep slope falling to east (from west)
 
		SLOPE_STEEP_S  = ::SLOPE_STEEP_S,  ///< A steep slope falling to north (from south)
 
		SLOPE_STEEP_E  = ::SLOPE_STEEP_E,  ///< A steep slope falling to west (from east)
 
		SLOPE_STEEP_N  = ::SLOPE_STEEP_N,  ///< A steep slope falling to south (from north)
 

	
 
		SLOPE_INVALID  = 0xFFFF,                                ///< An invalid slope
 
		/* Custom added value, only valid for this API */
 
		SLOPE_INVALID  = 0xFFFF,           ///< An invalid slope
 
	};
 

	
 
	/**
 
	 * The different transport types a tile can have.
 
	 */
 
	enum TransportType {
 
		/* Values are important, as they represent the internal state of the game. */
 
		TRANSPORT_RAIL    =  0, ///< Tile with rail.
 
		TRANSPORT_ROAD    =  1, ///< Tile with road.
 
		TRANSPORT_WATER   =  2, ///< Tile with navigable waterways.
 
		TRANSPORT_AIR     =  3, ///< Tile with airport.
 
		/* Note: these values represent part of the in-game TransportType enum */
 
		TRANSPORT_RAIL    =  ::TRANSPORT_RAIL,  ///< Tile with rail.
 
		TRANSPORT_ROAD    =  ::TRANSPORT_ROAD,  ///< Tile with road.
 
		TRANSPORT_WATER   =  ::TRANSPORT_WATER, ///< Tile with navigable waterways.
 
		TRANSPORT_AIR     =  ::TRANSPORT_AIR,   ///< Tile with airport.
 

	
 
		/* Custom added value, only valid for this API */
 
		TRANSPORT_INVALID = -1, ///< Tile without any transport type.
 
	};
 

	
src/script/api/script_town.hpp
Show inline comments
 
@@ -14,6 +14,7 @@
 

	
 
#include "script_cargo.hpp"
 
#include "script_company.hpp"
 
#include "../../town_type.h"
 

	
 
/**
 
 * Class that handles all town related functions.
 
@@ -25,7 +26,7 @@ public:
 
	 * Actions that one can perform on a town.
 
	 */
 
	enum TownAction {
 
		/* Values are important, as they represent the internal state of the game. */
 
		/* Note: these values represent part of the in-game order of the _town_action_proc array */
 

	
 
		/**
 
		 * The cargo ratings temporary gains 25% of rating (in
 
@@ -94,12 +95,14 @@ public:
 
	 * Possible layouts for the roads in a town.
 
	 */
 
	enum RoadLayout {
 
		/* Order IS important, as it matches an in-game value */
 
		ROAD_LAYOUT_ORIGINAL,     ///< Original algorithm (min. 1 distance between roads).
 
		ROAD_LAYOUT_BETTER_ROADS, ///< Extended original algorithm (min. 2 distance between roads).
 
		ROAD_LAYOUT_2x2,          ///< Geometric 2x2 grid algorithm
 
		ROAD_LAYOUT_3x3,          ///< Geometric 3x3 grid algorithm
 
		ROAD_LAYOUT_INVALID = -1, ///< The layout for invalid towns.
 
		/* Note: these values represent part of the in-game TownLayout enum */
 
		ROAD_LAYOUT_ORIGINAL      = ::TL_ORIGINAL,     ///< Original algorithm (min. 1 distance between roads).
 
		ROAD_LAYOUT_BETTER_ROADS  = ::TL_BETTER_ROADS, ///< Extended original algorithm (min. 2 distance between roads).
 
		ROAD_LAYOUT_2x2           = ::TL_2X2_GRID,     ///< Geometric 2x2 grid algorithm
 
		ROAD_LAYOUT_3x3           = ::TL_3X3_GRID,     ///< Geometric 3x3 grid algorithm
 

	
 
		/* Custom added value, only valid for this API */
 
		ROAD_LAYOUT_INVALID       = -1,                ///< The layout for invalid towns.
 
	};
 

	
 
	/**
src/script/api/script_vehicle.hpp
Show inline comments
 
@@ -72,7 +72,6 @@ public:
 
	 *  road vehicles, as maglev is a rail vehicle.
 
	 */
 
	enum VehicleType {
 
		/* Order IS important, as it now matches the internal state of the game for vehicle type */
 
		VT_RAIL,           ///< Rail type vehicle.
 
		VT_ROAD,           ///< Road type vehicle (bus / truck).
 
		VT_WATER,          ///< Water type vehicle.
src/script/api/script_waypoint.hpp
Show inline comments
 
@@ -13,6 +13,7 @@
 
#define SCRIPT_WAYPOINT_HPP
 

	
 
#include "script_basestation.hpp"
 
#include "../../station_type.h"
 

	
 
/**
 
 * Class that handles all waypoint related functions.
 
@@ -21,16 +22,6 @@
 
class ScriptWaypoint : public ScriptBaseStation {
 
public:
 
	/**
 
	 * Type of waypoints known in the game.
 
	 */
 
	enum WaypointType {
 
		/* Values are important, as they represent the internal state of the game. */
 
		WAYPOINT_RAIL      = 0x01, ///< Rail waypoint
 
		WAYPOINT_BUOY      = 0x10, ///< Buoy
 
		WAYPOINT_ANY       = 0x11, ///< All waypoint types
 
	};
 

	
 
	/**
 
	 * All waypoint related error messages.
 
	 */
 
	enum ErrorMessages {
 
@@ -45,6 +36,16 @@ public:
 
	};
 

	
 
	/**
 
	 * Type of waypoints known in the game.
 
	 */
 
	enum WaypointType {
 
		/* Note: these values represent part of the in-game StationFacility enum */
 
		WAYPOINT_RAIL      = ::FACIL_TRAIN, ///< Rail waypoint
 
		WAYPOINT_BUOY      = ::FACIL_DOCK,  ///< Buoy
 
		WAYPOINT_ANY       = WAYPOINT_RAIL | WAYPOINT_BUOY, ///< All waypoint types
 
	};
 

	
 
	/**
 
	 * Checks whether the given waypoint is valid and owned by you.
 
	 * @param waypoint_id The waypoint to check.
 
	 * @return True if and only if the waypoint is valid.
src/script/api/template/template_waypoint.hpp.sq
Show inline comments
 
@@ -13,10 +13,10 @@
 

	
 
namespace SQConvert {
 
	/* Allow enums to be used as Squirrel parameters */
 
	template <> inline ScriptWaypoint::ErrorMessages GetParam(ForceType<ScriptWaypoint::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWaypoint::ErrorMessages)tmp; }
 
	template <> inline int Return<ScriptWaypoint::ErrorMessages>(HSQUIRRELVM vm, ScriptWaypoint::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
 
	template <> inline ScriptWaypoint::WaypointType GetParam(ForceType<ScriptWaypoint::WaypointType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWaypoint::WaypointType)tmp; }
 
	template <> inline int Return<ScriptWaypoint::WaypointType>(HSQUIRRELVM vm, ScriptWaypoint::WaypointType res) { sq_pushinteger(vm, (int32)res); return 1; }
 
	template <> inline ScriptWaypoint::ErrorMessages GetParam(ForceType<ScriptWaypoint::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWaypoint::ErrorMessages)tmp; }
 
	template <> inline int Return<ScriptWaypoint::ErrorMessages>(HSQUIRRELVM vm, ScriptWaypoint::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
 

	
 
	/* Allow ScriptWaypoint to be used as Squirrel parameter */
 
	template <> inline ScriptWaypoint *GetParam(ForceType<ScriptWaypoint *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (ScriptWaypoint *)instance; }
0 comments (0 inline, 0 general)