/* $Id: ai_rail.hpp.sq 15535 2009-02-21 00:43:18Z glx $ */
/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */

#include "ai_rail.hpp"

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

	/* Allow AIRail to be used as Squirrel parameter */
	template <> AIRail *GetParam(ForceType<AIRail *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIRail *)instance; }
	template <> AIRail &GetParam(ForceType<AIRail &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIRail *)instance; }
	template <> const AIRail *GetParam(ForceType<const AIRail *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIRail *)instance; }
	template <> const AIRail &GetParam(ForceType<const AIRail &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIRail *)instance; }
	template <> int Return<AIRail *>(HSQUIRRELVM vm, AIRail *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIRail", res, NULL, DefSQDestructorCallback<AIRail>); return 1; }
}; // namespace SQConvert

void SQAIRail_Register(Squirrel *engine) {
	DefSQClass <AIRail> SQAIRail("AIRail");
	SQAIRail.PreRegister(engine);
	SQAIRail.AddConstructor<void (AIRail::*)(), 1>(engine, "x");

	SQAIRail.DefSQConst(engine, AIRail::ERR_RAIL_BASE,                    "ERR_RAIL_BASE");
	SQAIRail.DefSQConst(engine, AIRail::ERR_CROSSING_ON_ONEWAY_ROAD,      "ERR_CROSSING_ON_ONEWAY_ROAD");
	SQAIRail.DefSQConst(engine, AIRail::ERR_UNSUITABLE_TRACK,             "ERR_UNSUITABLE_TRACK");
	SQAIRail.DefSQConst(engine, AIRail::ERR_NONUNIFORM_STATIONS_DISABLED, "ERR_NONUNIFORM_STATIONS_DISABLED");
	SQAIRail.DefSQConst(engine, AIRail::RAILTYPE_INVALID,                 "RAILTYPE_INVALID");
	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NE_SW,                  "RAILTRACK_NE_SW");
	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NW_SE,                  "RAILTRACK_NW_SE");
	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NW_NE,                  "RAILTRACK_NW_NE");
	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_SW_SE,                  "RAILTRACK_SW_SE");
	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NW_SW,                  "RAILTRACK_NW_SW");
	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_NE_SE,                  "RAILTRACK_NE_SE");
	SQAIRail.DefSQConst(engine, AIRail::RAILTRACK_INVALID,                "RAILTRACK_INVALID");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NORMAL,                "SIGNALTYPE_NORMAL");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_ENTRY,                 "SIGNALTYPE_ENTRY");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_EXIT,                  "SIGNALTYPE_EXIT");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_COMBO,                 "SIGNALTYPE_COMBO");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_PBS,                   "SIGNALTYPE_PBS");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_PBS_ONEWAY,            "SIGNALTYPE_PBS_ONEWAY");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_TWOWAY,                "SIGNALTYPE_TWOWAY");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NORMAL_TWOWAY,         "SIGNALTYPE_NORMAL_TWOWAY");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_ENTRY_TWOWAY,          "SIGNALTYPE_ENTRY_TWOWAY");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_EXIT_TWOWAY,           "SIGNALTYPE_EXIT_TWOWAY");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_COMBO_TWOWAY,          "SIGNALTYPE_COMBO_TWOWAY");
	SQAIRail.DefSQConst(engine, AIRail::SIGNALTYPE_NONE,                  "SIGNALTYPE_NONE");

	AIError::RegisterErrorMap(STR_ERR_CROSSING_ON_ONEWAY_ROAD,     AIRail::ERR_CROSSING_ON_ONEWAY_ROAD);
	AIError::RegisterErrorMap(STR_1005_NO_SUITABLE_RAILROAD_TRACK, AIRail::ERR_UNSUITABLE_TRACK);
	AIError::RegisterErrorMap(STR_NONUNIFORM_STATIONS_DISALLOWED,  AIRail::ERR_NONUNIFORM_STATIONS_DISABLED);

	AIError::RegisterErrorMapString(AIRail::ERR_CROSSING_ON_ONEWAY_ROAD,      "ERR_CROSSING_ON_ONEWAY_ROAD");
	AIError::RegisterErrorMapString(AIRail::ERR_UNSUITABLE_TRACK,             "ERR_UNSUITABLE_TRACK");
	AIError::RegisterErrorMapString(AIRail::ERR_NONUNIFORM_STATIONS_DISABLED, "ERR_NONUNIFORM_STATIONS_DISABLED");

	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailTile,                "IsRailTile",                2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsLevelCrossingTile,       "IsLevelCrossingTile",       2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailDepotTile,           "IsRailDepotTile",           2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailStationTile,         "IsRailStationTile",         2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailWaypointTile,        "IsRailWaypointTile",        2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::IsRailTypeAvailable,       "IsRailTypeAvailable",       2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetCurrentRailType,        "GetCurrentRailType",        1, ".");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::SetCurrentRailType,        "SetCurrentRailType",        2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::TrainCanRunOnRail,         "TrainCanRunOnRail",         3, ".ii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::TrainHasPowerOnRail,       "TrainHasPowerOnRail",       3, ".ii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetRailType,               "GetRailType",               2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::ConvertRailType,           "ConvertRailType",           4, ".iii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetRailDepotFrontTile,     "GetRailDepotFrontTile",     2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetRailStationDirection,   "GetRailStationDirection",   2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildRailDepot,            "BuildRailDepot",            3, ".ii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildRailStation,          "BuildRailStation",          6, ".iiiii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildNewGRFRailStation,    "BuildNewGRFRailStation",    11, ".iiiiiiiiib");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildRailWaypoint,         "BuildRailWaypoint",         2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveRailWaypoint,        "RemoveRailWaypoint",        2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveRailStationTileRect, "RemoveRailStationTileRect", 3, ".ii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetRailTracks,             "GetRailTracks",             2, ".i");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildRailTrack,            "BuildRailTrack",            3, ".ii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveRailTrack,           "RemoveRailTrack",           3, ".ii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::AreTilesConnected,         "AreTilesConnected",         4, ".iii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildRail,                 "BuildRail",                 4, ".iii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveRail,                "RemoveRail",                4, ".iii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::GetSignalType,             "GetSignalType",             3, ".ii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::BuildSignal,               "BuildSignal",               4, ".iii");
	SQAIRail.DefSQStaticMethod(engine, &AIRail::RemoveSignal,              "RemoveSignal",              3, ".ii");

	SQAIRail.PostRegister(engine);
}
