/* $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 .
*/
/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */
#include "../../script/api/script_rail.hpp"
namespace SQConvert {
/* Allow enums to be used as Squirrel parameters */
template <> inline ScriptRail::ErrorMessages GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::ErrorMessages)tmp; }
template <> inline int Return(HSQUIRRELVM vm, ScriptRail::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
template <> inline ScriptRail::RailType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::RailType)tmp; }
template <> inline int Return(HSQUIRRELVM vm, ScriptRail::RailType res) { sq_pushinteger(vm, (int32)res); return 1; }
template <> inline ScriptRail::RailTrack GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::RailTrack)tmp; }
template <> inline int Return(HSQUIRRELVM vm, ScriptRail::RailTrack res) { sq_pushinteger(vm, (int32)res); return 1; }
template <> inline ScriptRail::SignalType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::SignalType)tmp; }
template <> inline int Return(HSQUIRRELVM vm, ScriptRail::SignalType res) { sq_pushinteger(vm, (int32)res); return 1; }
template <> inline ScriptRail::BuildType GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptRail::BuildType)tmp; }
template <> inline int Return(HSQUIRRELVM vm, ScriptRail::BuildType res) { sq_pushinteger(vm, (int32)res); return 1; }
/* Allow ScriptRail to be used as Squirrel parameter */
template <> inline ScriptRail *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptRail *)instance; }
template <> inline ScriptRail &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRail *)instance; }
template <> inline const ScriptRail *GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptRail *)instance; }
template <> inline const ScriptRail &GetParam(ForceType, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptRail *)instance; }
template <> inline int Return(HSQUIRRELVM vm, ScriptRail *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Rail", res, NULL, DefSQDestructorCallback, true); return 1; }
} // namespace SQConvert
template <> const char *GetClassName() { return "AIRail"; }
void SQAIRail_Register(Squirrel *engine)
{
DefSQClass SQAIRail("AIRail");
SQAIRail.PreRegister(engine);
SQAIRail.AddConstructor(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_CROSSING_DISALLOWED, 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.PostRegister(engine);
}