Changeset - r14134:cdf3a9d02f8d
[Not reviewed]
master
0 7 0
yexo - 14 years ago 2010-01-02 16:47:32
yexo@openttd.org
(svn r18691) -Change [NoAI]: cleanup some errors messages and add a few to AIWaypoint
7 files changed with 40 insertions and 13 deletions:
0 comments (0 inline, 0 general)
src/ai/api/ai_changelog.hpp
Show inline comments
 
@@ -34,12 +34,14 @@
 
 * \li AISubsidy::GetDestinationIndex
 
 * \li AITown::GetLastMonthTransportedPercentage
 
 * \li AIVehicleList_Depot
 
 * \li Some error messages to AIWaypoint
 
 *
 
 * API removals:
 
 * \li AIOrder::ChangeOrder, use AIOrder::SetOrderFlags instead
 
 * \li AIRail::RemoveRailStationTileRect, use AIRail::RemoveRailStationTileRectangle instead
 
 * \li AIRail::RemoveRailWaypoint, use AIRail::RemoveRailWaypointTileRectangle instead
 
 * \li AISign::GetMaxSignID, use AISignList instead
 
 * \li AIStation::ERR_STATION_TOO_LARGE, use AIError::ERR_STATION_TOO_SPREAD_OUT instead
 
 * \li AISubsidy::SourceIsTown, use AISubsidy::GetSourceType instead
 
 * \li AISubsidy::GetSource, use AISubsidy::GetSourceIndex instead
 
 * \li AISubsidy::DestinationIsTown, use AISubsidy::GetDestinationType instead
src/ai/api/ai_error.hpp
Show inline comments
 
@@ -61,6 +61,7 @@ public:
 
		ERR_CAT_ROAD,     //!< Error messages related to building / maintaining roads.
 
		ERR_CAT_ORDER,    //!< Error messages related to managing orders.
 
		ERR_CAT_MARINE,   //!< Error messages related to building / removing ships, docks and channels.
 
		ERR_CAT_WAYPOINT, //!< Error messages related to building / maintaining waypoints.
 

	
 
		/**
 
		 * DO NOT USE! The error bitsize determines how many errors can be stored in
src/ai/api/ai_error.hpp.sq
Show inline comments
 
@@ -44,6 +44,7 @@ void SQAIError_Register(Squirrel *engine
 
	SQAIError.DefSQConst(engine, AIError::ERR_CAT_ROAD,                     "ERR_CAT_ROAD");
 
	SQAIError.DefSQConst(engine, AIError::ERR_CAT_ORDER,                    "ERR_CAT_ORDER");
 
	SQAIError.DefSQConst(engine, AIError::ERR_CAT_MARINE,                   "ERR_CAT_MARINE");
 
	SQAIError.DefSQConst(engine, AIError::ERR_CAT_WAYPOINT,                 "ERR_CAT_WAYPOINT");
 
	SQAIError.DefSQConst(engine, AIError::ERR_CAT_BIT_SIZE,                 "ERR_CAT_BIT_SIZE");
 
	SQAIError.DefSQConst(engine, AIError::ERR_NONE,                         "ERR_NONE");
 
	SQAIError.DefSQConst(engine, AIError::ERR_UNKNOWN,                      "ERR_UNKNOWN");
src/ai/api/ai_station.hpp
Show inline comments
 
@@ -31,9 +31,6 @@ public:
 
		/** Base for station related errors */
 
		ERR_STATION_BASE = AIError::ERR_CAT_STATION << AIError::ERR_CAT_BIT_SIZE,
 

	
 
		/** The station size exceeds the station spread */
 
		ERR_STATION_TOO_LARGE,                    // [STR_ERROR_STATION_TOO_SPREAD_OUT]
 

	
 
		/** The station is build too close to another station, airport or dock */
 
		ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, // [STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT, STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION, STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK]
 

	
 
