/* $Id$ */

/*
 * This file is part of OpenTTD.
 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
 */

/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */

#include "../script_rail.hpp"
#include "../template/template_rail.hpp.sq"


template <> const char *GetClassName<ScriptRail, ST_AI>() { return "AIRail"; }

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

	SQAIRail.DefSQConst(engine, ScriptRail::ERR_RAIL_BASE,                   "ERR_RAIL_BASE");
	SQAIRail.DefSQConst(engine, ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD,     "ERR_CROSSING_ON_ONEWAY_ROAD");
	SQAIRail.DefSQConst(engine, ScriptRail::ERR_UNSUITABLE_TRACK,            "ERR_UNSUITABLE_TRACK");
	SQAIRail.DefSQConst(engine, ScriptRail::ERR_RAILTYPE_DISALLOWS_CROSSING, "ERR_RAILTYPE_DISALLOWS_CROSSING");
	SQAIRail.DefSQConst(engine, ScriptRail::RAILTYPE_INVALID,                "RAILTYPE_INVALID");
	SQAIRail.DefSQConst(engine, ScriptRail::RAILTRACK_NE_SW,                 "RAILTRACK_NE_SW");
	SQAIRail.DefSQConst(engine, ScriptRail::RAILTRACK_NW_SE,                 "RAILTRACK_NW_SE");
	SQAIRail.DefSQConst(engine, ScriptRail::RAILTRACK_NW_NE,                 "RAILTRACK_NW_NE");
	SQAIRail.DefSQConst(engine, ScriptRail::RAILTRACK_SW_SE,                 "RAILTRACK_SW_SE");
	SQAIRail.DefSQConst(engine, ScriptRail::RAILTRACK_NW_SW,                 "RAILTRACK_NW_SW");
	SQAIRail.DefSQConst(engine, ScriptRail::RAILTRACK_NE_SE,                 "RAILTRACK_NE_SE");
	SQAIRail.DefSQConst(engine, ScriptRail::RAILTRACK_INVALID,               "RAILTRACK_INVALID");
	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_NORMAL,               "SIGNALTYPE_NORMAL");
	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_ENTRY,                "SIGNALTYPE_ENTRY");
	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_EXIT,                 "SIGNALTYPE_EXIT");
	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_COMBO,                "SIGNALTYPE_COMBO");
	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_PBS,                  "SIGNALTYPE_PBS");
	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_PBS_ONEWAY,           "SIGNALTYPE_PBS_ONEWAY");
	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_TWOWAY,               "SIGNALTYPE_TWOWAY");
	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_NORMAL_TWOWAY,        "SIGNALTYPE_NORMAL_TWOWAY");
	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_ENTRY_TWOWAY,         "SIGNALTYPE_ENTRY_TWOWAY");
	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_EXIT_TWOWAY,          "SIGNALTYPE_EXIT_TWOWAY");
	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_COMBO_TWOWAY,         "SIGNALTYPE_COMBO_TWOWAY");
	SQAIRail.DefSQConst(engine, ScriptRail::SIGNALTYPE_NONE,                 "SIGNALTYPE_NONE");
	SQAIRail.DefSQConst(engine, ScriptRail::BT_TRACK,                        "BT_TRACK");
	SQAIRail.DefSQConst(engine, ScriptRail::BT_SIGNAL,                       "BT_SIGNAL");
	SQAIRail.DefSQConst(engine, ScriptRail::BT_DEPOT,                        "BT_DEPOT");
	SQAIRail.DefSQConst(engine, ScriptRail::BT_STATION,                      "BT_STATION");
	SQAIRail.DefSQConst(engine, ScriptRail::BT_WAYPOINT,                     "BT_WAYPOINT");

	ScriptError::RegisterErrorMap(STR_ERROR_CROSSING_ON_ONEWAY_ROAD,    ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD);
	ScriptError::RegisterErrorMap(STR_ERROR_NO_SUITABLE_RAILROAD_TRACK, ScriptRail::ERR_UNSUITABLE_TRACK);
	ScriptError::RegisterErrorMap(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK, ScriptRail::ERR_UNSUITABLE_TRACK);
	ScriptError::RegisterErrorMap(STR_ERROR_THERE_ARE_NO_SIGNALS,       ScriptRail::ERR_UNSUITABLE_TRACK);
	ScriptError::RegisterErrorMap(STR_ERROR_THERE_IS_NO_STATION,        ScriptRail::ERR_UNSUITABLE_TRACK);
	ScriptError::RegisterErrorMap(STR_ERROR_CROSSING_DISALLOWED_RAIL,   ScriptRail::ERR_RAILTYPE_DISALLOWS_CROSSING);

	ScriptError::RegisterErrorMapString(ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD,     "ERR_CROSSING_ON_ONEWAY_ROAD");
	ScriptError::RegisterErrorMapString(ScriptRail::ERR_UNSUITABLE_TRACK,            "ERR_UNSUITABLE_TRACK");
	ScriptError::RegisterErrorMapString(ScriptRail::ERR_RAILTYPE_DISALLOWS_CROSSING, "ERR_RAILTYPE_DISALLOWS_CROSSING");

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

	SQAIRail.PostRegister(engine);
}
