mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r15519) -Add [NoAI]: support for waypoints by adding AIRail::Build/Remove RailWaypoint, AIWaypoint and AIWaypointList.
This commit is contained in:
parent
c2d9c85c0f
commit
c0e7ddeb9e
|
@ -2699,6 +2699,14 @@
|
|||
RelativePath=".\..\src\ai\api\ai_vehiclelist.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_waypoint.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_waypointlist.hpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="AI API Implementation"
|
||||
|
@ -2891,6 +2899,14 @@
|
|||
RelativePath=".\..\src\ai\api\ai_vehiclelist.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_waypoint.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_waypointlist.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Blitters"
|
||||
|
|
|
@ -2696,6 +2696,14 @@
|
|||
RelativePath=".\..\src\ai\api\ai_vehiclelist.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_waypoint.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_waypointlist.hpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="AI API Implementation"
|
||||
|
@ -2888,6 +2896,14 @@
|
|||
RelativePath=".\..\src\ai\api\ai_vehiclelist.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_waypoint.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_waypointlist.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Blitters"
|
||||
|
|
|
@ -630,6 +630,8 @@ ai/api/ai_tunnel.hpp
|
|||
ai/api/ai_types.hpp
|
||||
ai/api/ai_vehicle.hpp
|
||||
ai/api/ai_vehiclelist.hpp
|
||||
ai/api/ai_waypoint.hpp
|
||||
ai/api/ai_waypointlist.hpp
|
||||
|
||||
# AI API Implementation
|
||||
ai/api/ai_abstractlist.cpp
|
||||
|
@ -679,6 +681,8 @@ ai/api/ai_townlist.cpp
|
|||
ai/api/ai_tunnel.cpp
|
||||
ai/api/ai_vehicle.cpp
|
||||
ai/api/ai_vehiclelist.cpp
|
||||
ai/api/ai_waypoint.cpp
|
||||
ai/api/ai_waypointlist.cpp
|
||||
|
||||
# Blitters
|
||||
#if DEDICATED
|
||||
|
|
|
@ -69,6 +69,8 @@
|
|||
#include "api/ai_tunnel.hpp.sq"
|
||||
#include "api/ai_vehicle.hpp.sq"
|
||||
#include "api/ai_vehiclelist.hpp.sq"
|
||||
#include "api/ai_waypoint.hpp.sq"
|
||||
#include "api/ai_waypointlist.hpp.sq"
|
||||
|
||||
#undef DEFINE_SCRIPT_FILES
|
||||
|
||||
|
|
|
@ -170,6 +170,24 @@
|
|||
return AIObject::DoCommand(tile, p1, p2, CMD_BUILD_RAILROAD_STATION);
|
||||
}
|
||||
|
||||
/* static */ bool AIRail::BuildRailWaypoint(TileIndex tile)
|
||||
{
|
||||
EnforcePrecondition(false, ::IsValidTile(tile));
|
||||
EnforcePrecondition(false, IsRailTile(tile));
|
||||
EnforcePrecondition(false, GetRailTracks(tile) == RAILTRACK_NE_SW || GetRailTracks(tile) == RAILTRACK_NW_SE);
|
||||
EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType()));
|
||||
|
||||
return AIObject::DoCommand(tile, 0, 0, CMD_BUILD_TRAIN_WAYPOINT);
|
||||
}
|
||||
|
||||
/* static */ bool AIRail::RemoveRailWaypoint(TileIndex tile)
|
||||
{
|
||||
EnforcePrecondition(false, ::IsValidTile(tile));
|
||||
EnforcePrecondition(false, IsRailWaypointTile(tile));
|
||||
|
||||
return AIObject::DoCommand(tile, 0, 0, CMD_REMOVE_TRAIN_WAYPOINT);
|
||||
}
|
||||
|
||||
/* static */ bool AIRail::RemoveRailStationTileRect(TileIndex tile, TileIndex tile2)
|
||||
{
|
||||
EnforcePrecondition(false, ::IsValidTile(tile));
|
||||
|
|
|
@ -260,6 +260,27 @@ public:
|
|||
*/
|
||||
static bool BuildNewGRFRailStation(TileIndex tile, RailTrack direction, uint num_platforms, uint platform_length, StationID station_id, CargoID cargo_id, IndustryType source_industry, IndustryType goal_industry, int distance, bool source_station);
|
||||
|
||||
/**
|
||||
* Build a rail waypoint.
|
||||
* @param tile Place to build the waypoint.
|
||||
* @pre AIMap::IsValidTile(tile).
|
||||
* @pre IsRailTile(tile).
|
||||
* @pre GetRailTracks(tile) == RAILTRACK_NE_SW || GetRailTracks(tile) == RAILTRACK_NW_SE.
|
||||
* @pre IsRailTypeAvailable(GetCurrentRailType()).
|
||||
* @exception AIError::ERR_FLAT_LAND_REQUIRED
|
||||
* @return Whether the rail waypoint has been/can be build or not.
|
||||
*/
|
||||
static bool BuildRailWaypoint(TileIndex tile);
|
||||
|
||||
/**
|
||||
* Remove a rail waypoint.
|
||||
* @param tile Place to remove the waypoint from.
|
||||
* @pre AIMap::IsValidTile(tile).
|
||||
* @pre IsRailWaypointTile(tile).
|
||||
* @return Whether the rail waypoint has been/can be removed or not.
|
||||
*/
|
||||
static bool RemoveRailWaypoint(TileIndex tile);
|
||||
|
||||
/**
|
||||
* Remove a rectangle of platform pieces from a rail station.
|
||||
* @param tile One corner of the rectangle to clear.
|
||||
|
|
|
@ -77,6 +77,8 @@ void SQAIRail_Register(Squirrel *engine) {
|
|||
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");
|
||||
|
|
|
@ -23,6 +23,7 @@ typedef uint16 StringID; //!< The ID of a string.
|
|||
typedef uint32 TileIndex; //!< The ID of a tile (just named differently).
|
||||
typedef uint16 TownID; //!< The ID of a town.
|
||||
typedef uint16 VehicleID; //!< The ID of a vehicle.
|
||||
typedef uint16 WaypointID; //!< The ID of a waypoint.
|
||||
|
||||
/* Types we defined ourself, as the OpenTTD core doesn't have them (yet) */
|
||||
typedef uint AIErrorType; //!< The types of errors inside the NoAI framework.
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/* $Id$ */
|
||||
|
||||
/** @file ai_waypoint.cpp Implementation of AIWaypoint. */
|
||||
|
||||
#include "ai_waypoint.hpp"
|
||||
#include "ai_rail.hpp"
|
||||
#include "../../command_func.h"
|
||||
#include "../../string_func.h"
|
||||
#include "../../strings_func.h"
|
||||
#include "../../company_func.h"
|
||||
#include "../../waypoint.h"
|
||||
#include "../../core/alloc_func.hpp"
|
||||
#include "table/strings.h"
|
||||
|
||||
/* static */ bool AIWaypoint::IsValidWaypoint(WaypointID waypoint_id)
|
||||
{
|
||||
return ::IsValidWaypointID(waypoint_id) && ::GetWaypoint(waypoint_id)->owner == _current_company;
|
||||
}
|
||||
|
||||
/* static */ WaypointID AIWaypoint::GetWaypointID(TileIndex tile)
|
||||
{
|
||||
if (!AIRail::IsRailWaypointTile(tile)) return WAYPOINT_INVALID;
|
||||
|
||||
return ::GetWaypointIndex(tile);
|
||||
}
|
||||
|
||||
/* static */ char *AIWaypoint::GetName(WaypointID waypoint_id)
|
||||
{
|
||||
if (!IsValidWaypoint(waypoint_id)) return NULL;
|
||||
|
||||
static const int len = 64;
|
||||
char *waypoint_name = MallocT<char>(len);
|
||||
|
||||
::SetDParam(0, waypoint_id);
|
||||
::GetString(waypoint_name, STR_WAYPOINT_RAW, &waypoint_name[len - 1]);
|
||||
return waypoint_name;
|
||||
}
|
||||
|
||||
/* static */ bool AIWaypoint::SetName(WaypointID waypoint_id, const char *name)
|
||||
{
|
||||
EnforcePrecondition(false, IsValidWaypoint(waypoint_id));
|
||||
EnforcePrecondition(false, !::StrEmpty(name));
|
||||
EnforcePreconditionCustomError(false, ::strlen(name) < MAX_LENGTH_WAYPOINT_NAME_BYTES, AIError::ERR_PRECONDITION_STRING_TOO_LONG);
|
||||
|
||||
return AIObject::DoCommand(0, waypoint_id, 0, CMD_RENAME_WAYPOINT, name);
|
||||
}
|
||||
|
||||
/* static */ TileIndex AIWaypoint::GetLocation(WaypointID waypoint_id)
|
||||
{
|
||||
if (!IsValidWaypoint(waypoint_id)) return INVALID_TILE;
|
||||
|
||||
return ::GetWaypoint(waypoint_id)->xy;
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/* $Id$ */
|
||||
|
||||
/** @file ai_waypoint.hpp Everything to query and build waypoints. */
|
||||
|
||||
#ifndef AI_WAYPOINT_HPP
|
||||
#define AI_WAYPOINT_HPP
|
||||
|
||||
#include "ai_object.hpp"
|
||||
#include "ai_error.hpp"
|
||||
|
||||
/**
|
||||
* Class that handles all waypoint related functions.
|
||||
*/
|
||||
class AIWaypoint : public AIObject {
|
||||
public:
|
||||
static const char *GetClassName() { return "AIWaypoint"; }
|
||||
|
||||
enum SpecialWaypointIDs {
|
||||
WAYPOINT_INVALID = -1, //!< An invalid WaypointID.
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
static bool IsValidWaypoint(WaypointID waypoint_id);
|
||||
|
||||
/**
|
||||
* Get the WaypointID of a tile.
|
||||
* @param tile The tile to find the WaypointID of.
|
||||
* @pre AIRail::IsRailWaypointTile(tile).
|
||||
* @return WaypointID of the waypoint.
|
||||
*/
|
||||
static WaypointID GetWaypointID(TileIndex tile);
|
||||
|
||||
/**
|
||||
* Get the name of a waypoint.
|
||||
* @param waypoint_id The waypoint to get the name of.
|
||||
* @pre IsValidWaypoint(waypoint_id).
|
||||
* @return The name of the waypoint.
|
||||
*/
|
||||
static char *GetName(WaypointID waypoint_id);
|
||||
|
||||
/**
|
||||
* Set the name this waypoint.
|
||||
* @param waypoint_id The waypoint to set the name of.
|
||||
* @param name The new name of the waypoint.
|
||||
* @pre IsValidWaypointwaypoint_id).
|
||||
* @pre 'name' must have at least one character.
|
||||
* @pre 'name' must have at most 30 characters.
|
||||
* @exception AIError::ERR_NAME_IS_NOT_UNIQUE
|
||||
* @return True if the name was changed.
|
||||
*/
|
||||
static bool SetName(WaypointID waypoint_id, const char *name);
|
||||
|
||||
/**
|
||||
* Get the current location of a waypoint.
|
||||
* @param waypoint_id The waypoint to get the location of.
|
||||
* @pre IsValidWaypoint(waypoint_id).
|
||||
* @return The tile the waypoint is currently on.
|
||||
*/
|
||||
static TileIndex GetLocation(WaypointID waypoint_id);
|
||||
};
|
||||
|
||||
#endif /* AI_WAYPOINT_HPP */
|
|
@ -0,0 +1,33 @@
|
|||
/* $Id$ */
|
||||
/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */
|
||||
|
||||
#include "ai_waypoint.hpp"
|
||||
|
||||
namespace SQConvert {
|
||||
/* Allow enums to be used as Squirrel parameters */
|
||||
template <> AIWaypoint::SpecialWaypointIDs GetParam(ForceType<AIWaypoint::SpecialWaypointIDs>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIWaypoint::SpecialWaypointIDs)tmp; }
|
||||
template <> int Return<AIWaypoint::SpecialWaypointIDs>(HSQUIRRELVM vm, AIWaypoint::SpecialWaypointIDs 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; }
|
||||
template <> const AIWaypoint *GetParam(ForceType<const AIWaypoint *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIWaypoint *)instance; }
|
||||
template <> const AIWaypoint &GetParam(ForceType<const AIWaypoint &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIWaypoint *)instance; }
|
||||
template <> int Return<AIWaypoint *>(HSQUIRRELVM vm, AIWaypoint *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIWaypoint", res, NULL, DefSQDestructorCallback<AIWaypoint>); return 1; }
|
||||
}; // namespace SQConvert
|
||||
|
||||
void SQAIWaypoint_Register(Squirrel *engine) {
|
||||
DefSQClass <AIWaypoint> SQAIWaypoint("AIWaypoint");
|
||||
SQAIWaypoint.PreRegister(engine);
|
||||
SQAIWaypoint.AddConstructor<void (AIWaypoint::*)(), 1>(engine, "x");
|
||||
|
||||
SQAIWaypoint.DefSQConst(engine, AIWaypoint::WAYPOINT_INVALID, "WAYPOINT_INVALID");
|
||||
|
||||
SQAIWaypoint.DefSQStaticMethod(engine, &AIWaypoint::IsValidWaypoint, "IsValidWaypoint", 2, "?i");
|
||||
SQAIWaypoint.DefSQStaticMethod(engine, &AIWaypoint::GetWaypointID, "GetWaypointID", 2, "?i");
|
||||
SQAIWaypoint.DefSQStaticMethod(engine, &AIWaypoint::GetName, "GetName", 2, "?i");
|
||||
SQAIWaypoint.DefSQStaticMethod(engine, &AIWaypoint::SetName, "SetName", 3, "?is");
|
||||
SQAIWaypoint.DefSQStaticMethod(engine, &AIWaypoint::GetLocation, "GetLocation", 2, "?i");
|
||||
|
||||
SQAIWaypoint.PostRegister(engine);
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/* $Id$ */
|
||||
|
||||
/** @file ai_waypointlist.cpp Implementation of AIWaypointList and friends. */
|
||||
|
||||
#include "ai_waypointlist.hpp"
|
||||
#include "ai_vehicle.hpp"
|
||||
#include "ai_waypoint.hpp"
|
||||
#include "../../company_func.h"
|
||||
#include "../../vehicle_base.h"
|
||||
#include "../../waypoint.h"
|
||||
|
||||
AIWaypointList::AIWaypointList()
|
||||
{
|
||||
const Waypoint *wp;
|
||||
FOR_ALL_WAYPOINTS(wp) {
|
||||
if (wp->owner == _current_company) this->AddItem(wp->index);
|
||||
}
|
||||
}
|
||||
|
||||
AIWaypointList_Vehicle::AIWaypointList_Vehicle(VehicleID vehicle_id)
|
||||
{
|
||||
if (!AIVehicle::IsValidVehicle(vehicle_id)) return;
|
||||
|
||||
const Vehicle *v = ::GetVehicle(vehicle_id);
|
||||
|
||||
for (const Order *o = v->GetFirstOrder(); o != NULL; o = o->next) {
|
||||
if (o->IsType(OT_GOTO_WAYPOINT)) this->AddItem(o->GetDestination());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/* $Id$ */
|
||||
|
||||
/** @file ai_waypointlist.hpp List all the waypoints (you own). */
|
||||
|
||||
#ifndef AI_WAYPOINTLIST_HPP
|
||||
#define AI_WAYPOINTLIST_HPP
|
||||
|
||||
#include "ai_abstractlist.hpp"
|
||||
|
||||
/**
|
||||
* Creates a list of waypoints of which you are the owner.
|
||||
* @ingroup AIList
|
||||
*/
|
||||
class AIWaypointList : public AIAbstractList {
|
||||
public:
|
||||
static const char *GetClassName() { return "AIWaypointList"; }
|
||||
|
||||
AIWaypointList();
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a list of waypoints which the vehicle has in its orders.
|
||||
* @ingroup AIList
|
||||
*/
|
||||
class AIWaypointList_Vehicle : public AIAbstractList {
|
||||
public:
|
||||
static const char *GetClassName() { return "AIWaypointList_Vehicle"; }
|
||||
|
||||
/**
|
||||
* @param vehicle_id The vehicle to get the list of waypoints he has in its orders from.
|
||||
*/
|
||||
AIWaypointList_Vehicle(VehicleID vehicle_id);
|
||||
};
|
||||
|
||||
#endif /* AI_WAYPOINTLIST_HPP */
|
|
@ -0,0 +1,38 @@
|
|||
/* $Id$ */
|
||||
/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */
|
||||
|
||||
#include "ai_waypointlist.hpp"
|
||||
|
||||
namespace SQConvert {
|
||||
/* Allow AIWaypointList to be used as Squirrel parameter */
|
||||
template <> AIWaypointList *GetParam(ForceType<AIWaypointList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIWaypointList *)instance; }
|
||||
template <> AIWaypointList &GetParam(ForceType<AIWaypointList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIWaypointList *)instance; }
|
||||
template <> const AIWaypointList *GetParam(ForceType<const AIWaypointList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIWaypointList *)instance; }
|
||||
template <> const AIWaypointList &GetParam(ForceType<const AIWaypointList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIWaypointList *)instance; }
|
||||
template <> int Return<AIWaypointList *>(HSQUIRRELVM vm, AIWaypointList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIWaypointList", res, NULL, DefSQDestructorCallback<AIWaypointList>); return 1; }
|
||||
}; // namespace SQConvert
|
||||
|
||||
void SQAIWaypointList_Register(Squirrel *engine) {
|
||||
DefSQClass <AIWaypointList> SQAIWaypointList("AIWaypointList");
|
||||
SQAIWaypointList.PreRegister(engine, "AIAbstractList");
|
||||
SQAIWaypointList.AddConstructor<void (AIWaypointList::*)(), 1>(engine, "x");
|
||||
|
||||
SQAIWaypointList.PostRegister(engine);
|
||||
}
|
||||
|
||||
namespace SQConvert {
|
||||
/* Allow AIWaypointList_Vehicle to be used as Squirrel parameter */
|
||||
template <> AIWaypointList_Vehicle *GetParam(ForceType<AIWaypointList_Vehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIWaypointList_Vehicle *)instance; }
|
||||
template <> AIWaypointList_Vehicle &GetParam(ForceType<AIWaypointList_Vehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIWaypointList_Vehicle *)instance; }
|
||||
template <> const AIWaypointList_Vehicle *GetParam(ForceType<const AIWaypointList_Vehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIWaypointList_Vehicle *)instance; }
|
||||
template <> const AIWaypointList_Vehicle &GetParam(ForceType<const AIWaypointList_Vehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIWaypointList_Vehicle *)instance; }
|
||||
template <> int Return<AIWaypointList_Vehicle *>(HSQUIRRELVM vm, AIWaypointList_Vehicle *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIWaypointList_Vehicle", res, NULL, DefSQDestructorCallback<AIWaypointList_Vehicle>); return 1; }
|
||||
}; // namespace SQConvert
|
||||
|
||||
void SQAIWaypointList_Vehicle_Register(Squirrel *engine) {
|
||||
DefSQClass <AIWaypointList_Vehicle> SQAIWaypointList_Vehicle("AIWaypointList_Vehicle");
|
||||
SQAIWaypointList_Vehicle.PreRegister(engine, "AIAbstractList");
|
||||
SQAIWaypointList_Vehicle.AddConstructor<void (AIWaypointList_Vehicle::*)(VehicleID vehicle_id), 2>(engine, "xi");
|
||||
|
||||
SQAIWaypointList_Vehicle.PostRegister(engine);
|
||||
}
|
Loading…
Reference in New Issue