@@ -41,7 +38,7 @@ public:
 
		ERR_STATION_TOO_MANY_STATIONS,            // [STR_ERROR_TOO_MANY_STATIONS_LOADING, STR_ERROR_TOO_MANY_TRUCK_STOPS, STR_ERROR_TOO_MANY_BUS_STOPS]
 

	
 
		/** There are too many stations, airports of docks in a town */
 
		ERR_STATION_TOO_MANY_STATIONS_IN_TOWN,    // []
 
		ERR_STATION_TOO_MANY_STATIONS_IN_TOWN,    // [STR_ERROR_LOCAL_AUTHORITY_REFUSES_AIRPORT]
 
	};
 

	
 
	/**
src/ai/api/ai_station.hpp.sq
Show inline comments
 
@@ -33,7 +33,6 @@ void SQAIStation_Register(Squirrel *engi
 
	SQAIStation.AddConstructor<void (AIStation::*)(), 1>(engine, "x");
 

	
 
	SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_BASE,                         "ERR_STATION_BASE");
 
	SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_LARGE,                    "ERR_STATION_TOO_LARGE");
 
	SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, "ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION");
 
	SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_MANY_STATIONS,            "ERR_STATION_TOO_MANY_STATIONS");
 
	SQAIStation.DefSQConst(engine, AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN,    "ERR_STATION_TOO_MANY_STATIONS_IN_TOWN");
 
@@ -44,15 +43,14 @@ void SQAIStation_Register(Squirrel *engi
 
	SQAIStation.DefSQConst(engine, AIStation::STATION_DOCK,                             "STATION_DOCK");
 
	SQAIStation.DefSQConst(engine, AIStation::STATION_ANY,                              "STATION_ANY");
 

	
 
	AIError::RegisterErrorMap(STR_ERROR_STATION_TOO_SPREAD_OUT,       AIStation::ERR_STATION_TOO_LARGE);
 
	AIError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT, AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION);
 
	AIError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION, AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION);
 
	AIError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK,    AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION);
 
	AIError::RegisterErrorMap(STR_ERROR_TOO_MANY_STATIONS_LOADING,    AIStation::ERR_STATION_TOO_MANY_STATIONS);
 
	AIError::RegisterErrorMap(STR_ERROR_TOO_MANY_TRUCK_STOPS,         AIStation::ERR_STATION_TOO_MANY_STATIONS);
 
	AIError::RegisterErrorMap(STR_ERROR_TOO_MANY_BUS_STOPS,           AIStation::ERR_STATION_TOO_MANY_STATIONS);
 
	AIError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT,    AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION);
 
	AIError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION,    AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION);
 
	AIError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK,       AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION);
 
	AIError::RegisterErrorMap(STR_ERROR_TOO_MANY_STATIONS_LOADING,       AIStation::ERR_STATION_TOO_MANY_STATIONS);
 
	AIError::RegisterErrorMap(STR_ERROR_TOO_MANY_TRUCK_STOPS,            AIStation::ERR_STATION_TOO_MANY_STATIONS);
 
	AIError::RegisterErrorMap(STR_ERROR_TOO_MANY_BUS_STOPS,              AIStation::ERR_STATION_TOO_MANY_STATIONS);
 
	AIError::RegisterErrorMap(STR_ERROR_LOCAL_AUTHORITY_REFUSES_AIRPORT, AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN);
 

	
 
	AIError::RegisterErrorMapString(AIStation::ERR_STATION_TOO_LARGE,                    "ERR_STATION_TOO_LARGE");
 
	AIError::RegisterErrorMapString(AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, "ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION");
 
	AIError::RegisterErrorMapString(AIStation::ERR_STATION_TOO_MANY_STATIONS,            "ERR_STATION_TOO_MANY_STATIONS");
 
	AIError::RegisterErrorMapString(AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN,    "ERR_STATION_TOO_MANY_STATIONS_IN_TOWN");
src/ai/api/ai_waypoint.hpp
Show inline comments
 
@@ -24,6 +24,20 @@ public:
 
	static const char *GetClassName() { return "AIWaypoint"; }
 

	
 
	/**
 
	 * All waypoint related error messages.
 
	 */
 
	enum ErrorMessages {
 
		/** Base for waypoint related errors */
 
		ERR_WAYPOINT_BASE = AIError::ERR_CAT_WAYPOINT << AIError::ERR_CAT_BIT_SIZE,
 

	
 
		/** The waypoint is build too close to another waypoint */
 
		ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, // [STR_ERROR_TOO_CLOSE_TO_ANOTHER_WAYPOINT]
 

	
 
		/** The waypoint would join more then one existing waypoint together. */
 
		ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS,    // [STR_ERROR_WAYPOINT_ADJOINS_MORE_THAN_ONE_EXISTING]
 
	};
 

	
 
	/**
 
	 * 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/ai/api/ai_waypoint.hpp.sq
Show inline comments
 
@@ -12,6 +12,10 @@
 
#include "ai_waypoint.hpp"
 

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

	
 
	/* Allow AIWaypoint to be used as Squirrel parameter */
 
	template <> AIWaypoint *GetParam(ForceType<AIWaypoint *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIWaypoint *)instance; }
 
	template <> AIWaypoint &GetParam(ForceType<AIWaypoint &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIWaypoint *)instance; }
 
@@ -26,6 +30,16 @@ void SQAIWaypoint_Register(Squirrel *eng
 
	SQAIWaypoint.PreRegister(engine, "AIBaseStation");
 
	SQAIWaypoint.AddConstructor<void (AIWaypoint::*)(), 1>(engine, "x");
 

	
 
	SQAIWaypoint.DefSQConst(engine, AIWaypoint::ERR_WAYPOINT_BASE,                          "ERR_WAYPOINT_BASE");
 
	SQAIWaypoint.DefSQConst(engine, AIWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, "ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT");
 
	SQAIWaypoint.DefSQConst(engine, AIWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS,    "ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS");
 

	
 
	AIError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_WAYPOINT,           AIWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT);
 
	AIError::RegisterErrorMap(STR_ERROR_WAYPOINT_ADJOINS_MORE_THAN_ONE_EXISTING, AIWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS);
 

	
 
	AIError::RegisterErrorMapString(AIWaypoint::ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT, "ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT");
 
	AIError::RegisterErrorMapString(AIWaypoint::ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS,    "ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS");
 

	
 
	SQAIWaypoint.DefSQStaticMethod(engine, &AIWaypoint::IsValidWaypoint, "IsValidWaypoint", 2, ".i");
 
	SQAIWaypoint.DefSQStaticMethod(engine, &AIWaypoint::GetWaypointID,   "GetWaypointID",   2, ".i");
 

	
0 comments (0 inline, 0 general)