diff options
author | fonsinchen <fonsinchen@openttd.org> | 2014-09-21 16:20:48 +0000 |
---|---|---|
committer | fonsinchen <fonsinchen@openttd.org> | 2014-09-21 16:20:48 +0000 |
commit | 2128f1e92906563fc7237b8a43f6fa723de70e7c (patch) | |
tree | e24003162545fddee51081d131c0232acc997765 /src | |
parent | 73d273ffd63d809234c6fa5744d13e520e3e480b (diff) | |
download | openttd-2128f1e92906563fc7237b8a43f6fa723de70e7c.tar.xz |
(svn r26893) -Feature: ScriptStationList_Cargo for sorting cargo by from and via
Diffstat (limited to 'src')
-rw-r--r-- | src/ai/ai_instance.cpp | 11 | ||||
-rw-r--r-- | src/game/game_instance.cpp | 11 | ||||
-rw-r--r-- | src/script/api/ai/ai_stationlist.hpp.sq | 139 | ||||
-rw-r--r-- | src/script/api/ai_changelog.hpp | 8 | ||||
-rw-r--r-- | src/script/api/game/game_stationlist.hpp.sq | 139 | ||||
-rw-r--r-- | src/script/api/game_changelog.hpp | 8 | ||||
-rw-r--r-- | src/script/api/script_stationlist.cpp | 238 | ||||
-rw-r--r-- | src/script/api/script_stationlist.hpp | 245 | ||||
-rw-r--r-- | src/script/api/template/template_stationlist.hpp.sq | 105 |
9 files changed, 904 insertions, 0 deletions
diff --git a/src/ai/ai_instance.cpp b/src/ai/ai_instance.cpp index 1c304c856..c03e74599 100644 --- a/src/ai/ai_instance.cpp +++ b/src/ai/ai_instance.cpp @@ -171,6 +171,17 @@ void AIInstance::RegisterAPI() SQAISignList_Register(this->engine); SQAIStation_Register(this->engine); SQAIStationList_Register(this->engine); + SQAIStationList_Cargo_Register(this->engine); + SQAIStationList_CargoPlanned_Register(this->engine); + SQAIStationList_CargoPlannedByFrom_Register(this->engine); + SQAIStationList_CargoPlannedByVia_Register(this->engine); + SQAIStationList_CargoPlannedFromByVia_Register(this->engine); + SQAIStationList_CargoPlannedViaByFrom_Register(this->engine); + SQAIStationList_CargoWaiting_Register(this->engine); + SQAIStationList_CargoWaitingByFrom_Register(this->engine); + SQAIStationList_CargoWaitingByVia_Register(this->engine); + SQAIStationList_CargoWaitingFromByVia_Register(this->engine); + SQAIStationList_CargoWaitingViaByFrom_Register(this->engine); SQAIStationList_Vehicle_Register(this->engine); SQAISubsidy_Register(this->engine); SQAISubsidyList_Register(this->engine); diff --git a/src/game/game_instance.cpp b/src/game/game_instance.cpp index 9d030f296..c5e5c7f05 100644 --- a/src/game/game_instance.cpp +++ b/src/game/game_instance.cpp @@ -173,6 +173,17 @@ void GameInstance::RegisterAPI() SQGSSignList_Register(this->engine); SQGSStation_Register(this->engine); SQGSStationList_Register(this->engine); + SQGSStationList_Cargo_Register(this->engine); + SQGSStationList_CargoPlanned_Register(this->engine); + SQGSStationList_CargoPlannedByFrom_Register(this->engine); + SQGSStationList_CargoPlannedByVia_Register(this->engine); + SQGSStationList_CargoPlannedFromByVia_Register(this->engine); + SQGSStationList_CargoPlannedViaByFrom_Register(this->engine); + SQGSStationList_CargoWaiting_Register(this->engine); + SQGSStationList_CargoWaitingByFrom_Register(this->engine); + SQGSStationList_CargoWaitingByVia_Register(this->engine); + SQGSStationList_CargoWaitingFromByVia_Register(this->engine); + SQGSStationList_CargoWaitingViaByFrom_Register(this->engine); SQGSStationList_Vehicle_Register(this->engine); SQGSStoryPage_Register(this->engine); SQGSStoryPageElementList_Register(this->engine); diff --git a/src/script/api/ai/ai_stationlist.hpp.sq b/src/script/api/ai/ai_stationlist.hpp.sq index 998e89cc1..93a8c6e76 100644 --- a/src/script/api/ai/ai_stationlist.hpp.sq +++ b/src/script/api/ai/ai_stationlist.hpp.sq @@ -25,6 +25,145 @@ void SQAIStationList_Register(Squirrel *engine) } +template <> const char *GetClassName<ScriptStationList_Cargo, ST_AI>() { return "AIStationList_Cargo"; } + +void SQAIStationList_Cargo_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_Cargo, ST_AI> SQAIStationList_Cargo("AIStationList_Cargo"); + SQAIStationList_Cargo.PreRegister(engine, "AIList"); + SQAIStationList_Cargo.AddConstructor<void (ScriptStationList_Cargo::*)(ScriptStationList_Cargo::CargoMode mode, ScriptStationList_Cargo::CargoSelector selector, StationID station_id, CargoID cargo, StationID other_station), 6>(engine, "xiiiii"); + + SQAIStationList_Cargo.DefSQConst(engine, ScriptStationList_Cargo::CS_BY_FROM, "CS_BY_FROM"); + SQAIStationList_Cargo.DefSQConst(engine, ScriptStationList_Cargo::CS_VIA_BY_FROM, "CS_VIA_BY_FROM"); + SQAIStationList_Cargo.DefSQConst(engine, ScriptStationList_Cargo::CS_BY_VIA, "CS_BY_VIA"); + SQAIStationList_Cargo.DefSQConst(engine, ScriptStationList_Cargo::CS_FROM_BY_VIA, "CS_FROM_BY_VIA"); + SQAIStationList_Cargo.DefSQConst(engine, ScriptStationList_Cargo::CM_WAITING, "CM_WAITING"); + SQAIStationList_Cargo.DefSQConst(engine, ScriptStationList_Cargo::CM_PLANNED, "CM_PLANNED"); + + SQAIStationList_Cargo.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoWaiting, ST_AI>() { return "AIStationList_CargoWaiting"; } + +void SQAIStationList_CargoWaiting_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoWaiting, ST_AI> SQAIStationList_CargoWaiting("AIStationList_CargoWaiting"); + SQAIStationList_CargoWaiting.PreRegister(engine, "AIStationList_Cargo"); + SQAIStationList_CargoWaiting.AddConstructor<void (ScriptStationList_CargoWaiting::*)(ScriptStationList_Cargo::CargoSelector selector, StationID station_id, CargoID cargo, StationID other_station), 5>(engine, "xiiii"); + + SQAIStationList_CargoWaiting.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoPlanned, ST_AI>() { return "AIStationList_CargoPlanned"; } + +void SQAIStationList_CargoPlanned_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoPlanned, ST_AI> SQAIStationList_CargoPlanned("AIStationList_CargoPlanned"); + SQAIStationList_CargoPlanned.PreRegister(engine, "AIStationList_Cargo"); + SQAIStationList_CargoPlanned.AddConstructor<void (ScriptStationList_CargoPlanned::*)(ScriptStationList_Cargo::CargoSelector selector, StationID station_id, CargoID cargo, StationID other_station), 5>(engine, "xiiii"); + + SQAIStationList_CargoPlanned.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoWaitingByFrom, ST_AI>() { return "AIStationList_CargoWaitingByFrom"; } + +void SQAIStationList_CargoWaitingByFrom_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoWaitingByFrom, ST_AI> SQAIStationList_CargoWaitingByFrom("AIStationList_CargoWaitingByFrom"); + SQAIStationList_CargoWaitingByFrom.PreRegister(engine, "AIStationList_CargoWaiting"); + SQAIStationList_CargoWaitingByFrom.AddConstructor<void (ScriptStationList_CargoWaitingByFrom::*)(StationID station_id, CargoID cargo), 3>(engine, "xii"); + + SQAIStationList_CargoWaitingByFrom.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoWaitingViaByFrom, ST_AI>() { return "AIStationList_CargoWaitingViaByFrom"; } + +void SQAIStationList_CargoWaitingViaByFrom_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoWaitingViaByFrom, ST_AI> SQAIStationList_CargoWaitingViaByFrom("AIStationList_CargoWaitingViaByFrom"); + SQAIStationList_CargoWaitingViaByFrom.PreRegister(engine, "AIStationList_CargoWaiting"); + SQAIStationList_CargoWaitingViaByFrom.AddConstructor<void (ScriptStationList_CargoWaitingViaByFrom::*)(StationID station_id, CargoID cargo, StationID via), 4>(engine, "xiii"); + + SQAIStationList_CargoWaitingViaByFrom.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoWaitingByVia, ST_AI>() { return "AIStationList_CargoWaitingByVia"; } + +void SQAIStationList_CargoWaitingByVia_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoWaitingByVia, ST_AI> SQAIStationList_CargoWaitingByVia("AIStationList_CargoWaitingByVia"); + SQAIStationList_CargoWaitingByVia.PreRegister(engine, "AIStationList_CargoWaiting"); + SQAIStationList_CargoWaitingByVia.AddConstructor<void (ScriptStationList_CargoWaitingByVia::*)(StationID station_id, CargoID cargo), 3>(engine, "xii"); + + SQAIStationList_CargoWaitingByVia.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoWaitingFromByVia, ST_AI>() { return "AIStationList_CargoWaitingFromByVia"; } + +void SQAIStationList_CargoWaitingFromByVia_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoWaitingFromByVia, ST_AI> SQAIStationList_CargoWaitingFromByVia("AIStationList_CargoWaitingFromByVia"); + SQAIStationList_CargoWaitingFromByVia.PreRegister(engine, "AIStationList_CargoWaiting"); + SQAIStationList_CargoWaitingFromByVia.AddConstructor<void (ScriptStationList_CargoWaitingFromByVia::*)(StationID station_id, CargoID cargo, StationID from), 4>(engine, "xiii"); + + SQAIStationList_CargoWaitingFromByVia.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoPlannedByFrom, ST_AI>() { return "AIStationList_CargoPlannedByFrom"; } + +void SQAIStationList_CargoPlannedByFrom_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoPlannedByFrom, ST_AI> SQAIStationList_CargoPlannedByFrom("AIStationList_CargoPlannedByFrom"); + SQAIStationList_CargoPlannedByFrom.PreRegister(engine, "AIStationList_CargoPlanned"); + SQAIStationList_CargoPlannedByFrom.AddConstructor<void (ScriptStationList_CargoPlannedByFrom::*)(StationID station_id, CargoID cargo), 3>(engine, "xii"); + + SQAIStationList_CargoPlannedByFrom.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoPlannedViaByFrom, ST_AI>() { return "AIStationList_CargoPlannedViaByFrom"; } + +void SQAIStationList_CargoPlannedViaByFrom_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoPlannedViaByFrom, ST_AI> SQAIStationList_CargoPlannedViaByFrom("AIStationList_CargoPlannedViaByFrom"); + SQAIStationList_CargoPlannedViaByFrom.PreRegister(engine, "AIStationList_CargoPlanned"); + SQAIStationList_CargoPlannedViaByFrom.AddConstructor<void (ScriptStationList_CargoPlannedViaByFrom::*)(StationID station_id, CargoID cargo, StationID via), 4>(engine, "xiii"); + + SQAIStationList_CargoPlannedViaByFrom.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoPlannedByVia, ST_AI>() { return "AIStationList_CargoPlannedByVia"; } + +void SQAIStationList_CargoPlannedByVia_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoPlannedByVia, ST_AI> SQAIStationList_CargoPlannedByVia("AIStationList_CargoPlannedByVia"); + SQAIStationList_CargoPlannedByVia.PreRegister(engine, "AIStationList_CargoPlanned"); + SQAIStationList_CargoPlannedByVia.AddConstructor<void (ScriptStationList_CargoPlannedByVia::*)(StationID station_id, CargoID cargo), 3>(engine, "xii"); + + SQAIStationList_CargoPlannedByVia.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoPlannedFromByVia, ST_AI>() { return "AIStationList_CargoPlannedFromByVia"; } + +void SQAIStationList_CargoPlannedFromByVia_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoPlannedFromByVia, ST_AI> SQAIStationList_CargoPlannedFromByVia("AIStationList_CargoPlannedFromByVia"); + SQAIStationList_CargoPlannedFromByVia.PreRegister(engine, "AIStationList_CargoPlanned"); + SQAIStationList_CargoPlannedFromByVia.AddConstructor<void (ScriptStationList_CargoPlannedFromByVia::*)(StationID station_id, CargoID cargo, StationID from), 4>(engine, "xiii"); + + SQAIStationList_CargoPlannedFromByVia.PostRegister(engine); +} + + template <> const char *GetClassName<ScriptStationList_Vehicle, ST_AI>() { return "AIStationList_Vehicle"; } void SQAIStationList_Vehicle_Register(Squirrel *engine) diff --git a/src/script/api/ai_changelog.hpp b/src/script/api/ai_changelog.hpp index 54d69776e..01e05b61e 100644 --- a/src/script/api/ai_changelog.hpp +++ b/src/script/api/ai_changelog.hpp @@ -25,6 +25,14 @@ * \li AIStation::GetCargoPlannedFromVia * \li AIStation::GetCargoPlannedVia * \li AIStation::GetCargoWaitingFromVia + * \li AIStationList_CargoPlannedByFrom + * \li AIStationList_CargoPlannedByVia + * \li AIStationList_CargoPlannedFromByVia + * \li AIStationList_CargoPlannedViaByFrom + * \li AIStationList_CargoWaitingByFrom + * \li AIStationList_CargoWaitingByVia + * \li AIStationList_CargoWaitingFromByVia + * \li AIStationList_CargoWaitingViaByFrom * * \b 1.4.2 * diff --git a/src/script/api/game/game_stationlist.hpp.sq b/src/script/api/game/game_stationlist.hpp.sq index 65138964f..a3cdfaa96 100644 --- a/src/script/api/game/game_stationlist.hpp.sq +++ b/src/script/api/game/game_stationlist.hpp.sq @@ -25,6 +25,145 @@ void SQGSStationList_Register(Squirrel *engine) } +template <> const char *GetClassName<ScriptStationList_Cargo, ST_GS>() { return "GSStationList_Cargo"; } + +void SQGSStationList_Cargo_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_Cargo, ST_GS> SQGSStationList_Cargo("GSStationList_Cargo"); + SQGSStationList_Cargo.PreRegister(engine, "GSList"); + SQGSStationList_Cargo.AddConstructor<void (ScriptStationList_Cargo::*)(ScriptStationList_Cargo::CargoMode mode, ScriptStationList_Cargo::CargoSelector selector, StationID station_id, CargoID cargo, StationID other_station), 6>(engine, "xiiiii"); + + SQGSStationList_Cargo.DefSQConst(engine, ScriptStationList_Cargo::CS_BY_FROM, "CS_BY_FROM"); + SQGSStationList_Cargo.DefSQConst(engine, ScriptStationList_Cargo::CS_VIA_BY_FROM, "CS_VIA_BY_FROM"); + SQGSStationList_Cargo.DefSQConst(engine, ScriptStationList_Cargo::CS_BY_VIA, "CS_BY_VIA"); + SQGSStationList_Cargo.DefSQConst(engine, ScriptStationList_Cargo::CS_FROM_BY_VIA, "CS_FROM_BY_VIA"); + SQGSStationList_Cargo.DefSQConst(engine, ScriptStationList_Cargo::CM_WAITING, "CM_WAITING"); + SQGSStationList_Cargo.DefSQConst(engine, ScriptStationList_Cargo::CM_PLANNED, "CM_PLANNED"); + + SQGSStationList_Cargo.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoWaiting, ST_GS>() { return "GSStationList_CargoWaiting"; } + +void SQGSStationList_CargoWaiting_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoWaiting, ST_GS> SQGSStationList_CargoWaiting("GSStationList_CargoWaiting"); + SQGSStationList_CargoWaiting.PreRegister(engine, "GSStationList_Cargo"); + SQGSStationList_CargoWaiting.AddConstructor<void (ScriptStationList_CargoWaiting::*)(ScriptStationList_Cargo::CargoSelector selector, StationID station_id, CargoID cargo, StationID other_station), 5>(engine, "xiiii"); + + SQGSStationList_CargoWaiting.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoPlanned, ST_GS>() { return "GSStationList_CargoPlanned"; } + +void SQGSStationList_CargoPlanned_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoPlanned, ST_GS> SQGSStationList_CargoPlanned("GSStationList_CargoPlanned"); + SQGSStationList_CargoPlanned.PreRegister(engine, "GSStationList_Cargo"); + SQGSStationList_CargoPlanned.AddConstructor<void (ScriptStationList_CargoPlanned::*)(ScriptStationList_Cargo::CargoSelector selector, StationID station_id, CargoID cargo, StationID other_station), 5>(engine, "xiiii"); + + SQGSStationList_CargoPlanned.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoWaitingByFrom, ST_GS>() { return "GSStationList_CargoWaitingByFrom"; } + +void SQGSStationList_CargoWaitingByFrom_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoWaitingByFrom, ST_GS> SQGSStationList_CargoWaitingByFrom("GSStationList_CargoWaitingByFrom"); + SQGSStationList_CargoWaitingByFrom.PreRegister(engine, "GSStationList_CargoWaiting"); + SQGSStationList_CargoWaitingByFrom.AddConstructor<void (ScriptStationList_CargoWaitingByFrom::*)(StationID station_id, CargoID cargo), 3>(engine, "xii"); + + SQGSStationList_CargoWaitingByFrom.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoWaitingViaByFrom, ST_GS>() { return "GSStationList_CargoWaitingViaByFrom"; } + +void SQGSStationList_CargoWaitingViaByFrom_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoWaitingViaByFrom, ST_GS> SQGSStationList_CargoWaitingViaByFrom("GSStationList_CargoWaitingViaByFrom"); + SQGSStationList_CargoWaitingViaByFrom.PreRegister(engine, "GSStationList_CargoWaiting"); + SQGSStationList_CargoWaitingViaByFrom.AddConstructor<void (ScriptStationList_CargoWaitingViaByFrom::*)(StationID station_id, CargoID cargo, StationID via), 4>(engine, "xiii"); + + SQGSStationList_CargoWaitingViaByFrom.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoWaitingByVia, ST_GS>() { return "GSStationList_CargoWaitingByVia"; } + +void SQGSStationList_CargoWaitingByVia_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoWaitingByVia, ST_GS> SQGSStationList_CargoWaitingByVia("GSStationList_CargoWaitingByVia"); + SQGSStationList_CargoWaitingByVia.PreRegister(engine, "GSStationList_CargoWaiting"); + SQGSStationList_CargoWaitingByVia.AddConstructor<void (ScriptStationList_CargoWaitingByVia::*)(StationID station_id, CargoID cargo), 3>(engine, "xii"); + + SQGSStationList_CargoWaitingByVia.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoWaitingFromByVia, ST_GS>() { return "GSStationList_CargoWaitingFromByVia"; } + +void SQGSStationList_CargoWaitingFromByVia_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoWaitingFromByVia, ST_GS> SQGSStationList_CargoWaitingFromByVia("GSStationList_CargoWaitingFromByVia"); + SQGSStationList_CargoWaitingFromByVia.PreRegister(engine, "GSStationList_CargoWaiting"); + SQGSStationList_CargoWaitingFromByVia.AddConstructor<void (ScriptStationList_CargoWaitingFromByVia::*)(StationID station_id, CargoID cargo, StationID from), 4>(engine, "xiii"); + + SQGSStationList_CargoWaitingFromByVia.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoPlannedByFrom, ST_GS>() { return "GSStationList_CargoPlannedByFrom"; } + +void SQGSStationList_CargoPlannedByFrom_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoPlannedByFrom, ST_GS> SQGSStationList_CargoPlannedByFrom("GSStationList_CargoPlannedByFrom"); + SQGSStationList_CargoPlannedByFrom.PreRegister(engine, "GSStationList_CargoPlanned"); + SQGSStationList_CargoPlannedByFrom.AddConstructor<void (ScriptStationList_CargoPlannedByFrom::*)(StationID station_id, CargoID cargo), 3>(engine, "xii"); + + SQGSStationList_CargoPlannedByFrom.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoPlannedViaByFrom, ST_GS>() { return "GSStationList_CargoPlannedViaByFrom"; } + +void SQGSStationList_CargoPlannedViaByFrom_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoPlannedViaByFrom, ST_GS> SQGSStationList_CargoPlannedViaByFrom("GSStationList_CargoPlannedViaByFrom"); + SQGSStationList_CargoPlannedViaByFrom.PreRegister(engine, "GSStationList_CargoPlanned"); + SQGSStationList_CargoPlannedViaByFrom.AddConstructor<void (ScriptStationList_CargoPlannedViaByFrom::*)(StationID station_id, CargoID cargo, StationID via), 4>(engine, "xiii"); + + SQGSStationList_CargoPlannedViaByFrom.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoPlannedByVia, ST_GS>() { return "GSStationList_CargoPlannedByVia"; } + +void SQGSStationList_CargoPlannedByVia_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoPlannedByVia, ST_GS> SQGSStationList_CargoPlannedByVia("GSStationList_CargoPlannedByVia"); + SQGSStationList_CargoPlannedByVia.PreRegister(engine, "GSStationList_CargoPlanned"); + SQGSStationList_CargoPlannedByVia.AddConstructor<void (ScriptStationList_CargoPlannedByVia::*)(StationID station_id, CargoID cargo), 3>(engine, "xii"); + + SQGSStationList_CargoPlannedByVia.PostRegister(engine); +} + + +template <> const char *GetClassName<ScriptStationList_CargoPlannedFromByVia, ST_GS>() { return "GSStationList_CargoPlannedFromByVia"; } + +void SQGSStationList_CargoPlannedFromByVia_Register(Squirrel *engine) +{ + DefSQClass<ScriptStationList_CargoPlannedFromByVia, ST_GS> SQGSStationList_CargoPlannedFromByVia("GSStationList_CargoPlannedFromByVia"); + SQGSStationList_CargoPlannedFromByVia.PreRegister(engine, "GSStationList_CargoPlanned"); + SQGSStationList_CargoPlannedFromByVia.AddConstructor<void (ScriptStationList_CargoPlannedFromByVia::*)(StationID station_id, CargoID cargo, StationID from), 4>(engine, "xiii"); + + SQGSStationList_CargoPlannedFromByVia.PostRegister(engine); +} + + template <> const char *GetClassName<ScriptStationList_Vehicle, ST_GS>() { return "GSStationList_Vehicle"; } void SQGSStationList_Vehicle_Register(Squirrel *engine) diff --git a/src/script/api/game_changelog.hpp b/src/script/api/game_changelog.hpp index 8ce162e0a..a627e3270 100644 --- a/src/script/api/game_changelog.hpp +++ b/src/script/api/game_changelog.hpp @@ -25,6 +25,14 @@ * \li GSStation::GetCargoPlannedFromVia * \li GSStation::GetCargoPlannedVia * \li GSStation::GetCargoWaitingFromVia + * \li GSStationList_CargoPlannedByFrom + * \li GSStationList_CargoPlannedByVia + * \li GSStationList_CargoPlannedFromByVia + * \li GSStationList_CargoPlannedViaByFrom + * \li GSStationList_CargoWaitingByFrom + * \li GSStationList_CargoWaitingByVia + * \li GSStationList_CargoWaitingFromByVia + * \li GSStationList_CargoWaitingViaByFrom * * \b 1.4.2 * diff --git a/src/script/api/script_stationlist.cpp b/src/script/api/script_stationlist.cpp index 9d88fd8fc..7467c1a34 100644 --- a/src/script/api/script_stationlist.cpp +++ b/src/script/api/script_stationlist.cpp @@ -12,6 +12,7 @@ #include "../../stdafx.h" #include "script_stationlist.hpp" #include "script_vehicle.hpp" +#include "script_cargo.hpp" #include "../../station_base.h" #include "../../vehicle_base.h" @@ -35,3 +36,240 @@ ScriptStationList_Vehicle::ScriptStationList_Vehicle(VehicleID vehicle_id) if (o->IsType(OT_GOTO_STATION)) this->AddItem(o->GetDestination()); } } + +ScriptStationList_Cargo::ScriptStationList_Cargo(ScriptStationList_Cargo::CargoMode mode, + ScriptStationList_Cargo::CargoSelector selector, StationID station_id, CargoID cargo, + StationID other_station) +{ + switch(mode) { + case CM_WAITING: + ScriptStationList_CargoWaiting(selector, station_id, cargo, other_station).SwapList(this); + break; + case CM_PLANNED: + ScriptStationList_CargoPlanned(selector, station_id, cargo, other_station).SwapList(this); + break; + default: + NOT_REACHED(); + } +} + +ScriptStationList_CargoWaiting::ScriptStationList_CargoWaiting( + ScriptStationList_Cargo::CargoSelector selector, StationID station_id, CargoID cargo, + StationID other_station) +{ + switch(selector) { + case CS_BY_FROM: + ScriptStationList_CargoWaitingByFrom(station_id, cargo).SwapList(this); + break; + case CS_VIA_BY_FROM: + ScriptStationList_CargoWaitingViaByFrom(station_id, cargo, other_station).SwapList(this); + break; + case CS_BY_VIA: + ScriptStationList_CargoWaitingByVia(station_id, cargo).SwapList(this); + break; + case CS_FROM_BY_VIA: + ScriptStationList_CargoWaitingFromByVia(station_id, cargo, other_station).SwapList(this); + break; + default: + NOT_REACHED(); + } +} + +ScriptStationList_CargoPlanned::ScriptStationList_CargoPlanned( + ScriptStationList_Cargo::CargoSelector selector, StationID station_id, CargoID cargo, + StationID other_station) +{ + switch(selector) { + case CS_BY_FROM: + ScriptStationList_CargoPlannedByFrom(station_id, cargo).SwapList(this); + break; + case CS_VIA_BY_FROM: + ScriptStationList_CargoPlannedViaByFrom(station_id, cargo, other_station).SwapList(this); + break; + case CS_BY_VIA: + ScriptStationList_CargoPlannedByVia(station_id, cargo).SwapList(this); + break; + case CS_FROM_BY_VIA: + ScriptStationList_CargoPlannedFromByVia(station_id, cargo, other_station).SwapList(this); + break; + default: + NOT_REACHED(); + } +} + +class CargoCollector { +public: + CargoCollector(ScriptStationList_Cargo *parent, StationID station_id, CargoID cargo, + StationID other); + ~CargoCollector() ; + + template<ScriptStationList_Cargo::CargoSelector Tselector> + void Update(StationID from, StationID via, uint amount); + const GoodsEntry *GE() const { return ge; } + +private: + void SetValue(); + + ScriptStationList_Cargo *list; + const GoodsEntry *ge; + StationID other_station; + + StationID last_key; + uint amount; +}; + +CargoCollector::CargoCollector(ScriptStationList_Cargo *parent, + StationID station_id, CargoID cargo, StationID other) : + list(parent), ge(NULL), other_station(other), last_key(INVALID_STATION), amount(0) +{ + if (!ScriptStation::IsValidStation(station_id)) return; + if (!ScriptCargo::IsValidCargo(cargo)) return; + this->ge = &(Station::Get(station_id)->goods[cargo]); +} + +CargoCollector::~CargoCollector() +{ + this->SetValue(); +} + +void CargoCollector::SetValue() +{ + if (this->amount > 0) { + if (this->list->HasItem(this->last_key)) { + this->list->SetValue(this->last_key, + this->list->GetValue(this->last_key) + this->amount); + } else { + this->list->AddItem(this->last_key, this->amount); + } + } +} + +template<ScriptStationList_Cargo::CargoSelector Tselector> +void CargoCollector::Update(StationID from, StationID via, uint amount) +{ + StationID key = INVALID_STATION; + switch (Tselector) { + case ScriptStationList_Cargo::CS_VIA_BY_FROM: + if (via != this->other_station) return; + /* fall through */ + case ScriptStationList_Cargo::CS_BY_FROM: + key = from; + break; + case ScriptStationList_Cargo::CS_FROM_BY_VIA: + if (from != this->other_station) return; + /* fall through */ + case ScriptStationList_Cargo::CS_BY_VIA: + key = via; + break; + } + if (key == this->last_key) { + this->amount += amount; + } else { + this->SetValue(); + this->amount = amount; + this->last_key = key; + } +} + + +template<ScriptStationList_Cargo::CargoSelector Tselector> +void ScriptStationList_CargoWaiting::Add(StationID station_id, CargoID cargo, StationID other_station) +{ + CargoCollector collector(this, station_id, cargo, other_station); + if (collector.GE() == NULL) return; + + StationCargoList::ConstIterator iter = collector.GE()->cargo.Packets()->begin(); + StationCargoList::ConstIterator end = collector.GE()->cargo.Packets()->end(); + for (; iter != end; ++iter) { + collector.Update<Tselector>((*iter)->SourceStation(), iter.GetKey(), (*iter)->Count()); + } +} + + +template<ScriptStationList_Cargo::CargoSelector Tselector> +void ScriptStationList_CargoPlanned::Add(StationID station_id, CargoID cargo, StationID other_station) +{ + CargoCollector collector(this, station_id, cargo, other_station); + if (collector.GE() == NULL) return; + + FlowStatMap::const_iterator iter = collector.GE()->flows.begin(); + FlowStatMap::const_iterator end = collector.GE()->flows.end(); + for (; iter != end; ++iter) { + const FlowStat::SharesMap *shares = iter->second.GetShares(); + uint prev = 0; + for (FlowStat::SharesMap::const_iterator flow_iter = shares->begin(); + flow_iter != shares->end(); ++flow_iter) { + collector.Update<Tselector>(iter->first, flow_iter->second, flow_iter->first - prev); + prev = flow_iter->first; + } + } +} + +ScriptStationList_CargoWaitingByFrom::ScriptStationList_CargoWaitingByFrom(StationID station_id, + CargoID cargo) +{ + this->Add<CS_BY_FROM>(station_id, cargo); +} + +ScriptStationList_CargoWaitingViaByFrom::ScriptStationList_CargoWaitingViaByFrom( + StationID station_id, CargoID cargo, StationID via) +{ + CargoCollector collector(this, station_id, cargo, via); + if (collector.GE() == NULL) return; + + std::pair<StationCargoList::ConstIterator, StationCargoList::ConstIterator> range = + collector.GE()->cargo.Packets()->equal_range(via); + for (StationCargoList::ConstIterator iter = range.first; iter != range.second; ++iter) { + collector.Update<CS_VIA_BY_FROM>((*iter)->SourceStation(), iter.GetKey(), (*iter)->Count()); + } +} + + +ScriptStationList_CargoWaitingByVia::ScriptStationList_CargoWaitingByVia(StationID station_id, + CargoID cargo) +{ + this->Add<CS_BY_VIA>(station_id, cargo); +} + +ScriptStationList_CargoWaitingFromByVia::ScriptStationList_CargoWaitingFromByVia( + StationID station_id, CargoID cargo, StationID from) +{ + this->Add<CS_FROM_BY_VIA>(station_id, cargo, from); +} + +ScriptStationList_CargoPlannedByFrom::ScriptStationList_CargoPlannedByFrom(StationID station_id, + CargoID cargo) +{ + this->Add<CS_BY_FROM>(station_id, cargo); +} + +ScriptStationList_CargoPlannedViaByFrom::ScriptStationList_CargoPlannedViaByFrom( + StationID station_id, CargoID cargo, StationID via) +{ + this->Add<CS_VIA_BY_FROM>(station_id, cargo, via); +} + + +ScriptStationList_CargoPlannedByVia::ScriptStationList_CargoPlannedByVia(StationID station_id, + CargoID cargo) +{ + this->Add<CS_BY_VIA>(station_id, cargo); +} + + +ScriptStationList_CargoPlannedFromByVia::ScriptStationList_CargoPlannedFromByVia( + StationID station_id, CargoID cargo, StationID from) +{ + CargoCollector collector(this, station_id, cargo, from); + if (collector.GE() == NULL) return; + + FlowStatMap::const_iterator iter = collector.GE()->flows.find(from); + if (iter == collector.GE()->flows.end()) return; + const FlowStat::SharesMap *shares = iter->second.GetShares(); + uint prev = 0; + for (FlowStat::SharesMap::const_iterator flow_iter = shares->begin(); + flow_iter != shares->end(); ++flow_iter) { + collector.Update<CS_FROM_BY_VIA>(iter->first, flow_iter->second, flow_iter->first - prev); + prev = flow_iter->first; + } +} diff --git a/src/script/api/script_stationlist.hpp b/src/script/api/script_stationlist.hpp index cd9c98137..bc1947178 100644 --- a/src/script/api/script_stationlist.hpp +++ b/src/script/api/script_stationlist.hpp @@ -29,6 +29,251 @@ public: }; /** + * Creates a list of stations associated with cargo at a station. This is very generic. Use the + * subclasses for all practical purposes. + * @api ai game + * @ingroup ScriptList + */ +class ScriptStationList_Cargo : public ScriptList { +public: + /** + * Criteria of selecting and grouping cargo at a station. + */ + enum CargoSelector { + CS_BY_FROM, ///< Group by origin station. + CS_VIA_BY_FROM, ///< Select by next hop and group by origin station. + CS_BY_VIA, ///< Group by next hop. + CS_FROM_BY_VIA ///< Select by origin station and group by next hop. + }; + + /** + * Ways of associating cargo to stations. + */ + enum CargoMode { + CM_WAITING, ///< Waiting cargo. + CM_PLANNED ///< Planned cargo. + }; + + /** + * Creates a list of stations associated with cargo in the specified way, selected and grouped + * by the chosen criteria. + * @param mode Mode of association, either waiting cargo or planned cargo. + * @param selector Mode of grouping and selecting to be applied. + * @param station_id Station to be queried. + * @param cargo Cargo type to query for. + * @param other_station Other station to restrict the query with. + */ + ScriptStationList_Cargo(ScriptStationList_Cargo::CargoMode mode, ScriptStationList_Cargo::CargoSelector selector, StationID station_id, CargoID cargo, StationID other_station); + +protected: + + /** + * Creates an empty list. + */ + ScriptStationList_Cargo() {} +}; + +/** + * Creates a list of stations associated with cargo waiting at a station. This is very generic. Use + * the subclasses for all practical purposes. + * @api ai game + * @ingroup ScriptList + */ +class ScriptStationList_CargoWaiting : public ScriptStationList_Cargo { +protected: + friend class ScriptStationList_Cargo; + + /** + * Creates an empty list. + */ + ScriptStationList_CargoWaiting() {} + + /** + * Add waiting cargo to the list. + * @param station_id Station to query for waiting cargo. + * @param cargo Cargo type to query for. + * @param other_station Other station to restrict the query with. + */ + template<CargoSelector Tselector> + void Add(StationID station_id, CargoID cargo, StationID other_station = INVALID_STATION); + +public: + + /** + * Creates a list of stations associated with waiting cargo, selected and grouped by the chosen + * criteria. + * @param selector Mode of grouping and selecting to be applied. + * @param station_id Station to be queried. + * @param cargo Cargo type to query for. + * @param other_station Other station to restrict the query with. + */ + ScriptStationList_CargoWaiting(ScriptStationList_Cargo::CargoSelector selector, StationID station_id, CargoID cargo, StationID other_station); +}; + +/** + * Creates a list of stations associated with cargo planned to pass a station. This is very + * generic. Use the subclasses for all practical purposes. + * @api ai game + * @ingroup ScriptList + */ +class ScriptStationList_CargoPlanned : public ScriptStationList_Cargo { +protected: + friend class ScriptStationList_Cargo; + + /** + * Creates an empty list. + */ + ScriptStationList_CargoPlanned() {} + + /** + * Add planned cargo to the list. + * @param station_id Station to query for waiting cargo. + * @param cargo Cargo type to query for. + * @param other_station Other station to restrict the query with. + */ + template<CargoSelector Tselector> + void Add(StationID station_id, CargoID cargo, StationID other_station = INVALID_STATION); + +public: + + /** + * Creates a list of stations associated with cargo planned to pass the station, selected and + * grouped by the chosen criteria. + * @param selector Mode of grouping and selecting to be applied. + * @param station_id Station to be queried. + * @param cargo Cargo type to query for. + * @param other_station Other station to restrict the query with. + */ + ScriptStationList_CargoPlanned(ScriptStationList_Cargo::CargoSelector selector, StationID station_id, CargoID cargo, StationID other_station); +}; + +/** + * Creates a list of origin stations of waiting cargo at a station, with the amounts of cargo + * waiting from each of those origin stations as values. + * @api ai game + * @ingroup ScriptList + */ +class ScriptStationList_CargoWaitingByFrom : public ScriptStationList_CargoWaiting { +public: + /** + * @param station_id Station to query for waiting cargo. + * @param cargo Cargo type to query for. + */ + ScriptStationList_CargoWaitingByFrom(StationID station_id, CargoID cargo); +}; + +/** + * Creates a list of origin stations of cargo waiting at a station for a transfer via another + * station, with the amounts of cargo waiting from each of those origin stations as values. + * @api ai game + * @ingroup ScriptList + */ +class ScriptStationList_CargoWaitingViaByFrom : public ScriptStationList_CargoWaiting { +public: + /** + * @param station_id Station to query for waiting cargo. + * @param cargo Cargo type to query for. + * @param via Next hop to restrict the query with. + */ + ScriptStationList_CargoWaitingViaByFrom(StationID station_id, CargoID cargo, StationID via); +}; + +/** + * Creates a list of next hops of waiting cargo at a station, with the amounts of cargo waiting for + * each of those next hops as values. + * @api ai game + * @ingroup ScriptList + */ +class ScriptStationList_CargoWaitingByVia : public ScriptStationList_CargoWaiting { +public: + /** + * @param station_id Station to query for waiting cargo. + * @param cargo Cargo type to query for. + */ + ScriptStationList_CargoWaitingByVia(StationID station_id, CargoID cargo); +}; + +/** + * Creates a list of next hops of waiting cargo from a specific station at another station, with + * the amounts of cargo waiting for each of those next hops as values. + * @api ai game + * @ingroup ScriptList + */ +class ScriptStationList_CargoWaitingFromByVia : public ScriptStationList_CargoWaiting { +public: + /** + * @param station_id Station to query for waiting cargo. + * @param cargo Cargo type to query for. + * @param from Origin station to restrict the query with. + */ + ScriptStationList_CargoWaitingFromByVia(StationID station_id, CargoID cargo, StationID from); +}; + +/** + * Creates a list of origin stations of cargo planned to pass a station, with the monthly amounts + * of cargo planned for each of those origin stations as values. + * @api ai game + * @ingroup ScriptList + */ +class ScriptStationList_CargoPlannedByFrom : public ScriptStationList_CargoPlanned { +public: + /** + * @param station_id Station to query for planned flows. + * @param cargo Cargo type to query for. + */ + ScriptStationList_CargoPlannedByFrom(StationID station_id, CargoID cargo); +}; + +/** + * Creates a list of origin stations of cargo planned to pass a station going via another station, + * with the monthly amounts of cargo planned for each of those origin stations as values. + * @api ai game + * @ingroup ScriptList + */ +class ScriptStationList_CargoPlannedViaByFrom : public ScriptStationList_CargoPlanned { +public: + /** + * @param station_id Station to query for planned flows. + * @param cargo Cargo type to query for. + * @param via Next hop to restrict the query with. + */ + ScriptStationList_CargoPlannedViaByFrom(StationID station_id, CargoID cargo, StationID via); +}; + +/** + * Creates a list of next hops of cargo planned to pass a station, with the monthly amounts of + * cargo planned for each of those next hops as values. + * Cargo planned to go "via" the station being queried will actually be delivered there. + * @api ai game + * @ingroup ScriptList + */ +class ScriptStationList_CargoPlannedByVia : public ScriptStationList_CargoPlanned { +public: + /** + * @param station_id Station to query for planned flows. + * @param cargo Cargo type to query for. + */ + ScriptStationList_CargoPlannedByVia(StationID station_id, CargoID cargo); +}; + +/** + * Creates a list of next hops of cargo planned to pass a station and originating from another + * station, with the monthly amounts of cargo planned for each of those next hops as values. + * Cargo planned to go "via" the station being queried will actually be delivered there. + * @api ai game + * @ingroup ScriptList + */ +class ScriptStationList_CargoPlannedFromByVia : public ScriptStationList_CargoPlanned { +public: + /** + * @param station_id Station to query for planned flows. + * @param cargo Cargo type to query for. + * @param from Origin station to restrict the query with. + */ + ScriptStationList_CargoPlannedFromByVia(StationID station_id, CargoID cargo, StationID from); +}; + +/** * Creates a list of stations which the vehicle has in its orders. * @api ai game * @ingroup ScriptList diff --git a/src/script/api/template/template_stationlist.hpp.sq b/src/script/api/template/template_stationlist.hpp.sq index f9f49a4ef..5f7bd2812 100644 --- a/src/script/api/template/template_stationlist.hpp.sq +++ b/src/script/api/template/template_stationlist.hpp.sq @@ -21,6 +21,111 @@ namespace SQConvert { } // namespace SQConvert namespace SQConvert { + /* Allow enums to be used as Squirrel parameters */ + template <> inline ScriptStationList_Cargo::CargoSelector GetParam(ForceType<ScriptStationList_Cargo::CargoSelector>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptStationList_Cargo::CargoSelector)tmp; } + template <> inline int Return<ScriptStationList_Cargo::CargoSelector>(HSQUIRRELVM vm, ScriptStationList_Cargo::CargoSelector res) { sq_pushinteger(vm, (int32)res); return 1; } + template <> inline ScriptStationList_Cargo::CargoMode GetParam(ForceType<ScriptStationList_Cargo::CargoMode>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptStationList_Cargo::CargoMode)tmp; } + template <> inline int Return<ScriptStationList_Cargo::CargoMode>(HSQUIRRELVM vm, ScriptStationList_Cargo::CargoMode res) { sq_pushinteger(vm, (int32)res); return 1; } + + /* Allow ScriptStationList_Cargo to be used as Squirrel parameter */ + template <> inline ScriptStationList_Cargo *GetParam(ForceType<ScriptStationList_Cargo *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_Cargo *)instance; } + template <> inline ScriptStationList_Cargo &GetParam(ForceType<ScriptStationList_Cargo &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_Cargo *)instance; } + template <> inline const ScriptStationList_Cargo *GetParam(ForceType<const ScriptStationList_Cargo *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_Cargo *)instance; } + template <> inline const ScriptStationList_Cargo &GetParam(ForceType<const ScriptStationList_Cargo &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_Cargo *)instance; } + template <> inline int Return<ScriptStationList_Cargo *>(HSQUIRRELVM vm, ScriptStationList_Cargo *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList_Cargo", res, NULL, DefSQDestructorCallback<ScriptStationList_Cargo>, true); return 1; } +} // namespace SQConvert + +namespace SQConvert { + /* Allow ScriptStationList_CargoWaiting to be used as Squirrel parameter */ + template <> inline ScriptStationList_CargoWaiting *GetParam(ForceType<ScriptStationList_CargoWaiting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoWaiting *)instance; } + template <> inline ScriptStationList_CargoWaiting &GetParam(ForceType<ScriptStationList_CargoWaiting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoWaiting *)instance; } + template <> inline const ScriptStationList_CargoWaiting *GetParam(ForceType<const ScriptStationList_CargoWaiting *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoWaiting *)instance; } + template <> inline const ScriptStationList_CargoWaiting &GetParam(ForceType<const ScriptStationList_CargoWaiting &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoWaiting *)instance; } + template <> inline int Return<ScriptStationList_CargoWaiting *>(HSQUIRRELVM vm, ScriptStationList_CargoWaiting *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList_CargoWaiting", res, NULL, DefSQDestructorCallback<ScriptStationList_CargoWaiting>, true); return 1; } +} // namespace SQConvert + +namespace SQConvert { + /* Allow ScriptStationList_CargoPlanned to be used as Squirrel parameter */ + template <> inline ScriptStationList_CargoPlanned *GetParam(ForceType<ScriptStationList_CargoPlanned *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoPlanned *)instance; } + template <> inline ScriptStationList_CargoPlanned &GetParam(ForceType<ScriptStationList_CargoPlanned &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoPlanned *)instance; } + template <> inline const ScriptStationList_CargoPlanned *GetParam(ForceType<const ScriptStationList_CargoPlanned *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoPlanned *)instance; } + template <> inline const ScriptStationList_CargoPlanned &GetParam(ForceType<const ScriptStationList_CargoPlanned &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoPlanned *)instance; } + template <> inline int Return<ScriptStationList_CargoPlanned *>(HSQUIRRELVM vm, ScriptStationList_CargoPlanned *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList_CargoPlanned", res, NULL, DefSQDestructorCallback<ScriptStationList_CargoPlanned>, true); return 1; } +} // namespace SQConvert + +namespace SQConvert { + /* Allow ScriptStationList_CargoWaitingByFrom to be used as Squirrel parameter */ + template <> inline ScriptStationList_CargoWaitingByFrom *GetParam(ForceType<ScriptStationList_CargoWaitingByFrom *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoWaitingByFrom *)instance; } + template <> inline ScriptStationList_CargoWaitingByFrom &GetParam(ForceType<ScriptStationList_CargoWaitingByFrom &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoWaitingByFrom *)instance; } + template <> inline const ScriptStationList_CargoWaitingByFrom *GetParam(ForceType<const ScriptStationList_CargoWaitingByFrom *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoWaitingByFrom *)instance; } + template <> inline const ScriptStationList_CargoWaitingByFrom &GetParam(ForceType<const ScriptStationList_CargoWaitingByFrom &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoWaitingByFrom *)instance; } + template <> inline int Return<ScriptStationList_CargoWaitingByFrom *>(HSQUIRRELVM vm, ScriptStationList_CargoWaitingByFrom *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList_CargoWaitingByFrom", res, NULL, DefSQDestructorCallback<ScriptStationList_CargoWaitingByFrom>, true); return 1; } +} // namespace SQConvert + +namespace SQConvert { + /* Allow ScriptStationList_CargoWaitingViaByFrom to be used as Squirrel parameter */ + template <> inline ScriptStationList_CargoWaitingViaByFrom *GetParam(ForceType<ScriptStationList_CargoWaitingViaByFrom *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoWaitingViaByFrom *)instance; } + template <> inline ScriptStationList_CargoWaitingViaByFrom &GetParam(ForceType<ScriptStationList_CargoWaitingViaByFrom &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoWaitingViaByFrom *)instance; } + template <> inline const ScriptStationList_CargoWaitingViaByFrom *GetParam(ForceType<const ScriptStationList_CargoWaitingViaByFrom *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoWaitingViaByFrom *)instance; } + template <> inline const ScriptStationList_CargoWaitingViaByFrom &GetParam(ForceType<const ScriptStationList_CargoWaitingViaByFrom &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoWaitingViaByFrom *)instance; } + template <> inline int Return<ScriptStationList_CargoWaitingViaByFrom *>(HSQUIRRELVM vm, ScriptStationList_CargoWaitingViaByFrom *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList_CargoWaitingViaByFrom", res, NULL, DefSQDestructorCallback<ScriptStationList_CargoWaitingViaByFrom>, true); return 1; } +} // namespace SQConvert + +namespace SQConvert { + /* Allow ScriptStationList_CargoWaitingByVia to be used as Squirrel parameter */ + template <> inline ScriptStationList_CargoWaitingByVia *GetParam(ForceType<ScriptStationList_CargoWaitingByVia *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoWaitingByVia *)instance; } + template <> inline ScriptStationList_CargoWaitingByVia &GetParam(ForceType<ScriptStationList_CargoWaitingByVia &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoWaitingByVia *)instance; } + template <> inline const ScriptStationList_CargoWaitingByVia *GetParam(ForceType<const ScriptStationList_CargoWaitingByVia *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoWaitingByVia *)instance; } + template <> inline const ScriptStationList_CargoWaitingByVia &GetParam(ForceType<const ScriptStationList_CargoWaitingByVia &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoWaitingByVia *)instance; } + template <> inline int Return<ScriptStationList_CargoWaitingByVia *>(HSQUIRRELVM vm, ScriptStationList_CargoWaitingByVia *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList_CargoWaitingByVia", res, NULL, DefSQDestructorCallback<ScriptStationList_CargoWaitingByVia>, true); return 1; } +} // namespace SQConvert + +namespace SQConvert { + /* Allow ScriptStationList_CargoWaitingFromByVia to be used as Squirrel parameter */ + template <> inline ScriptStationList_CargoWaitingFromByVia *GetParam(ForceType<ScriptStationList_CargoWaitingFromByVia *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoWaitingFromByVia *)instance; } + template <> inline ScriptStationList_CargoWaitingFromByVia &GetParam(ForceType<ScriptStationList_CargoWaitingFromByVia &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoWaitingFromByVia *)instance; } + template <> inline const ScriptStationList_CargoWaitingFromByVia *GetParam(ForceType<const ScriptStationList_CargoWaitingFromByVia *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoWaitingFromByVia *)instance; } + template <> inline const ScriptStationList_CargoWaitingFromByVia &GetParam(ForceType<const ScriptStationList_CargoWaitingFromByVia &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoWaitingFromByVia *)instance; } + template <> inline int Return<ScriptStationList_CargoWaitingFromByVia *>(HSQUIRRELVM vm, ScriptStationList_CargoWaitingFromByVia *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList_CargoWaitingFromByVia", res, NULL, DefSQDestructorCallback<ScriptStationList_CargoWaitingFromByVia>, true); return 1; } +} // namespace SQConvert + +namespace SQConvert { + /* Allow ScriptStationList_CargoPlannedByFrom to be used as Squirrel parameter */ + template <> inline ScriptStationList_CargoPlannedByFrom *GetParam(ForceType<ScriptStationList_CargoPlannedByFrom *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoPlannedByFrom *)instance; } + template <> inline ScriptStationList_CargoPlannedByFrom &GetParam(ForceType<ScriptStationList_CargoPlannedByFrom &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoPlannedByFrom *)instance; } + template <> inline const ScriptStationList_CargoPlannedByFrom *GetParam(ForceType<const ScriptStationList_CargoPlannedByFrom *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoPlannedByFrom *)instance; } + template <> inline const ScriptStationList_CargoPlannedByFrom &GetParam(ForceType<const ScriptStationList_CargoPlannedByFrom &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoPlannedByFrom *)instance; } + template <> inline int Return<ScriptStationList_CargoPlannedByFrom *>(HSQUIRRELVM vm, ScriptStationList_CargoPlannedByFrom *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList_CargoPlannedByFrom", res, NULL, DefSQDestructorCallback<ScriptStationList_CargoPlannedByFrom>, true); return 1; } +} // namespace SQConvert + +namespace SQConvert { + /* Allow ScriptStationList_CargoPlannedViaByFrom to be used as Squirrel parameter */ + template <> inline ScriptStationList_CargoPlannedViaByFrom *GetParam(ForceType<ScriptStationList_CargoPlannedViaByFrom *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoPlannedViaByFrom *)instance; } + template <> inline ScriptStationList_CargoPlannedViaByFrom &GetParam(ForceType<ScriptStationList_CargoPlannedViaByFrom &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoPlannedViaByFrom *)instance; } + template <> inline const ScriptStationList_CargoPlannedViaByFrom *GetParam(ForceType<const ScriptStationList_CargoPlannedViaByFrom *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoPlannedViaByFrom *)instance; } + template <> inline const ScriptStationList_CargoPlannedViaByFrom &GetParam(ForceType<const ScriptStationList_CargoPlannedViaByFrom &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoPlannedViaByFrom *)instance; } + template <> inline int Return<ScriptStationList_CargoPlannedViaByFrom *>(HSQUIRRELVM vm, ScriptStationList_CargoPlannedViaByFrom *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList_CargoPlannedViaByFrom", res, NULL, DefSQDestructorCallback<ScriptStationList_CargoPlannedViaByFrom>, true); return 1; } +} // namespace SQConvert + +namespace SQConvert { + /* Allow ScriptStationList_CargoPlannedByVia to be used as Squirrel parameter */ + template <> inline ScriptStationList_CargoPlannedByVia *GetParam(ForceType<ScriptStationList_CargoPlannedByVia *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoPlannedByVia *)instance; } + template <> inline ScriptStationList_CargoPlannedByVia &GetParam(ForceType<ScriptStationList_CargoPlannedByVia &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoPlannedByVia *)instance; } + template <> inline const ScriptStationList_CargoPlannedByVia *GetParam(ForceType<const ScriptStationList_CargoPlannedByVia *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoPlannedByVia *)instance; } + template <> inline const ScriptStationList_CargoPlannedByVia &GetParam(ForceType<const ScriptStationList_CargoPlannedByVia &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoPlannedByVia *)instance; } + template <> inline int Return<ScriptStationList_CargoPlannedByVia *>(HSQUIRRELVM vm, ScriptStationList_CargoPlannedByVia *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList_CargoPlannedByVia", res, NULL, DefSQDestructorCallback<ScriptStationList_CargoPlannedByVia>, true); return 1; } +} // namespace SQConvert + +namespace SQConvert { + /* Allow ScriptStationList_CargoPlannedFromByVia to be used as Squirrel parameter */ + template <> inline ScriptStationList_CargoPlannedFromByVia *GetParam(ForceType<ScriptStationList_CargoPlannedFromByVia *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoPlannedFromByVia *)instance; } + template <> inline ScriptStationList_CargoPlannedFromByVia &GetParam(ForceType<ScriptStationList_CargoPlannedFromByVia &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoPlannedFromByVia *)instance; } + template <> inline const ScriptStationList_CargoPlannedFromByVia *GetParam(ForceType<const ScriptStationList_CargoPlannedFromByVia *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_CargoPlannedFromByVia *)instance; } + template <> inline const ScriptStationList_CargoPlannedFromByVia &GetParam(ForceType<const ScriptStationList_CargoPlannedFromByVia &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_CargoPlannedFromByVia *)instance; } + template <> inline int Return<ScriptStationList_CargoPlannedFromByVia *>(HSQUIRRELVM vm, ScriptStationList_CargoPlannedFromByVia *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList_CargoPlannedFromByVia", res, NULL, DefSQDestructorCallback<ScriptStationList_CargoPlannedFromByVia>, true); return 1; } +} // namespace SQConvert + +namespace SQConvert { /* Allow ScriptStationList_Vehicle to be used as Squirrel parameter */ template <> inline ScriptStationList_Vehicle *GetParam(ForceType<ScriptStationList_Vehicle *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptStationList_Vehicle *)instance; } template <> inline ScriptStationList_Vehicle &GetParam(ForceType<ScriptStationList_Vehicle &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptStationList_Vehicle *)instance; } |