openttd updated to 1.5.0-beta2
--HG-- branch : openttd
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $Id: ai_list.hpp.sq 23379 2011-11-30 14:11:02Z truebrain $ */
|
||||
/* $Id: ai_list.hpp.sq 26894 2014-09-21 16:25:15Z fonsinchen $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -40,6 +40,7 @@ void SQAIList_Register(Squirrel *engine)
|
||||
SQAIList.DefSQMethod(engine, &ScriptList::SetValue, "SetValue", 3, "xii");
|
||||
SQAIList.DefSQMethod(engine, &ScriptList::Sort, "Sort", 3, "xib");
|
||||
SQAIList.DefSQMethod(engine, &ScriptList::AddList, "AddList", 2, "xx");
|
||||
SQAIList.DefSQMethod(engine, &ScriptList::SwapList, "SwapList", 2, "xx");
|
||||
SQAIList.DefSQMethod(engine, &ScriptList::RemoveAboveValue, "RemoveAboveValue", 2, "xi");
|
||||
SQAIList.DefSQMethod(engine, &ScriptList::RemoveBelowValue, "RemoveBelowValue", 2, "xi");
|
||||
SQAIList.DefSQMethod(engine, &ScriptList::RemoveBetweenValue, "RemoveBetweenValue", 3, "xii");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: ai_station.hpp.sq 26396 2014-03-10 22:18:53Z zuu $ */
|
||||
/* $Id: ai_station.hpp.sq 26892 2014-09-21 16:20:14Z fonsinchen $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -49,6 +49,11 @@ void SQAIStation_Register(Squirrel *engine)
|
||||
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoWaiting, "GetCargoWaiting", 3, ".ii");
|
||||
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoWaitingFrom, "GetCargoWaitingFrom", 4, ".iii");
|
||||
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoWaitingVia, "GetCargoWaitingVia", 4, ".iii");
|
||||
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoWaitingFromVia, "GetCargoWaitingFromVia", 5, ".iiii");
|
||||
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoPlanned, "GetCargoPlanned", 3, ".ii");
|
||||
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoPlannedFrom, "GetCargoPlannedFrom", 4, ".iii");
|
||||
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoPlannedVia, "GetCargoPlannedVia", 4, ".iii");
|
||||
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoPlannedFromVia, "GetCargoPlannedFromVia", 5, ".iiii");
|
||||
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::HasCargoRating, "HasCargoRating", 3, ".ii");
|
||||
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoRating, "GetCargoRating", 3, ".ii");
|
||||
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCoverageRadius, "GetCoverageRadius", 2, ".i");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: ai_stationlist.hpp.sq 23379 2011-11-30 14:11:02Z truebrain $ */
|
||||
/* $Id: ai_stationlist.hpp.sq 26893 2014-09-21 16:20:48Z fonsinchen $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -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)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: ai_changelog.hpp 26439 2014-04-01 18:29:34Z frosch $ */
|
||||
/* $Id: ai_changelog.hpp 27032 2014-10-23 09:47:15Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,42 @@
|
||||
* functions may still be available if you return an older API version
|
||||
* in GetAPIVersion() in info.nut.
|
||||
*
|
||||
* \b 1.5.0
|
||||
*
|
||||
* 1.5.0 is not yet released. The following changes are not set in stone yet.
|
||||
*
|
||||
* API additions:
|
||||
* \li AIList::SwapList
|
||||
* \li AIStation::GetCargoPlanned
|
||||
* \li AIStation::GetCargoPlannedFrom
|
||||
* \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.4
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.4.3
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.4.2
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.4.1
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.4.0
|
||||
*
|
||||
* API additions:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: game_list.hpp.sq 23737 2012-01-03 20:37:56Z truebrain $ */
|
||||
/* $Id: game_list.hpp.sq 26894 2014-09-21 16:25:15Z fonsinchen $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -40,6 +40,7 @@ void SQGSList_Register(Squirrel *engine)
|
||||
SQGSList.DefSQMethod(engine, &ScriptList::SetValue, "SetValue", 3, "xii");
|
||||
SQGSList.DefSQMethod(engine, &ScriptList::Sort, "Sort", 3, "xib");
|
||||
SQGSList.DefSQMethod(engine, &ScriptList::AddList, "AddList", 2, "xx");
|
||||
SQGSList.DefSQMethod(engine, &ScriptList::SwapList, "SwapList", 2, "xx");
|
||||
SQGSList.DefSQMethod(engine, &ScriptList::RemoveAboveValue, "RemoveAboveValue", 2, "xi");
|
||||
SQGSList.DefSQMethod(engine, &ScriptList::RemoveBelowValue, "RemoveBelowValue", 2, "xi");
|
||||
SQGSList.DefSQMethod(engine, &ScriptList::RemoveBetweenValue, "RemoveBetweenValue", 3, "xii");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: game_news.hpp.sq 24286 2012-05-26 14:16:12Z frosch $ */
|
||||
/* $Id: game_news.hpp.sq 27164 2015-02-22 17:25:29Z alberth $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -28,8 +28,13 @@ void SQGSNews_Register(Squirrel *engine)
|
||||
SQGSNews.DefSQConst(engine, ScriptNews::NT_ACCEPTANCE, "NT_ACCEPTANCE");
|
||||
SQGSNews.DefSQConst(engine, ScriptNews::NT_SUBSIDIES, "NT_SUBSIDIES");
|
||||
SQGSNews.DefSQConst(engine, ScriptNews::NT_GENERAL, "NT_GENERAL");
|
||||
SQGSNews.DefSQConst(engine, ScriptNews::NR_NONE, "NR_NONE");
|
||||
SQGSNews.DefSQConst(engine, ScriptNews::NR_TILE, "NR_TILE");
|
||||
SQGSNews.DefSQConst(engine, ScriptNews::NR_STATION, "NR_STATION");
|
||||
SQGSNews.DefSQConst(engine, ScriptNews::NR_INDUSTRY, "NR_INDUSTRY");
|
||||
SQGSNews.DefSQConst(engine, ScriptNews::NR_TOWN, "NR_TOWN");
|
||||
|
||||
SQGSNews.DefSQStaticMethod(engine, &ScriptNews::Create, "Create", 4, ".i.i");
|
||||
SQGSNews.DefSQStaticMethod(engine, &ScriptNews::Create, "Create", 6, ".i.iii");
|
||||
|
||||
SQGSNews.PostRegister(engine);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: game_station.hpp.sq 26396 2014-03-10 22:18:53Z zuu $ */
|
||||
/* $Id: game_station.hpp.sq 26892 2014-09-21 16:20:14Z fonsinchen $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -50,6 +50,11 @@ void SQGSStation_Register(Squirrel *engine)
|
||||
SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoWaiting, "GetCargoWaiting", 3, ".ii");
|
||||
SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoWaitingFrom, "GetCargoWaitingFrom", 4, ".iii");
|
||||
SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoWaitingVia, "GetCargoWaitingVia", 4, ".iii");
|
||||
SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoWaitingFromVia, "GetCargoWaitingFromVia", 5, ".iiii");
|
||||
SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoPlanned, "GetCargoPlanned", 3, ".ii");
|
||||
SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoPlannedFrom, "GetCargoPlannedFrom", 4, ".iii");
|
||||
SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoPlannedVia, "GetCargoPlannedVia", 4, ".iii");
|
||||
SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoPlannedFromVia, "GetCargoPlannedFromVia", 5, ".iiii");
|
||||
SQGSStation.DefSQStaticMethod(engine, &ScriptStation::HasCargoRating, "HasCargoRating", 3, ".ii");
|
||||
SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoRating, "GetCargoRating", 3, ".ii");
|
||||
SQGSStation.DefSQStaticMethod(engine, &ScriptStation::GetCoverageRadius, "GetCoverageRadius", 2, ".i");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: game_stationlist.hpp.sq 23737 2012-01-03 20:37:56Z truebrain $ */
|
||||
/* $Id: game_stationlist.hpp.sq 26893 2014-09-21 16:20:48Z fonsinchen $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -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)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: game_window.hpp.sq 26320 2014-02-09 13:04:50Z alberth $ */
|
||||
/* $Id: game_window.hpp.sq 27152 2015-02-15 14:56:21Z frosch $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -137,6 +137,7 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WC_NEWGRF_INSPECT, "WC_NEWGRF_INSPECT");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SPRITE_ALIGNER, "WC_SPRITE_ALIGNER");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WC_LINKGRAPH_LEGEND, "WC_LINKGRAPH_LEGEND");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SAVE_PRESET, "WC_SAVE_PRESET");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WC_INVALID, "WC_INVALID");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::TC_BLUE, "TC_BLUE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::TC_SILVER, "TC_SILVER");
|
||||
@@ -212,6 +213,9 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AP_BTN_DONTHILIGHT, "WID_AP_BTN_DONTHILIGHT");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AP_BTN_DOHILIGHT, "WID_AP_BTN_DOHILIGHT");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_CAPTION, "WID_RV_CAPTION");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_SORT_ASCENDING_DESCENDING, "WID_RV_SORT_ASCENDING_DESCENDING");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_SHOW_HIDDEN_ENGINES, "WID_RV_SHOW_HIDDEN_ENGINES");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_SORT_DROPDOWN, "WID_RV_SORT_DROPDOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_LEFT_MATRIX, "WID_RV_LEFT_MATRIX");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_LEFT_SCROLLBAR, "WID_RV_LEFT_SCROLLBAR");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_RIGHT_MATRIX, "WID_RV_RIGHT_MATRIX");
|
||||
@@ -236,13 +240,15 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BBS_BRIDGE_LIST, "WID_BBS_BRIDGE_LIST");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BBS_SCROLLBAR, "WID_BBS_SCROLLBAR");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_CAPTION, "WID_BV_CAPTION");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_SORT_ASSENDING_DESCENDING, "WID_BV_SORT_ASSENDING_DESCENDING");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_SORT_ASCENDING_DESCENDING, "WID_BV_SORT_ASCENDING_DESCENDING");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_SORT_DROPDOWN, "WID_BV_SORT_DROPDOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_CARGO_FILTER_DROPDOWN, "WID_BV_CARGO_FILTER_DROPDOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_SHOW_HIDDEN_ENGINES, "WID_BV_SHOW_HIDDEN_ENGINES");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_LIST, "WID_BV_LIST");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_SCROLLBAR, "WID_BV_SCROLLBAR");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_PANEL, "WID_BV_PANEL");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_BUILD, "WID_BV_BUILD");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_SHOW_HIDE, "WID_BV_SHOW_HIDE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_BUILD_SEL, "WID_BV_BUILD_SEL");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_RENAME, "WID_BV_RENAME");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_PANEL, "WID_C_PANEL");
|
||||
@@ -454,9 +460,10 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_MAPSIZE_Y_PULLDOWN, "WID_GL_MAPSIZE_Y_PULLDOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_TOWN_PULLDOWN, "WID_GL_TOWN_PULLDOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_INDUSTRY_PULLDOWN, "WID_GL_INDUSTRY_PULLDOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_RANDOM_EDITBOX, "WID_GL_RANDOM_EDITBOX");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_RANDOM_BUTTON, "WID_GL_RANDOM_BUTTON");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_GENERATE_BUTTON, "WID_GL_GENERATE_BUTTON");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_MAX_HEIGHTLEVEL_DOWN, "WID_GL_MAX_HEIGHTLEVEL_DOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_MAX_HEIGHTLEVEL_TEXT, "WID_GL_MAX_HEIGHTLEVEL_TEXT");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_MAX_HEIGHTLEVEL_UP, "WID_GL_MAX_HEIGHTLEVEL_UP");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_START_DATE_DOWN, "WID_GL_START_DATE_DOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_START_DATE_TEXT, "WID_GL_START_DATE_TEXT");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_START_DATE_UP, "WID_GL_START_DATE_UP");
|
||||
@@ -789,6 +796,7 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_REMOVE, "WID_NS_REMOVE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_MOVE_UP, "WID_NS_MOVE_UP");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_MOVE_DOWN, "WID_NS_MOVE_DOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_UPGRADE, "WID_NS_UPGRADE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_FILTER, "WID_NS_FILTER");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_FILE_LIST, "WID_NS_FILE_LIST");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_SCROLLBAR, "WID_NS_SCROLLBAR");
|
||||
@@ -808,6 +816,11 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_CONTENT_DOWNLOAD2, "WID_NS_CONTENT_DOWNLOAD2");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_SHOW_REMOVE, "WID_NS_SHOW_REMOVE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_SHOW_APPLY, "WID_NS_SHOW_APPLY");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SVP_PRESET_LIST, "WID_SVP_PRESET_LIST");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SVP_SCROLLBAR, "WID_SVP_SCROLLBAR");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SVP_EDITBOX, "WID_SVP_EDITBOX");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SVP_CANCEL, "WID_SVP_CANCEL");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SVP_SAVE, "WID_SVP_SAVE");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SP_PROGRESS_BAR, "WID_SP_PROGRESS_BAR");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SP_PROGRESS_TEXT, "WID_SP_PROGRESS_TEXT");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_PANEL, "WID_N_PANEL");
|
||||
@@ -991,7 +1004,7 @@ void SQGSWindow_Register(Squirrel *engine)
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_LANG_DROPDOWN, "WID_GO_LANG_DROPDOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_RESOLUTION_DROPDOWN, "WID_GO_RESOLUTION_DROPDOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_FULLSCREEN_BUTTON, "WID_GO_FULLSCREEN_BUTTON");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_SCREENSHOT_DROPDOWN, "WID_GO_SCREENSHOT_DROPDOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_GUI_ZOOM_DROPDOWN, "WID_GO_GUI_ZOOM_DROPDOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BASE_GRF_DROPDOWN, "WID_GO_BASE_GRF_DROPDOWN");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BASE_GRF_STATUS, "WID_GO_BASE_GRF_STATUS");
|
||||
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BASE_GRF_TEXTFILE, "WID_GO_BASE_GRF_TEXTFILE");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: game_changelog.hpp 26439 2014-04-01 18:29:34Z frosch $ */
|
||||
/* $Id: game_changelog.hpp 27164 2015-02-22 17:25:29Z alberth $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,49 @@
|
||||
* functions may still be available if you return an older API version
|
||||
* in GetAPIVersion() in info.nut.
|
||||
*
|
||||
* \b 1.5.0
|
||||
*
|
||||
* 1.5.0 is not yet released. The following changes are not set in stone yet.
|
||||
*
|
||||
* API additions:
|
||||
* \li GSList::SwapList
|
||||
* \li GSStation::GetCargoPlanned
|
||||
* \li GSStation::GetCargoPlannedFrom
|
||||
* \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
|
||||
*
|
||||
* Other changes:
|
||||
* \li GSNews::Create takes two extra parameters to refer to a location, station,
|
||||
* industry, or town. The user can click at the news message to jump to the
|
||||
* referred location.
|
||||
*
|
||||
* \b 1.4.4
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.4.3
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.4.2
|
||||
*
|
||||
* Other changes:
|
||||
* \li GSCargoMonitor delivery and pickup monitor functions have improved boundary checking for
|
||||
* their parameters, and return \c -1 if they are found out of bounds.
|
||||
*
|
||||
* \b 1.4.1
|
||||
*
|
||||
* No changes
|
||||
*
|
||||
* \b 1.4.0
|
||||
*
|
||||
* API additions:
|
||||
@@ -28,8 +71,8 @@
|
||||
* \li GSGoal::SetProgress
|
||||
* \li GSGoal::SetText
|
||||
* \li GSStation::HasCargoRating
|
||||
* \li AIStation::GetCargoWaitingFrom
|
||||
* \li AIStation::GetCargoWaitingVia
|
||||
* \li GSStation::GetCargoWaitingFrom
|
||||
* \li GSStation::GetCargoWaitingVia
|
||||
* \li GSStoryPage
|
||||
* \li GSStoryPageList
|
||||
* \li GSStoryPageElementList
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_accounting.cpp 23355 2011-11-29 23:15:35Z truebrain $ */
|
||||
/* $Id: script_accounting.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "../../stdafx.h"
|
||||
#include "script_accounting.hpp"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
Money ScriptAccounting::GetCosts()
|
||||
{
|
||||
return this->GetDoCommandCosts();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_admin.cpp 23740 2012-01-03 21:32:51Z rubidium $ */
|
||||
/* $Id: script_admin.cpp 26774 2014-09-06 17:46:56Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -14,6 +14,9 @@
|
||||
#include "script_log.hpp"
|
||||
#include "../../network/network_admin.h"
|
||||
#include "../script_instance.hpp"
|
||||
#include "../../string_func.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptAdmin::MakeJSON(HSQUIRRELVM vm, SQInteger index, int max_depth, std::string &data)
|
||||
{
|
||||
@@ -28,18 +31,15 @@
|
||||
sq_getinteger(vm, index, &res);
|
||||
|
||||
char buf[10];
|
||||
snprintf(buf, sizeof(buf), "%d", (int32)res);
|
||||
seprintf(buf, lastof(buf), "%d", (int32)res);
|
||||
data = buf;
|
||||
return true;
|
||||
}
|
||||
|
||||
case OT_STRING: {
|
||||
const SQChar *res;
|
||||
sq_getstring(vm, index, &res);
|
||||
const SQChar *buf;
|
||||
sq_getstring(vm, index, &buf);
|
||||
|
||||
/* @bug if a string longer than 512 characters is given to SQ2OTTD, the
|
||||
* internal buffer overflows. */
|
||||
const char *buf = SQ2OTTD(res);
|
||||
size_t len = strlen(buf) + 1;
|
||||
if (len >= 255) {
|
||||
ScriptLog::Error("Maximum string length is 254 chars. No data sent.");
|
||||
@@ -126,10 +126,10 @@
|
||||
|
||||
/* static */ SQInteger ScriptAdmin::Send(HSQUIRRELVM vm)
|
||||
{
|
||||
if (sq_gettop(vm) - 1 != 1) return sq_throwerror(vm, _SC("wrong number of parameters"));
|
||||
if (sq_gettop(vm) - 1 != 1) return sq_throwerror(vm, "wrong number of parameters");
|
||||
|
||||
if (sq_gettype(vm, 2) != OT_TABLE) {
|
||||
return sq_throwerror(vm, _SC("ScriptAdmin::Send requires a table as first parameter. No data sent."));
|
||||
return sq_throwerror(vm, "ScriptAdmin::Send requires a table as first parameter. No data sent.");
|
||||
}
|
||||
|
||||
std::string json;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_airport.cpp 23633 2011-12-19 21:05:36Z truebrain $ */
|
||||
/* $Id: script_airport.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "../../station_base.h"
|
||||
#include "../../town.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptAirport::IsValidAirportType(AirportType type)
|
||||
{
|
||||
return IsAirportInformationAvailable(type) && ::AirportSpec::Get(type)->IsAvailable();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_base.cpp 25148 2013-04-06 11:59:27Z rubidium $ */
|
||||
/* $Id: script_base.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "../../network/network.h"
|
||||
#include "../../core/random_func.hpp"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ uint32 ScriptBase::Rand()
|
||||
{
|
||||
/* We pick RandomRange if we are in SP (so when saved, we do the same over and over)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_basestation.cpp 26307 2014-02-06 19:50:34Z zuu $ */
|
||||
/* $Id: script_basestation.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "../../strings_func.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptBaseStation::IsValidBaseStation(StationID station_id)
|
||||
{
|
||||
const BaseStation *st = ::BaseStation::GetIfValid(station_id);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_bridge.cpp 26149 2013-12-08 15:44:09Z frosch $ */
|
||||
/* $Id: script_bridge.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "../../strings_func.h"
|
||||
#include "../../date_func.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptBridge::IsValidBridge(BridgeID bridge_id)
|
||||
{
|
||||
return bridge_id < MAX_BRIDGES && ::GetBridgeSpec(bridge_id)->avail_year <= _cur_year;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_bridgelist.cpp 23355 2011-11-29 23:15:35Z truebrain $ */
|
||||
/* $Id: script_bridgelist.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "script_bridge.hpp"
|
||||
#include "../../bridge.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptBridgeList::ScriptBridgeList()
|
||||
{
|
||||
for (byte j = 0; j < MAX_BRIDGES; j++) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_cargo.cpp 26396 2014-03-10 22:18:53Z zuu $ */
|
||||
/* $Id: script_cargo.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "../../core/bitmath_func.hpp"
|
||||
#include "../../settings_type.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptCargo::IsValidCargo(CargoID cargo_type)
|
||||
{
|
||||
return (cargo_type < NUM_CARGO && ::CargoSpec::Get(cargo_type)->IsValid());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_cargolist.cpp 23355 2011-11-29 23:15:35Z truebrain $ */
|
||||
/* $Id: script_cargolist.cpp 26580 2014-05-11 18:02:11Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "../../industry.h"
|
||||
#include "../../station_base.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptCargoList::ScriptCargoList()
|
||||
{
|
||||
const CargoSpec *cs;
|
||||
@@ -57,6 +59,6 @@ ScriptCargoList_StationAccepting::ScriptCargoList_StationAccepting(StationID sta
|
||||
|
||||
Station *st = ::Station::Get(station_id);
|
||||
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||
if (HasBit(st->goods[i].acceptance_pickup, GoodsEntry::GES_ACCEPTANCE)) this->AddItem(i);
|
||||
if (HasBit(st->goods[i].status, GoodsEntry::GES_ACCEPTANCE)) this->AddItem(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_cargomonitor.cpp 24406 2012-07-15 17:11:14Z alberth $ */
|
||||
/* $Id: script_cargomonitor.cpp 26685 2014-07-12 17:04:14Z alberth $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -10,29 +10,54 @@
|
||||
/** @file script_cargomonitor.cpp Code to monitor cargo pickup and deliveries by companies. */
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "script_cargo.hpp"
|
||||
#include "script_cargomonitor.hpp"
|
||||
#include "../../town.h"
|
||||
#include "../../industry.h"
|
||||
|
||||
/* static */ uint32 ScriptCargoMonitor::GetTownDeliveryAmount(ScriptCompany::CompanyID company, CargoID cargo, TownID town_id, bool keep_monitoring)
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ int32 ScriptCargoMonitor::GetTownDeliveryAmount(ScriptCompany::CompanyID company, CargoID cargo, TownID town_id, bool keep_monitoring)
|
||||
{
|
||||
CargoMonitorID monitor = EncodeCargoTownMonitor(static_cast<CompanyID>(company), cargo, town_id);
|
||||
CompanyID cid = static_cast<CompanyID>(company);
|
||||
if (cid < OWNER_BEGIN || cid >= MAX_COMPANIES) return -1;
|
||||
if (!ScriptCargo::IsValidCargo(cargo)) return -1;
|
||||
if (!::Town::IsValidID(town_id)) return -1;
|
||||
|
||||
CargoMonitorID monitor = EncodeCargoTownMonitor(cid, cargo, town_id);
|
||||
return GetDeliveryAmount(monitor, keep_monitoring);
|
||||
}
|
||||
|
||||
/* static */ uint32 ScriptCargoMonitor::GetIndustryDeliveryAmount(ScriptCompany::CompanyID company, CargoID cargo, IndustryID industry_id, bool keep_monitoring)
|
||||
/* static */ int32 ScriptCargoMonitor::GetIndustryDeliveryAmount(ScriptCompany::CompanyID company, CargoID cargo, IndustryID industry_id, bool keep_monitoring)
|
||||
{
|
||||
CargoMonitorID monitor = EncodeCargoIndustryMonitor(static_cast<CompanyID>(company), cargo, industry_id);
|
||||
CompanyID cid = static_cast<CompanyID>(company);
|
||||
if (cid < OWNER_BEGIN || cid >= MAX_COMPANIES) return -1;
|
||||
if (!ScriptCargo::IsValidCargo(cargo)) return -1;
|
||||
if (!::Industry::IsValidID(industry_id)) return -1;
|
||||
|
||||
CargoMonitorID monitor = EncodeCargoIndustryMonitor(cid, cargo, industry_id);
|
||||
return GetDeliveryAmount(monitor, keep_monitoring);
|
||||
}
|
||||
|
||||
/* static */ uint32 ScriptCargoMonitor::GetTownPickupAmount(ScriptCompany::CompanyID company, CargoID cargo, TownID town_id, bool keep_monitoring)
|
||||
/* static */ int32 ScriptCargoMonitor::GetTownPickupAmount(ScriptCompany::CompanyID company, CargoID cargo, TownID town_id, bool keep_monitoring)
|
||||
{
|
||||
CargoMonitorID monitor = EncodeCargoTownMonitor(static_cast<CompanyID>(company), cargo, town_id);
|
||||
CompanyID cid = static_cast<CompanyID>(company);
|
||||
if (cid < OWNER_BEGIN || cid >= MAX_COMPANIES) return -1;
|
||||
if (!ScriptCargo::IsValidCargo(cargo)) return -1;
|
||||
if (!::Town::IsValidID(town_id)) return -1;
|
||||
|
||||
CargoMonitorID monitor = EncodeCargoTownMonitor(cid, cargo, town_id);
|
||||
return GetPickupAmount(monitor, keep_monitoring);
|
||||
}
|
||||
|
||||
/* static */ uint32 ScriptCargoMonitor::GetIndustryPickupAmount(ScriptCompany::CompanyID company, CargoID cargo, IndustryID industry_id, bool keep_monitoring)
|
||||
/* static */ int32 ScriptCargoMonitor::GetIndustryPickupAmount(ScriptCompany::CompanyID company, CargoID cargo, IndustryID industry_id, bool keep_monitoring)
|
||||
{
|
||||
CargoMonitorID monitor = EncodeCargoIndustryMonitor(static_cast<CompanyID>(company), cargo, industry_id);
|
||||
CompanyID cid = static_cast<CompanyID>(company);
|
||||
if (cid < OWNER_BEGIN || cid >= MAX_COMPANIES) return -1;
|
||||
if (!ScriptCargo::IsValidCargo(cargo)) return -1;
|
||||
if (!::Industry::IsValidID(industry_id)) return -1;
|
||||
|
||||
CargoMonitorID monitor = EncodeCargoIndustryMonitor(cid, cargo, industry_id);
|
||||
return GetPickupAmount(monitor, keep_monitoring);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_cargomonitor.hpp 24986 2013-02-10 19:49:04Z zuu $ */
|
||||
/* $Id: script_cargomonitor.hpp 26685 2014-07-12 17:04:14Z alberth $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -50,9 +50,10 @@ public:
|
||||
* @param cargo Cargo type to query.
|
||||
* @param town_id %Town to query.
|
||||
* @param keep_monitoring If \c true, the given combination continues to be monitored for the next call. If \c false, monitoring ends.
|
||||
* @return Amount of delivered cargo of the given cargo type to the given town by the given company since the last call.
|
||||
* @return Amount of delivered cargo of the given cargo type to the given town by the given company since the last call, or
|
||||
* \c -1 if a parameter is out-of-bound.
|
||||
*/
|
||||
static uint32 GetTownDeliveryAmount(ScriptCompany::CompanyID company, CargoID cargo, TownID town_id, bool keep_monitoring);
|
||||
static int32 GetTownDeliveryAmount(ScriptCompany::CompanyID company, CargoID cargo, TownID town_id, bool keep_monitoring);
|
||||
|
||||
/**
|
||||
* Get the amount of cargo delivered to an industry by a company since the last query, and update the monitoring state.
|
||||
@@ -60,9 +61,10 @@ public:
|
||||
* @param cargo Cargo type to query.
|
||||
* @param industry_id %Industry to query.
|
||||
* @param keep_monitoring If \c true, the given combination continues to be monitored for the next call. If \c false, monitoring ends.
|
||||
* @return Amount of delivered cargo of the given cargo type to the given industry by the given company since the last call.
|
||||
* @return Amount of delivered cargo of the given cargo type to the given industry by the given company since the last call, or
|
||||
* \c -1 if a parameter is out-of-bound.
|
||||
*/
|
||||
static uint32 GetIndustryDeliveryAmount(ScriptCompany::CompanyID company, CargoID cargo, IndustryID industry_id, bool keep_monitoring);
|
||||
static int32 GetIndustryDeliveryAmount(ScriptCompany::CompanyID company, CargoID cargo, IndustryID industry_id, bool keep_monitoring);
|
||||
|
||||
/**
|
||||
* Get the amount of cargo picked up (and delivered) from a town by a company since the last query, and update the monitoring state.
|
||||
@@ -70,10 +72,11 @@ public:
|
||||
* @param cargo Cargo type to query.
|
||||
* @param town_id %Town to query.
|
||||
* @param keep_monitoring If \c true, the given combination continues to be monitored for the next call. If \c false, monitoring ends.
|
||||
* @return Amount of picked up cargo of the given cargo type to the given town by the given company since the last call.
|
||||
* @return Amount of picked up cargo of the given cargo type to the given town by the given company since the last call, or
|
||||
* \c -1 if a parameter is out-of-bound.
|
||||
* @note Amounts of picked-up cargo are added during final delivery of it, to prevent users from getting credit for picking up without delivering it.
|
||||
*/
|
||||
static uint32 GetTownPickupAmount(ScriptCompany::CompanyID company, CargoID cargo, TownID town_id, bool keep_monitoring);
|
||||
static int32 GetTownPickupAmount(ScriptCompany::CompanyID company, CargoID cargo, TownID town_id, bool keep_monitoring);
|
||||
|
||||
/**
|
||||
* Get the amount of cargo picked up (and delivered) from an industry by a company since the last query, and update the monitoring state.
|
||||
@@ -81,10 +84,11 @@ public:
|
||||
* @param cargo Cargo type to query.
|
||||
* @param industry_id %Industry to query.
|
||||
* @param keep_monitoring If \c true, the given combination continues to be monitored for the next call. If \c false, monitoring ends.
|
||||
* @return Amount of picked up cargo of the given cargo type to the given industry by the given company since the last call.
|
||||
* @return Amount of picked up cargo of the given cargo type to the given industry by the given company since the last call, or
|
||||
* \c -1 if a parameter is out-of-bound.
|
||||
* @note Amounts of picked-up cargo are added during final delivery of it, to prevent users from getting credit for picking up without delivering it.
|
||||
*/
|
||||
static uint32 GetIndustryPickupAmount(ScriptCompany::CompanyID company, CargoID cargo, IndustryID industry_id, bool keep_monitoring);
|
||||
static int32 GetIndustryPickupAmount(ScriptCompany::CompanyID company, CargoID cargo, IndustryID industry_id, bool keep_monitoring);
|
||||
|
||||
/** Stop monitoring everything. */
|
||||
static void StopAllMonitoring();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_company.cpp 26150 2013-12-08 18:20:14Z frosch $ */
|
||||
/* $Id: script_company.cpp 27026 2014-10-21 16:58:15Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "../../settings_func.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ ScriptCompany::CompanyID ScriptCompany::ResolveCompanyID(ScriptCompany::CompanyID company)
|
||||
{
|
||||
if (company == COMPANY_SELF) {
|
||||
@@ -194,11 +196,11 @@
|
||||
return LOAN_INTERVAL;
|
||||
}
|
||||
|
||||
/* static */ bool ScriptCompany::SetLoanAmount(int32 loan)
|
||||
/* static */ bool ScriptCompany::SetLoanAmount(Money loan)
|
||||
{
|
||||
EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY);
|
||||
EnforcePrecondition(false, loan >= 0);
|
||||
EnforcePrecondition(false, (loan % GetLoanInterval()) == 0);
|
||||
EnforcePrecondition(false, ((int64)loan % GetLoanInterval()) == 0);
|
||||
EnforcePrecondition(false, loan <= GetMaxLoanAmount());
|
||||
EnforcePrecondition(false, (loan - GetLoanAmount() + GetBankBalance(COMPANY_SELF)) >= 0);
|
||||
|
||||
@@ -209,12 +211,12 @@
|
||||
(loan > GetLoanAmount()) ? CMD_INCREASE_LOAN : CMD_DECREASE_LOAN);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptCompany::SetMinimumLoanAmount(int32 loan)
|
||||
/* static */ bool ScriptCompany::SetMinimumLoanAmount(Money loan)
|
||||
{
|
||||
EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY);
|
||||
EnforcePrecondition(false, loan >= 0);
|
||||
|
||||
int32 over_interval = loan % GetLoanInterval();
|
||||
Money over_interval = (int64)loan % GetLoanInterval();
|
||||
if (over_interval != 0) loan += GetLoanInterval() - over_interval;
|
||||
|
||||
EnforcePrecondition(false, loan <= GetMaxLoanAmount());
|
||||
@@ -224,10 +226,12 @@
|
||||
return GetLoanAmount() == loan;
|
||||
}
|
||||
|
||||
/* static */ bool ScriptCompany::ChangeBankBalance(CompanyID company, int32 delta, ExpensesType expenses_type)
|
||||
/* static */ bool ScriptCompany::ChangeBankBalance(CompanyID company, Money delta, ExpensesType expenses_type)
|
||||
{
|
||||
EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
|
||||
EnforcePrecondition(false, expenses_type < (ExpensesType)::EXPENSES_END);
|
||||
EnforcePrecondition(false, (int64)delta >= INT32_MIN);
|
||||
EnforcePrecondition(false, (int64)delta <= INT32_MAX);
|
||||
|
||||
company = ResolveCompanyID(company);
|
||||
EnforcePrecondition(false, company != COMPANY_INVALID);
|
||||
@@ -278,12 +282,14 @@
|
||||
return ::Company::Get((CompanyID)company)->settings.engine_renew_months;
|
||||
}
|
||||
|
||||
/* static */ bool ScriptCompany::SetAutoRenewMoney(uint32 money)
|
||||
/* static */ bool ScriptCompany::SetAutoRenewMoney(Money money)
|
||||
{
|
||||
EnforcePrecondition(false, money >= 0);
|
||||
EnforcePrecondition(false, (int64)money <= UINT32_MAX);
|
||||
return ScriptObject::DoCommand(0, ::GetCompanySettingIndex("company.engine_renew_money"), money, CMD_CHANGE_COMPANY_SETTING);
|
||||
}
|
||||
|
||||
/* static */ uint32 ScriptCompany::GetAutoRenewMoney(CompanyID company)
|
||||
/* static */ Money ScriptCompany::GetAutoRenewMoney(CompanyID company)
|
||||
{
|
||||
company = ResolveCompanyID(company);
|
||||
if (company == COMPANY_INVALID) return 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_company.hpp 25808 2013-10-02 21:44:31Z zuu $ */
|
||||
/* $Id: script_company.hpp 26915 2014-09-24 16:45:20Z frosch $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
* @game @pre Valid ScriptCompanyMode active in scope.
|
||||
* @return True if the loan could be set to your requested amount.
|
||||
*/
|
||||
static bool SetLoanAmount(int32 loan);
|
||||
static bool SetLoanAmount(Money loan);
|
||||
|
||||
/**
|
||||
* Sets the minimum amount to loan, i.e. the given amount of loan rounded up.
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
* @game @pre Valid ScriptCompanyMode active in scope.
|
||||
* @return True if we could allocate a minimum of 'loan' loan.
|
||||
*/
|
||||
static bool SetMinimumLoanAmount(int32 loan);
|
||||
static bool SetMinimumLoanAmount(Money loan);
|
||||
|
||||
/**
|
||||
* Gets the amount your company have loaned.
|
||||
@@ -192,12 +192,15 @@ public:
|
||||
* @param company The company to change the bank balance of.
|
||||
* @param delta Amount of money to give or take from the bank balance. A positive value adds money to the bank balance.
|
||||
* @param expenses_type The account in the finances window that will register the cost.
|
||||
* @return True, if the bank balance was changed.
|
||||
* @game @pre No ScriptCompanyMode active in scope.
|
||||
* @pre ResolveCompanyID(company) != COMPANY_INVALID.
|
||||
* @pre delta >= -2**31
|
||||
* @pre delta < 2**31
|
||||
* @note You need to create your own news message to inform about costs/gifts that you create using this command.
|
||||
* @api -ai
|
||||
*/
|
||||
static bool ChangeBankBalance(CompanyID company, int32 delta, ExpensesType expenses_type);
|
||||
static bool ChangeBankBalance(CompanyID company, Money delta, ExpensesType expenses_type);
|
||||
|
||||
/**
|
||||
* Get the income of the company in the given quarter.
|
||||
@@ -314,9 +317,11 @@ public:
|
||||
* Set the minimum money needed to autorenew an engine for your company.
|
||||
* @param money The new minimum required money for autorenew to work.
|
||||
* @return True if autorenew money has been modified.
|
||||
* @pre money >= 0
|
||||
* @pre money < 2**32
|
||||
* @api -game
|
||||
*/
|
||||
static bool SetAutoRenewMoney(uint32 money);
|
||||
static bool SetAutoRenewMoney(Money money);
|
||||
|
||||
/**
|
||||
* Return the minimum money needed to autorenew an engine for a company.
|
||||
@@ -324,7 +329,7 @@ public:
|
||||
* @pre ResolveCompanyID(company) != COMPANY_INVALID.
|
||||
* @return The minimum required money for autorenew to work.
|
||||
*/
|
||||
static uint32 GetAutoRenewMoney(CompanyID company);
|
||||
static Money GetAutoRenewMoney(CompanyID company);
|
||||
};
|
||||
|
||||
DECLARE_POSTFIX_INCREMENT(ScriptCompany::CompanyID)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_companymode.cpp 23740 2012-01-03 21:32:51Z rubidium $ */
|
||||
/* $Id: script_companymode.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "../../stdafx.h"
|
||||
#include "script_companymode.hpp"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptCompanyMode::ScriptCompanyMode(int company)
|
||||
{
|
||||
if (company < OWNER_BEGIN || company >= MAX_COMPANIES) company = INVALID_COMPANY;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_controller.cpp 24575 2012-10-05 19:16:23Z zuu $ */
|
||||
/* $Id: script_controller.cpp 26774 2014-09-06 17:46:56Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "../../settings_type.h"
|
||||
#include "../../network/network.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ void ScriptController::SetCommandDelay(int ticks)
|
||||
{
|
||||
if (ticks <= 0) return;
|
||||
@@ -51,7 +53,7 @@
|
||||
ScriptObject::GetActiveInstance()->Pause();
|
||||
|
||||
char log_message[1024];
|
||||
snprintf(log_message, sizeof(log_message), "Break: %s", message);
|
||||
seprintf(log_message, lastof(log_message), "Break: %s", message);
|
||||
ScriptLog::Log(ScriptLog::LOG_SQ_ERROR, log_message);
|
||||
|
||||
/* Inform script developer that his script has been paused and
|
||||
@@ -113,14 +115,14 @@ ScriptController::~ScriptController()
|
||||
|
||||
/* Internally we store libraries as 'library.version' */
|
||||
char library_name[1024];
|
||||
snprintf(library_name, sizeof(library_name), "%s.%d", library, version);
|
||||
seprintf(library_name, lastof(library_name), "%s.%d", library, version);
|
||||
strtolower(library_name);
|
||||
|
||||
ScriptInfo *lib = ScriptObject::GetActiveInstance()->FindLibrary(library, version);
|
||||
if (lib == NULL) {
|
||||
char error[1024];
|
||||
snprintf(error, sizeof(error), "couldn't find library '%s' with version %d", library, version);
|
||||
throw sq_throwerror(vm, OTTD2SQ(error));
|
||||
seprintf(error, lastof(error), "couldn't find library '%s' with version %d", library, version);
|
||||
throw sq_throwerror(vm, error);
|
||||
}
|
||||
|
||||
/* Get the current table/class we belong to */
|
||||
@@ -131,41 +133,41 @@ ScriptController::~ScriptController()
|
||||
|
||||
LoadedLibraryList::iterator iter = controller->loaded_library.find(library_name);
|
||||
if (iter != controller->loaded_library.end()) {
|
||||
ttd_strlcpy(fake_class, (*iter).second, sizeof(fake_class));
|
||||
strecpy(fake_class, (*iter).second, lastof(fake_class));
|
||||
} else {
|
||||
int next_number = ++controller->loaded_library_count;
|
||||
|
||||
/* Create a new fake internal name */
|
||||
snprintf(fake_class, sizeof(fake_class), "_internalNA%d", next_number);
|
||||
seprintf(fake_class, lastof(fake_class), "_internalNA%d", next_number);
|
||||
|
||||
/* Load the library in a 'fake' namespace, so we can link it to the name the user requested */
|
||||
sq_pushroottable(vm);
|
||||
sq_pushstring(vm, OTTD2SQ(fake_class), -1);
|
||||
sq_pushstring(vm, fake_class, -1);
|
||||
sq_newclass(vm, SQFalse);
|
||||
/* Load the library */
|
||||
if (!engine->LoadScript(vm, lib->GetMainScript(), false)) {
|
||||
char error[1024];
|
||||
snprintf(error, sizeof(error), "there was a compile error when importing '%s' version %d", library, version);
|
||||
throw sq_throwerror(vm, OTTD2SQ(error));
|
||||
seprintf(error, lastof(error), "there was a compile error when importing '%s' version %d", library, version);
|
||||
throw sq_throwerror(vm, error);
|
||||
}
|
||||
/* Create the fake class */
|
||||
sq_newslot(vm, -3, SQFalse);
|
||||
sq_pop(vm, 1);
|
||||
|
||||
controller->loaded_library[strdup(library_name)] = strdup(fake_class);
|
||||
controller->loaded_library[stredup(library_name)] = stredup(fake_class);
|
||||
}
|
||||
|
||||
/* Find the real class inside the fake class (like 'sets.Vector') */
|
||||
sq_pushroottable(vm);
|
||||
sq_pushstring(vm, OTTD2SQ(fake_class), -1);
|
||||
sq_pushstring(vm, fake_class, -1);
|
||||
if (SQ_FAILED(sq_get(vm, -2))) {
|
||||
throw sq_throwerror(vm, _SC("internal error assigning library class"));
|
||||
throw sq_throwerror(vm, "internal error assigning library class");
|
||||
}
|
||||
sq_pushstring(vm, OTTD2SQ(lib->GetInstanceName()), -1);
|
||||
sq_pushstring(vm, lib->GetInstanceName(), -1);
|
||||
if (SQ_FAILED(sq_get(vm, -2))) {
|
||||
char error[1024];
|
||||
snprintf(error, sizeof(error), "unable to find class '%s' in the library '%s' version %d", lib->GetInstanceName(), library, version);
|
||||
throw sq_throwerror(vm, OTTD2SQ(error));
|
||||
seprintf(error, lastof(error), "unable to find class '%s' in the library '%s' version %d", lib->GetInstanceName(), library, version);
|
||||
throw sq_throwerror(vm, error);
|
||||
}
|
||||
HSQOBJECT obj;
|
||||
sq_getstackobj(vm, -1, &obj);
|
||||
@@ -175,7 +177,7 @@ ScriptController::~ScriptController()
|
||||
|
||||
/* Now link the name the user wanted to our 'fake' class */
|
||||
sq_pushobject(vm, parent);
|
||||
sq_pushstring(vm, OTTD2SQ(class_name), -1);
|
||||
sq_pushstring(vm, class_name, -1);
|
||||
sq_pushobject(vm, obj);
|
||||
sq_newclass(vm, SQTrue);
|
||||
sq_newslot(vm, -3, SQFalse);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_controller.hpp 26010 2013-11-16 12:33:45Z zuu $ */
|
||||
/* $Id: script_controller.hpp 27111 2015-01-04 15:14:13Z alberth $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -18,8 +18,32 @@
|
||||
|
||||
/**
|
||||
* The Controller, the class each Script should extend. It creates the Script,
|
||||
* makes sure the logic kicks in correctly, and that GetTick() has a valid
|
||||
* makes sure the logic kicks in correctly, and that #GetTick() has a valid
|
||||
* value.
|
||||
*
|
||||
* When starting a new game, or when loading a game, OpenTTD tries to match a
|
||||
* script that matches to the specified version as close as possible. It tries
|
||||
* (from first to last, stopping as soon as the attempt succeeds)
|
||||
*
|
||||
* - load the exact same version of the same script,
|
||||
* - load the latest version of the same script that supports loading data from
|
||||
* the saved version (the version of saved data must be equal or greater
|
||||
* than ScriptInfo::MinVersionToLoad),
|
||||
* - load the latest version of the same script (ignoring version requirements),
|
||||
* - (for AIs) load a random AI, and finally
|
||||
* - (for AIs) load the dummy AI.
|
||||
*
|
||||
* After determining the script to use, starting it is done as follows
|
||||
*
|
||||
* - An instance is constructed of the class derived from ScriptController
|
||||
* (class name is retrieved from ScriptInfo::CreateInstance).
|
||||
* - If there is script data available in the loaded game and if the data is
|
||||
* loadable according to ScriptInfo::MinVersionToLoad, #Load is called with the
|
||||
* data from the loaded game.
|
||||
* - Finally, #Start is called to start execution of the script.
|
||||
*
|
||||
* See also http://wiki.openttd.org/AI:Save/Load for more details.
|
||||
*
|
||||
* @api ai game
|
||||
*/
|
||||
class ScriptController {
|
||||
@@ -46,6 +70,48 @@ public:
|
||||
*/
|
||||
void Start();
|
||||
|
||||
#ifdef DOXYGEN_API
|
||||
/**
|
||||
* Save the state of the script.
|
||||
*
|
||||
* By implementing this function, you can store some data inside the savegame.
|
||||
* The function should return a table with the information you want to store.
|
||||
* You can only store:
|
||||
*
|
||||
* - integers,
|
||||
* - strings,
|
||||
* - arrays (max. 25 levels deep),
|
||||
* - tables (max. 25 levels deep),
|
||||
* - booleans, and
|
||||
* - nulls.
|
||||
*
|
||||
* In particular, instances of classes can't be saved including
|
||||
* ScriptList. Such a list should be converted to an array or table on
|
||||
* save and converted back on load.
|
||||
*
|
||||
* The function is called as soon as the user saves the game,
|
||||
* independently of other activities of the script. The script is not
|
||||
* notified of the call. To avoid race-conditions between #Save and the
|
||||
* other script code, change variables directly after a #Sleep, it is
|
||||
* very unlikely, to get interrupted at that point in the execution.
|
||||
* See also http://wiki.openttd.org/AI:Save/Load for more details.
|
||||
*
|
||||
* @note No other information is saved than the table returned by #Save.
|
||||
* For example all pending events are lost as soon as the game is loaded.
|
||||
*
|
||||
* @return Data of the script that should be stored in the save game.
|
||||
*/
|
||||
SquirrelTable Save();
|
||||
|
||||
/**
|
||||
* Load saved data just before calling #Start.
|
||||
* The function is only called when there is data to load.
|
||||
* @param version Version number of the script that created the \a data.
|
||||
* @param data Data that was saved (return value of #Save).
|
||||
*/
|
||||
void Load(int version, SquirrelTable data);
|
||||
#endif /* DOXYGEN_API */
|
||||
|
||||
/**
|
||||
* Find at which tick your script currently is.
|
||||
* @return returns the current tick.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_date.cpp 26307 2014-02-06 19:50:34Z zuu $ */
|
||||
/* $Id: script_date.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "script_date.hpp"
|
||||
#include "../../date_func.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptDate::IsValidDate(Date date)
|
||||
{
|
||||
return date >= 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_depotlist.cpp 23632 2011-12-19 21:05:25Z truebrain $ */
|
||||
/* $Id: script_depotlist.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "../../depot_base.h"
|
||||
#include "../../station_base.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptDepotList::ScriptDepotList(ScriptTile::TransportType transport_type)
|
||||
{
|
||||
::TileType tile_type;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_engine.cpp 26307 2014-02-06 19:50:34Z zuu $ */
|
||||
/* $Id: script_engine.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "../../articulated_vehicles.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptEngine::IsValidEngine(EngineID engine_id)
|
||||
{
|
||||
const Engine *e = ::Engine::GetIfValid(engine_id);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_engine.hpp 26307 2014-02-06 19:50:34Z zuu $ */
|
||||
/* $Id: script_engine.hpp 27123 2015-01-20 19:11:31Z frosch $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -108,7 +108,6 @@ public:
|
||||
* Get the maximum speed of an engine.
|
||||
* @param engine_id The engine to get the maximum speed of.
|
||||
* @pre IsValidEngine(engine_id).
|
||||
* @pre GetVehicleType(engine_id) != ScriptVehicle::VT_TRAIN || !IsWagon(engine_id).
|
||||
* @return The maximum speed the engine has.
|
||||
* @note The speed is in OpenTTD's internal speed unit.
|
||||
* This is mph / 1.6, which is roughly km/h.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_enginelist.cpp 23740 2012-01-03 21:32:51Z rubidium $ */
|
||||
/* $Id: script_enginelist.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "script_enginelist.hpp"
|
||||
#include "../../engine_base.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptEngineList::ScriptEngineList(ScriptVehicle::VehicleType vehicle_type)
|
||||
{
|
||||
Engine *e;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_error.cpp 23355 2011-11-29 23:15:35Z truebrain $ */
|
||||
/* $Id: script_error.cpp 26509 2014-04-25 15:40:32Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -12,6 +12,9 @@
|
||||
#include "../../stdafx.h"
|
||||
#include "script_error.hpp"
|
||||
#include "../../core/bitmath_func.hpp"
|
||||
#include "../../string_func.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptError::ScriptErrorMap ScriptError::error_map = ScriptError::ScriptErrorMap();
|
||||
ScriptError::ScriptErrorMapString ScriptError::error_map_string = ScriptError::ScriptErrorMapString();
|
||||
@@ -23,7 +26,7 @@ ScriptError::ScriptErrorMapString ScriptError::error_map_string = ScriptError::S
|
||||
|
||||
/* static */ char *ScriptError::GetLastErrorString()
|
||||
{
|
||||
return strdup((*error_map_string.find(ScriptError::GetLastError())).second);
|
||||
return stredup((*error_map_string.find(ScriptError::GetLastError())).second);
|
||||
}
|
||||
|
||||
/* static */ ScriptErrorType ScriptError::StringToError(StringID internal_string_id)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_event.cpp 24008 2012-03-04 16:54:12Z rubidium $ */
|
||||
/* $Id: script_event.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
#include <queue>
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/** The queue of events for a script. */
|
||||
struct ScriptEventData {
|
||||
std::queue<ScriptEvent *> stack; ///< The actual queue.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_event_types.cpp 25809 2013-10-03 16:47:24Z zuu $ */
|
||||
/* $Id: script_event_types.cpp 27020 2014-10-15 18:31:37Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -17,8 +17,11 @@
|
||||
#include "../../settings_type.h"
|
||||
#include "../../engine_base.h"
|
||||
#include "../../articulated_vehicles.h"
|
||||
#include "../../string_func.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
bool ScriptEventEnginePreview::IsEngineValid() const
|
||||
{
|
||||
const Engine *e = ::Engine::GetIfValid(this->engine);
|
||||
@@ -117,6 +120,17 @@ bool ScriptEventCompanyAskMerger::AcceptMerger()
|
||||
return ScriptObject::DoCommand(0, this->owner, 0, CMD_BUY_COMPANY);
|
||||
}
|
||||
|
||||
ScriptEventAdminPort::ScriptEventAdminPort(const char *json) :
|
||||
ScriptEvent(ET_ADMIN_PORT),
|
||||
json(stredup(json))
|
||||
{
|
||||
}
|
||||
|
||||
ScriptEventAdminPort::~ScriptEventAdminPort()
|
||||
{
|
||||
free(this->json);
|
||||
}
|
||||
|
||||
#define SKIP_EMPTY(p) while (*(p) == ' ' || *(p) == '\n' || *(p) == '\r') (p)++;
|
||||
#define RETURN_ERROR(stack) { ScriptLog::Error("Received invalid JSON data from AdminPort."); if (stack != 0) sq_pop(vm, stack); return NULL; }
|
||||
|
||||
@@ -157,7 +171,7 @@ char *ScriptEventAdminPort::ReadString(HSQUIRRELVM vm, char *p)
|
||||
}
|
||||
|
||||
*p = '\0';
|
||||
sq_pushstring(vm, OTTD2SQ(value), -1);
|
||||
sq_pushstring(vm, value, -1);
|
||||
*p++ = '"';
|
||||
|
||||
return p;
|
||||
@@ -245,10 +259,10 @@ char *ScriptEventAdminPort::ReadValue(HSQUIRRELVM vm, char *p)
|
||||
sq_newarray(vm, 0);
|
||||
|
||||
/* Empty array? */
|
||||
char *p2 = p+1;
|
||||
char *p2 = p + 1;
|
||||
SKIP_EMPTY(p2);
|
||||
if (*p2 == ']') {
|
||||
p = p2+1;
|
||||
p = p2 + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_event_types.hpp 24900 2013-01-08 22:46:42Z planetmaker $ */
|
||||
/* $Id: script_event_types.hpp 26509 2014-04-25 15:40:32Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -839,15 +839,8 @@ public:
|
||||
/**
|
||||
* @param json The JSON string which got sent.
|
||||
*/
|
||||
ScriptEventAdminPort(const char *json) :
|
||||
ScriptEvent(ET_ADMIN_PORT),
|
||||
json(strdup(json))
|
||||
{}
|
||||
|
||||
~ScriptEventAdminPort()
|
||||
{
|
||||
free(this->json);
|
||||
}
|
||||
ScriptEventAdminPort(const char *json);
|
||||
~ScriptEventAdminPort();
|
||||
|
||||
/**
|
||||
* Convert an ScriptEvent to the real instance.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_execmode.cpp 24008 2012-03-04 16:54:12Z rubidium $ */
|
||||
/* $Id: script_execmode.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "../script_instance.hpp"
|
||||
#include "../script_fatalerror.hpp"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
bool ScriptExecMode::ModeProc()
|
||||
{
|
||||
/* In execution mode we only return 'true', telling the DoCommand it
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_game.cpp 23740 2012-01-03 21:32:51Z rubidium $ */
|
||||
/* $Id: script_game.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "../../settings_type.h"
|
||||
#include "../../network/network.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptGame::Pause()
|
||||
{
|
||||
return ScriptObject::DoCommand(0, PM_PAUSED_GAME_SCRIPT, 1, CMD_PAUSE);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_gamesettings.cpp 23735 2012-01-03 20:26:05Z rubidium $ */
|
||||
/* $Id: script_gamesettings.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "../../settings_type.h"
|
||||
#include "../../command_type.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptGameSettings::IsValid(const char *setting)
|
||||
{
|
||||
uint i;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_goal.cpp 26012 2013-11-16 17:41:57Z zuu $ */
|
||||
/* $Id: script_goal.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "../../goal_base.h"
|
||||
#include "../../string_func.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptGoal::IsValidGoal(GoalID goal_id)
|
||||
{
|
||||
return ::Goal::IsValidID(goal_id);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_group.cpp 25488 2013-06-27 19:57:41Z rubidium $ */
|
||||
/* $Id: script_group.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "../../settings_func.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptGroup::IsValidGroup(GroupID group_id)
|
||||
{
|
||||
const Group *g = ::Group::GetIfValid(group_id);
|
||||
@@ -57,7 +59,7 @@
|
||||
EnforcePreconditionEncodedText(false, text);
|
||||
EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_GROUP_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
|
||||
|
||||
return ScriptObject::DoCommand(0, group_id, 0, CMD_RENAME_GROUP, text);
|
||||
return ScriptObject::DoCommand(0, group_id, 0, CMD_ALTER_GROUP, text);
|
||||
}
|
||||
|
||||
/* static */ char *ScriptGroup::GetName(GroupID group_id)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_grouplist.cpp 23740 2012-01-03 21:32:51Z rubidium $ */
|
||||
/* $Id: script_grouplist.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "script_grouplist.hpp"
|
||||
#include "../../group.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptGroupList::ScriptGroupList()
|
||||
{
|
||||
Group *g;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_industry.cpp 23777 2012-01-08 21:48:05Z rubidium $ */
|
||||
/* $Id: script_industry.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "../../newgrf_industries.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ int32 ScriptIndustry::GetIndustryCount()
|
||||
{
|
||||
return (int32)::Industry::GetNumItems();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_industrylist.cpp 23355 2011-11-29 23:15:35Z truebrain $ */
|
||||
/* $Id: script_industrylist.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "script_industrylist.hpp"
|
||||
#include "../../industry.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptIndustryList::ScriptIndustryList()
|
||||
{
|
||||
Industry *i;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_industrytype.cpp 24623 2012-10-22 18:56:21Z zuu $ */
|
||||
/* $Id: script_industrytype.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "../../newgrf_industries.h"
|
||||
#include "../../core/random_func.hpp"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptIndustryType::IsValidIndustryType(IndustryType industry_type)
|
||||
{
|
||||
if (industry_type >= NUM_INDUSTRYTYPES) return false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_industrytypelist.cpp 23355 2011-11-29 23:15:35Z truebrain $ */
|
||||
/* $Id: script_industrytypelist.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "script_industrytypelist.hpp"
|
||||
#include "../../industry.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptIndustryTypeList::ScriptIndustryTypeList()
|
||||
{
|
||||
for (int i = 0; i < NUM_INDUSTRYTYPES; i++) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_infrastructure.cpp 23931 2012-02-11 22:43:39Z michi_cc $ */
|
||||
/* $Id: script_infrastructure.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "../../water.h"
|
||||
#include "../../station_func.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
|
||||
/* static */ uint32 ScriptInfrastructure::GetRailPieceCount(ScriptCompany::CompanyID company, ScriptRail::RailType railtype)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_list.cpp 26072 2013-11-23 18:13:30Z rubidium $ */
|
||||
/* $Id: script_list.cpp 27166 2015-02-22 23:04:02Z frosch $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -14,14 +14,16 @@
|
||||
#include "../../debug.h"
|
||||
#include "../../script/squirrel.hpp"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/**
|
||||
* Base class for any ScriptList sorter.
|
||||
*/
|
||||
class ScriptListSorter {
|
||||
protected:
|
||||
ScriptList *list; ///< The list that's being sorted.
|
||||
ScriptList *list; ///< The list that's being sorted.
|
||||
bool has_no_more_items; ///< Whether we have more items to iterate over.
|
||||
int32 item_next; ///< The next item we will show.
|
||||
int64 item_next; ///< The next item we will show.
|
||||
|
||||
public:
|
||||
/**
|
||||
@@ -32,7 +34,7 @@ public:
|
||||
/**
|
||||
* Get the first item of the sorter.
|
||||
*/
|
||||
virtual int32 Begin() = 0;
|
||||
virtual int64 Begin() = 0;
|
||||
|
||||
/**
|
||||
* Stop iterating a sorter.
|
||||
@@ -42,7 +44,7 @@ public:
|
||||
/**
|
||||
* Get the next item of the sorter.
|
||||
*/
|
||||
virtual int32 Next() = 0;
|
||||
virtual int64 Next() = 0;
|
||||
|
||||
/**
|
||||
* See if the sorter has reached the end.
|
||||
@@ -56,6 +58,17 @@ public:
|
||||
* Callback from the list if an item gets removed.
|
||||
*/
|
||||
virtual void Remove(int item) = 0;
|
||||
|
||||
/**
|
||||
* Attach the sorter to a new list. This assumes the content of the old list has been moved to
|
||||
* the new list, too, so that we don't have to invalidate any iterators. Note that std::swap
|
||||
* doesn't invalidate iterators on lists and maps, so that should be safe.
|
||||
* @param target New list to attach to.
|
||||
*/
|
||||
virtual void Retarget(ScriptList *new_list)
|
||||
{
|
||||
this->list = new_list;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -78,7 +91,7 @@ public:
|
||||
this->End();
|
||||
}
|
||||
|
||||
int32 Begin()
|
||||
int64 Begin()
|
||||
{
|
||||
if (this->list->buckets.empty()) return 0;
|
||||
this->has_no_more_items = false;
|
||||
@@ -88,7 +101,7 @@ public:
|
||||
this->bucket_list_iter = this->bucket_list->begin();
|
||||
this->item_next = *this->bucket_list_iter;
|
||||
|
||||
int32 item_current = this->item_next;
|
||||
int64 item_current = this->item_next;
|
||||
FindNext();
|
||||
return item_current;
|
||||
}
|
||||
@@ -123,11 +136,11 @@ public:
|
||||
this->item_next = *this->bucket_list_iter;
|
||||
}
|
||||
|
||||
int32 Next()
|
||||
int64 Next()
|
||||
{
|
||||
if (this->IsEnd()) return 0;
|
||||
|
||||
int32 item_current = this->item_next;
|
||||
int64 item_current = this->item_next;
|
||||
FindNext();
|
||||
return item_current;
|
||||
}
|
||||
@@ -149,6 +162,9 @@ public:
|
||||
*/
|
||||
class ScriptListSorterValueDescending : public ScriptListSorter {
|
||||
private:
|
||||
/* Note: We cannot use reverse_iterator.
|
||||
* The iterators must only be invalidated when the element they are pointing to is removed.
|
||||
* This only holds for forward iterators. */
|
||||
ScriptList::ScriptListBucket::iterator bucket_iter; ///< The iterator over the list to find the buckets.
|
||||
ScriptList::ScriptItemList *bucket_list; ///< The current bucket list we're iterator over.
|
||||
ScriptList::ScriptItemList::iterator bucket_list_iter; ///< The iterator over the bucket list.
|
||||
@@ -164,22 +180,22 @@ public:
|
||||
this->End();
|
||||
}
|
||||
|
||||
int32 Begin()
|
||||
int64 Begin()
|
||||
{
|
||||
if (this->list->buckets.empty()) return 0;
|
||||
this->has_no_more_items = false;
|
||||
|
||||
/* Go to the end of the bucket-list */
|
||||
this->bucket_iter = this->list->buckets.begin();
|
||||
for (size_t i = this->list->buckets.size(); i > 1; i--) this->bucket_iter++;
|
||||
this->bucket_iter = this->list->buckets.end();
|
||||
--this->bucket_iter;
|
||||
this->bucket_list = &(*this->bucket_iter).second;
|
||||
|
||||
/* Go to the end of the items in the bucket */
|
||||
this->bucket_list_iter = this->bucket_list->begin();
|
||||
for (size_t i = this->bucket_list->size(); i > 1; i--) this->bucket_list_iter++;
|
||||
this->bucket_list_iter = this->bucket_list->end();
|
||||
--this->bucket_list_iter;
|
||||
this->item_next = *this->bucket_list_iter;
|
||||
|
||||
int32 item_current = this->item_next;
|
||||
int64 item_current = this->item_next;
|
||||
FindNext();
|
||||
return item_current;
|
||||
}
|
||||
@@ -209,19 +225,19 @@ public:
|
||||
this->bucket_iter--;
|
||||
this->bucket_list = &(*this->bucket_iter).second;
|
||||
/* Go to the end of the items in the bucket */
|
||||
this->bucket_list_iter = this->bucket_list->begin();
|
||||
for (size_t i = this->bucket_list->size(); i > 1; i--) this->bucket_list_iter++;
|
||||
this->bucket_list_iter = this->bucket_list->end();
|
||||
--this->bucket_list_iter;
|
||||
} else {
|
||||
this->bucket_list_iter--;
|
||||
}
|
||||
this->item_next = *this->bucket_list_iter;
|
||||
}
|
||||
|
||||
int32 Next()
|
||||
int64 Next()
|
||||
{
|
||||
if (this->IsEnd()) return 0;
|
||||
|
||||
int32 item_current = this->item_next;
|
||||
int64 item_current = this->item_next;
|
||||
FindNext();
|
||||
return item_current;
|
||||
}
|
||||
@@ -256,7 +272,7 @@ public:
|
||||
this->End();
|
||||
}
|
||||
|
||||
int32 Begin()
|
||||
int64 Begin()
|
||||
{
|
||||
if (this->list->items.empty()) return 0;
|
||||
this->has_no_more_items = false;
|
||||
@@ -264,7 +280,7 @@ public:
|
||||
this->item_iter = this->list->items.begin();
|
||||
this->item_next = (*this->item_iter).first;
|
||||
|
||||
int32 item_current = this->item_next;
|
||||
int64 item_current = this->item_next;
|
||||
FindNext();
|
||||
return item_current;
|
||||
}
|
||||
@@ -287,11 +303,11 @@ public:
|
||||
if (this->item_iter != this->list->items.end()) item_next = (*this->item_iter).first;
|
||||
}
|
||||
|
||||
int32 Next()
|
||||
int64 Next()
|
||||
{
|
||||
if (this->IsEnd()) return 0;
|
||||
|
||||
int32 item_current = this->item_next;
|
||||
int64 item_current = this->item_next;
|
||||
FindNext();
|
||||
return item_current;
|
||||
}
|
||||
@@ -313,6 +329,9 @@ public:
|
||||
*/
|
||||
class ScriptListSorterItemDescending : public ScriptListSorter {
|
||||
private:
|
||||
/* Note: We cannot use reverse_iterator.
|
||||
* The iterators must only be invalidated when the element they are pointing to is removed.
|
||||
* This only holds for forward iterators. */
|
||||
ScriptList::ScriptListMap::iterator item_iter; ///< The iterator over the items in the map.
|
||||
|
||||
public:
|
||||
@@ -326,16 +345,16 @@ public:
|
||||
this->End();
|
||||
}
|
||||
|
||||
int32 Begin()
|
||||
int64 Begin()
|
||||
{
|
||||
if (this->list->items.empty()) return 0;
|
||||
this->has_no_more_items = false;
|
||||
|
||||
this->item_iter = this->list->items.begin();
|
||||
for (size_t i = this->list->items.size(); i > 1; i--) this->item_iter++;
|
||||
this->item_iter = this->list->items.end();
|
||||
--this->item_iter;
|
||||
this->item_next = (*this->item_iter).first;
|
||||
|
||||
int32 item_current = this->item_next;
|
||||
int64 item_current = this->item_next;
|
||||
FindNext();
|
||||
return item_current;
|
||||
}
|
||||
@@ -354,15 +373,20 @@ public:
|
||||
this->has_no_more_items = true;
|
||||
return;
|
||||
}
|
||||
this->item_iter--;
|
||||
if (this->item_iter == this->list->items.begin()) {
|
||||
/* Use 'end' as marker for 'beyond begin' */
|
||||
this->item_iter = this->list->items.end();
|
||||
} else {
|
||||
this->item_iter--;
|
||||
}
|
||||
if (this->item_iter != this->list->items.end()) item_next = (*this->item_iter).first;
|
||||
}
|
||||
|
||||
int32 Next()
|
||||
int64 Next()
|
||||
{
|
||||
if (this->IsEnd()) return 0;
|
||||
|
||||
int32 item_current = this->item_next;
|
||||
int64 item_current = this->item_next;
|
||||
FindNext();
|
||||
return item_current;
|
||||
}
|
||||
@@ -396,7 +420,7 @@ ScriptList::~ScriptList()
|
||||
delete this->sorter;
|
||||
}
|
||||
|
||||
bool ScriptList::HasItem(int32 item)
|
||||
bool ScriptList::HasItem(int64 item)
|
||||
{
|
||||
return this->items.count(item) == 1;
|
||||
}
|
||||
@@ -410,39 +434,40 @@ void ScriptList::Clear()
|
||||
this->sorter->End();
|
||||
}
|
||||
|
||||
void ScriptList::AddItem(int32 item, int32 value)
|
||||
void ScriptList::AddItem(int64 item, int64 value)
|
||||
{
|
||||
this->modifications++;
|
||||
|
||||
if (this->HasItem(item)) return;
|
||||
|
||||
this->items[item] = 0;
|
||||
this->buckets[0].insert(item);
|
||||
|
||||
this->SetValue(item, value);
|
||||
this->items[item] = value;
|
||||
this->buckets[value].insert(item);
|
||||
}
|
||||
|
||||
void ScriptList::RemoveItem(int32 item)
|
||||
void ScriptList::RemoveItem(int64 item)
|
||||
{
|
||||
this->modifications++;
|
||||
|
||||
if (!this->HasItem(item)) return;
|
||||
ScriptListMap::iterator item_iter = this->items.find(item);
|
||||
if (item_iter == this->items.end()) return;
|
||||
|
||||
int32 value = this->GetValue(item);
|
||||
int64 value = item_iter->second;
|
||||
|
||||
this->sorter->Remove(item);
|
||||
this->buckets[value].erase(item);
|
||||
if (this->buckets[value].empty()) this->buckets.erase(value);
|
||||
this->items.erase(item);
|
||||
ScriptListBucket::iterator bucket_iter = this->buckets.find(value);
|
||||
assert(bucket_iter != this->buckets.end());
|
||||
bucket_iter->second.erase(item);
|
||||
if (bucket_iter->second.empty()) this->buckets.erase(bucket_iter);
|
||||
this->items.erase(item_iter);
|
||||
}
|
||||
|
||||
int32 ScriptList::Begin()
|
||||
int64 ScriptList::Begin()
|
||||
{
|
||||
this->initialized = true;
|
||||
return this->sorter->Begin();
|
||||
}
|
||||
|
||||
int32 ScriptList::Next()
|
||||
int64 ScriptList::Next()
|
||||
{
|
||||
if (this->initialized == false) {
|
||||
DEBUG(script, 0, "Next() is invalid as Begin() is never called");
|
||||
@@ -470,26 +495,28 @@ int32 ScriptList::Count()
|
||||
return (int32)this->items.size();
|
||||
}
|
||||
|
||||
int32 ScriptList::GetValue(int32 item)
|
||||
int64 ScriptList::GetValue(int64 item)
|
||||
{
|
||||
if (!this->HasItem(item)) return 0;
|
||||
|
||||
return this->items[item];
|
||||
ScriptListMap::const_iterator item_iter = this->items.find(item);
|
||||
return item_iter == this->items.end() ? 0 : item_iter->second;
|
||||
}
|
||||
|
||||
bool ScriptList::SetValue(int32 item, int32 value)
|
||||
bool ScriptList::SetValue(int64 item, int64 value)
|
||||
{
|
||||
this->modifications++;
|
||||
|
||||
if (!this->HasItem(item)) return false;
|
||||
ScriptListMap::iterator item_iter = this->items.find(item);
|
||||
if (item_iter == this->items.end()) return false;
|
||||
|
||||
int32 value_old = this->GetValue(item);
|
||||
int64 value_old = item_iter->second;
|
||||
if (value_old == value) return true;
|
||||
|
||||
this->sorter->Remove(item);
|
||||
this->buckets[value_old].erase(item);
|
||||
if (this->buckets[value_old].empty()) this->buckets.erase(value_old);
|
||||
this->items[item] = value;
|
||||
ScriptListBucket::iterator bucket_iter = this->buckets.find(value_old);
|
||||
assert(bucket_iter != this->buckets.end());
|
||||
bucket_iter->second.erase(item);
|
||||
if (bucket_iter->second.empty()) this->buckets.erase(bucket_iter);
|
||||
item_iter->second = value;
|
||||
this->buckets[value].insert(item);
|
||||
|
||||
return true;
|
||||
@@ -536,7 +563,20 @@ void ScriptList::AddList(ScriptList *list)
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptList::RemoveAboveValue(int32 value)
|
||||
void ScriptList::SwapList(ScriptList *list)
|
||||
{
|
||||
this->items.swap(list->items);
|
||||
this->buckets.swap(list->buckets);
|
||||
Swap(this->sorter, list->sorter);
|
||||
Swap(this->sorter_type, list->sorter_type);
|
||||
Swap(this->sort_ascending, list->sort_ascending);
|
||||
Swap(this->initialized, list->initialized);
|
||||
Swap(this->modifications, list->modifications);
|
||||
this->sorter->Retarget(this);
|
||||
list->sorter->Retarget(list);
|
||||
}
|
||||
|
||||
void ScriptList::RemoveAboveValue(int64 value)
|
||||
{
|
||||
this->modifications++;
|
||||
|
||||
@@ -546,7 +586,7 @@ void ScriptList::RemoveAboveValue(int32 value)
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptList::RemoveBelowValue(int32 value)
|
||||
void ScriptList::RemoveBelowValue(int64 value)
|
||||
{
|
||||
this->modifications++;
|
||||
|
||||
@@ -556,7 +596,7 @@ void ScriptList::RemoveBelowValue(int32 value)
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptList::RemoveBetweenValue(int32 start, int32 end)
|
||||
void ScriptList::RemoveBetweenValue(int64 start, int64 end)
|
||||
{
|
||||
this->modifications++;
|
||||
|
||||
@@ -566,7 +606,7 @@ void ScriptList::RemoveBetweenValue(int32 start, int32 end)
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptList::RemoveValue(int32 value)
|
||||
void ScriptList::RemoveValue(int64 value)
|
||||
{
|
||||
this->modifications++;
|
||||
|
||||
@@ -660,7 +700,7 @@ void ScriptList::RemoveList(ScriptList *list)
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptList::KeepAboveValue(int32 value)
|
||||
void ScriptList::KeepAboveValue(int64 value)
|
||||
{
|
||||
this->modifications++;
|
||||
|
||||
@@ -670,7 +710,7 @@ void ScriptList::KeepAboveValue(int32 value)
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptList::KeepBelowValue(int32 value)
|
||||
void ScriptList::KeepBelowValue(int64 value)
|
||||
{
|
||||
this->modifications++;
|
||||
|
||||
@@ -680,7 +720,7 @@ void ScriptList::KeepBelowValue(int32 value)
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptList::KeepBetweenValue(int32 start, int32 end)
|
||||
void ScriptList::KeepBetweenValue(int64 start, int64 end)
|
||||
{
|
||||
this->modifications++;
|
||||
|
||||
@@ -690,7 +730,7 @@ void ScriptList::KeepBetweenValue(int32 start, int32 end)
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptList::KeepValue(int32 value)
|
||||
void ScriptList::KeepValue(int64 value)
|
||||
{
|
||||
this->modifications++;
|
||||
|
||||
@@ -735,9 +775,10 @@ SQInteger ScriptList::_get(HSQUIRRELVM vm)
|
||||
SQInteger idx;
|
||||
sq_getinteger(vm, 2, &idx);
|
||||
|
||||
if (!this->HasItem(idx)) return SQ_ERROR;
|
||||
ScriptListMap::const_iterator item_iter = this->items.find(idx);
|
||||
if (item_iter == this->items.end()) return SQ_ERROR;
|
||||
|
||||
sq_pushinteger(vm, this->GetValue(idx));
|
||||
sq_pushinteger(vm, item_iter->second);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -745,7 +786,7 @@ SQInteger ScriptList::_set(HSQUIRRELVM vm)
|
||||
{
|
||||
if (sq_gettype(vm, 2) != OT_INTEGER) return SQ_ERROR;
|
||||
if (sq_gettype(vm, 3) != OT_INTEGER && sq_gettype(vm, 3) != OT_NULL) {
|
||||
return sq_throwerror(vm, _SC("you can only assign integers to this list"));
|
||||
return sq_throwerror(vm, "you can only assign integers to this list");
|
||||
}
|
||||
|
||||
SQInteger idx, val;
|
||||
@@ -797,7 +838,7 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
|
||||
int nparam = sq_gettop(vm) - 1;
|
||||
|
||||
if (nparam < 1) {
|
||||
return sq_throwerror(vm, _SC("You need to give a least a Valuator as parameter to ScriptList::Valuate"));
|
||||
return sq_throwerror(vm, "You need to give a least a Valuator as parameter to ScriptList::Valuate");
|
||||
}
|
||||
|
||||
/* Make sure the valuator function is really a function, and not any
|
||||
@@ -805,7 +846,7 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
|
||||
* first parameter they give. */
|
||||
SQObjectType valuator_type = sq_gettype(vm, 2);
|
||||
if (valuator_type != OT_CLOSURE && valuator_type != OT_NATIVECLOSURE) {
|
||||
return sq_throwerror(vm, _SC("parameter 1 has an invalid type (expected function)"));
|
||||
return sq_throwerror(vm, "parameter 1 has an invalid type (expected function)");
|
||||
}
|
||||
|
||||
/* Don't allow docommand from a Valuator, as we can't resume in
|
||||
@@ -854,7 +895,7 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
|
||||
sq_pop(vm, nparam + 4);
|
||||
|
||||
ScriptObject::SetAllowDoCommand(backup_allow);
|
||||
return sq_throwerror(vm, _SC("return value of valuator is not valid (not integer/bool)"));
|
||||
return sq_throwerror(vm, "return value of valuator is not valid (not integer/bool)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -864,7 +905,7 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
|
||||
sq_pop(vm, nparam + 4);
|
||||
|
||||
ScriptObject::SetAllowDoCommand(backup_allow);
|
||||
return sq_throwerror(vm, _SC("modifying valuated list outside of valuator function"));
|
||||
return sq_throwerror(vm, "modifying valuated list outside of valuator function");
|
||||
}
|
||||
|
||||
this->SetValue((*iter).first, value);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_list.hpp 25579 2013-07-10 15:38:42Z rubidium $ */
|
||||
/* $Id: script_list.hpp 27104 2015-01-01 21:08:19Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -44,9 +44,9 @@ private:
|
||||
int modifications; ///< Number of modification that has been done. To prevent changing data while valuating.
|
||||
|
||||
public:
|
||||
typedef std::set<int32> ScriptItemList; ///< The list of items inside the bucket
|
||||
typedef std::map<int32, ScriptItemList> ScriptListBucket; ///< The bucket list per value
|
||||
typedef std::map<int32, int32> ScriptListMap; ///< List per item
|
||||
typedef std::set<int64> ScriptItemList; ///< The list of items inside the bucket
|
||||
typedef std::map<int64, ScriptItemList> ScriptListBucket; ///< The bucket list per value
|
||||
typedef std::map<int64, int64> ScriptListMap; ///< List per item
|
||||
|
||||
ScriptListMap items; ///< The items in the list
|
||||
ScriptListBucket buckets; ///< The items in the list, sorted by value
|
||||
@@ -60,16 +60,16 @@ public:
|
||||
* @param item the item to add. Should be unique, otherwise it is ignored.
|
||||
* @param value the value to assign.
|
||||
*/
|
||||
void AddItem(int32 item, int32 value);
|
||||
void AddItem(int64 item, int64 value);
|
||||
#else
|
||||
void AddItem(int32 item, int32 value = 0);
|
||||
void AddItem(int64 item, int64 value = 0);
|
||||
#endif /* DOXYGEN_API */
|
||||
|
||||
/**
|
||||
* Remove a single item from the list.
|
||||
* @param item the item to remove. If not existing, it is ignored.
|
||||
*/
|
||||
void RemoveItem(int32 item);
|
||||
void RemoveItem(int64 item);
|
||||
|
||||
/**
|
||||
* Clear the list, making Count() returning 0 and IsEmpty() returning true.
|
||||
@@ -81,21 +81,21 @@ public:
|
||||
* @param item the item to check for.
|
||||
* @return true if the item is in the list.
|
||||
*/
|
||||
bool HasItem(int32 item);
|
||||
bool HasItem(int64 item);
|
||||
|
||||
/**
|
||||
* Go to the beginning of the list.
|
||||
* @return the item value of the first item.
|
||||
* Go to the beginning of the list and return the item. To get the value use list.GetValue(list.Begin()).
|
||||
* @return the first item.
|
||||
* @note returns 0 if beyond end-of-list. Use IsEnd() to check for end-of-list.
|
||||
*/
|
||||
int32 Begin();
|
||||
int64 Begin();
|
||||
|
||||
/**
|
||||
* Go to the next item in the list.
|
||||
* @return the item value of the next item.
|
||||
* Go to the next item in the list and return the item. To get the value use list.GetValue(list.Next()).
|
||||
* @return the next item.
|
||||
* @note returns 0 if beyond end-of-list. Use IsEnd() to check for end-of-list.
|
||||
*/
|
||||
int32 Next();
|
||||
int64 Next();
|
||||
|
||||
/**
|
||||
* Check if a list is empty.
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
* @param item the item to get the value from
|
||||
* @return the value that belongs to this item.
|
||||
*/
|
||||
int32 GetValue(int32 item);
|
||||
int64 GetValue(int64 item);
|
||||
|
||||
/**
|
||||
* Set a value of an item directly.
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
* @note Changing values of items while looping through a list might cause
|
||||
* entries to be skipped. Be very careful with such operations.
|
||||
*/
|
||||
bool SetValue(int32 item, int32 value);
|
||||
bool SetValue(int64 item, int64 value);
|
||||
|
||||
/**
|
||||
* Sort this list by the given sorter and direction.
|
||||
@@ -152,30 +152,36 @@ public:
|
||||
*/
|
||||
void AddList(ScriptList *list);
|
||||
|
||||
/**
|
||||
* Swap the contents of two lists.
|
||||
* @param list The list that will be swapped with.
|
||||
*/
|
||||
void SwapList(ScriptList *list);
|
||||
|
||||
/**
|
||||
* Removes all items with a higher value than 'value'.
|
||||
* @param value the value above which all items are removed.
|
||||
*/
|
||||
void RemoveAboveValue(int32 value);
|
||||
void RemoveAboveValue(int64 value);
|
||||
|
||||
/**
|
||||
* Removes all items with a lower value than 'value'.
|
||||
* @param value the value below which all items are removed.
|
||||
*/
|
||||
void RemoveBelowValue(int32 value);
|
||||
void RemoveBelowValue(int64 value);
|
||||
|
||||
/**
|
||||
* Removes all items with a value above start and below end.
|
||||
* @param start the lower bound of the to be removed values (exclusive).
|
||||
* @param end the upper bound of the to be removed values (exclusive).
|
||||
*/
|
||||
void RemoveBetweenValue(int32 start, int32 end);
|
||||
void RemoveBetweenValue(int64 start, int64 end);
|
||||
|
||||
/**
|
||||
* Remove all items with this value.
|
||||
* @param value the value to remove.
|
||||
*/
|
||||
void RemoveValue(int32 value);
|
||||
void RemoveValue(int64 value);
|
||||
|
||||
/**
|
||||
* Remove the first count items.
|
||||
@@ -200,26 +206,26 @@ public:
|
||||
* Keep all items with a higher value than 'value'.
|
||||
* @param value the value above which all items are kept.
|
||||
*/
|
||||
void KeepAboveValue(int32 value);
|
||||
void KeepAboveValue(int64 value);
|
||||
|
||||
/**
|
||||
* Keep all items with a lower value than 'value'.
|
||||
* @param value the value below which all items are kept.
|
||||
*/
|
||||
void KeepBelowValue(int32 value);
|
||||
void KeepBelowValue(int64 value);
|
||||
|
||||
/**
|
||||
* Keep all items with a value above start and below end.
|
||||
* @param start the lower bound of the to be kept values (exclusive).
|
||||
* @param end the upper bound of the to be kept values (exclusive).
|
||||
*/
|
||||
void KeepBetweenValue(int32 start, int32 end);
|
||||
void KeepBetweenValue(int64 start, int64 end);
|
||||
|
||||
/**
|
||||
* Keep all items with this value.
|
||||
* @param value the value to keep.
|
||||
*/
|
||||
void KeepValue(int32 value);
|
||||
void KeepValue(int64 value);
|
||||
|
||||
/**
|
||||
* Keep the first count items, i.e. remove everything except the first count items.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_log.cpp 23632 2011-12-19 21:05:25Z truebrain $ */
|
||||
/* $Id: script_log.cpp 26509 2014-04-25 15:40:32Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -14,6 +14,9 @@
|
||||
#include "../../core/alloc_func.hpp"
|
||||
#include "../../debug.h"
|
||||
#include "../../window_func.h"
|
||||
#include "../../string_func.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ void ScriptLog::Info(const char *message)
|
||||
{
|
||||
@@ -51,7 +54,7 @@
|
||||
|
||||
/* Free last message, and write new message */
|
||||
free(log->lines[log->pos]);
|
||||
log->lines[log->pos] = strdup(message);
|
||||
log->lines[log->pos] = stredup(message);
|
||||
log->type[log->pos] = level;
|
||||
|
||||
/* Cut string after first \n */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_map.cpp 23355 2011-11-29 23:15:35Z truebrain $ */
|
||||
/* $Id: script_map.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "script_map.hpp"
|
||||
#include "../../tile_map.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptMap::IsValidTile(TileIndex t)
|
||||
{
|
||||
return ::IsValidTile(t);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_marine.cpp 23633 2011-12-19 21:05:36Z truebrain $ */
|
||||
/* $Id: script_marine.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "../../station_base.h"
|
||||
#include "../../tile_cmd.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
|
||||
/* static */ bool ScriptMarine::IsWaterDepotTile(TileIndex tile)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_news.cpp 24982 2013-02-08 20:34:27Z rubidium $ */
|
||||
/* $Id: script_news.cpp 27164 2015-02-22 17:25:29Z alberth $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -11,11 +11,17 @@
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "script_news.hpp"
|
||||
#include "script_industry.hpp"
|
||||
#include "script_station.hpp"
|
||||
#include "script_map.hpp"
|
||||
#include "script_town.hpp"
|
||||
#include "script_error.hpp"
|
||||
#include "../../command_type.h"
|
||||
#include "../../string_func.h"
|
||||
|
||||
/* static */ bool ScriptNews::Create(NewsType type, Text *text, ScriptCompany::CompanyID company)
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptNews::Create(NewsType type, Text *text, ScriptCompany::CompanyID company, NewsReferenceType ref_type, uint32 reference)
|
||||
{
|
||||
CCountedPtr<Text> counter(text);
|
||||
|
||||
@@ -24,9 +30,15 @@
|
||||
EnforcePreconditionEncodedText(false, encoded);
|
||||
EnforcePrecondition(false, type == NT_ECONOMY || type == NT_SUBSIDIES || type == NT_GENERAL);
|
||||
EnforcePrecondition(false, company == ScriptCompany::COMPANY_INVALID || ScriptCompany::ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID);
|
||||
EnforcePrecondition(false, (ref_type == NR_NONE) ||
|
||||
(ref_type == NR_TILE && ScriptMap::IsValidTile(reference)) ||
|
||||
(ref_type == NR_STATION && ScriptStation::IsValidStation(reference)) ||
|
||||
(ref_type == NR_INDUSTRY && ScriptIndustry::IsValidIndustry(reference)) ||
|
||||
(ref_type == NR_TOWN && ScriptTown::IsValidTown(reference)));
|
||||
|
||||
uint8 c = company;
|
||||
if (company == ScriptCompany::COMPANY_INVALID) c = INVALID_COMPANY;
|
||||
|
||||
return ScriptObject::DoCommand(0, type | (NR_NONE << 8) | (c << 16), 0, CMD_CUSTOM_NEWS_ITEM, encoded);
|
||||
if (ref_type == NR_NONE) reference = 0;
|
||||
return ScriptObject::DoCommand(0, type | (ref_type << 8) | (c << 16), reference, CMD_CUSTOM_NEWS_ITEM, encoded);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_news.hpp 24286 2012-05-26 14:16:12Z frosch $ */
|
||||
/* $Id: script_news.hpp 27164 2015-02-22 17:25:29Z alberth $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -36,15 +36,36 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a news messages for a company.
|
||||
* Reference to a game element.
|
||||
*/
|
||||
enum NewsReferenceType {
|
||||
/* Selection of useful game elements to refer to. */
|
||||
NR_NONE = ::NR_NONE, ///< No reference supplied.
|
||||
NR_TILE = ::NR_TILE, ///< Reference location, scroll to the location when clicking on the news.
|
||||
NR_STATION = ::NR_STATION, ///< Reference station, scroll to the station when clicking on the news. Delete news when the station is deleted.
|
||||
NR_INDUSTRY = ::NR_INDUSTRY, ///< Reference industry, scrolls to the industry when clicking on the news. Delete news when the industry is deleted.
|
||||
NR_TOWN = ::NR_TOWN, ///< Reference town, scroll to the town when clicking on the news.
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a news message for everybody, or for one company.
|
||||
* @param type The type of the news.
|
||||
* @param text The text message to show (can be either a raw string, or a ScriptText object).
|
||||
* @param company The company, or COMPANY_INVALID for all companies.
|
||||
* @param ref_type Type of referred game element.
|
||||
* @param reference The referenced game element of \a ref_type.
|
||||
* - For #NR_NONE this parameter is ignored.
|
||||
* - For #NR_TILE this parameter should be a valid location (ScriptMap::IsValidTile).
|
||||
* - For #NR_STATION this parameter should be a valid stationID (ScriptStation::IsValidStation).
|
||||
* - For #NR_INDUSTRY this parameter should be a valid industryID (ScriptIndustry::IsValidIndustry).
|
||||
* - For #NR_TOWN this parameter should be a valid townID (ScriptTown::IsValidTown).
|
||||
* @return True if the action succeeded.
|
||||
* @pre type must be #NT_ECONOMY, #NT_SUBSIDIES, or #NT_GENERAL.
|
||||
* @pre text != NULL.
|
||||
* @pre company == COMPANY_INVALID || ResolveCompanyID(company) != COMPANY_INVALID.
|
||||
* @pre The \a reference condition must be fulfilled.
|
||||
*/
|
||||
static bool Create(NewsType type, Text *text, ScriptCompany::CompanyID company);
|
||||
static bool Create(NewsType type, Text *text, ScriptCompany::CompanyID company, NewsReferenceType ref_type, uint32 reference);
|
||||
};
|
||||
|
||||
#endif /* SCRIPT_NEWS_HPP */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_object.cpp 26093 2013-11-24 19:53:35Z rubidium $ */
|
||||
/* $Id: script_object.cpp 26509 2014-04-25 15:40:32Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "../script_fatalerror.hpp"
|
||||
#include "script_error.hpp"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/**
|
||||
* Get the storage associated with the current ScriptInstance.
|
||||
* @return The storage.
|
||||
@@ -262,7 +264,7 @@ ScriptObject::ActiveInstance::~ActiveInstance()
|
||||
char buffer[64];
|
||||
::GetString(buffer, string, lastof(buffer));
|
||||
::str_validate(buffer, lastof(buffer), SVS_NONE);
|
||||
return ::strdup(buffer);
|
||||
return ::stredup(buffer);
|
||||
}
|
||||
|
||||
/* static */ void ScriptObject::SetCallbackVariable(int index, int value)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_order.cpp 26148 2013-12-08 15:13:06Z frosch $ */
|
||||
/* $Id: script_order.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "../../station_base.h"
|
||||
#include "../../waypoint_base.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/**
|
||||
* Gets the order type given a tile
|
||||
* @param t the tile to get the order from
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_rail.cpp 26279 2014-01-26 14:54:34Z frosch $ */
|
||||
/* $Id: script_rail.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "../../newgrf_station.h"
|
||||
#include "../../strings_func.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ char *ScriptRail::GetName(RailType rail_type)
|
||||
{
|
||||
if (!IsRailTypeAvailable(rail_type)) return NULL;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_railtypelist.cpp 23632 2011-12-19 21:05:25Z truebrain $ */
|
||||
/* $Id: script_railtypelist.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "script_railtypelist.hpp"
|
||||
#include "../../rail.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptRailTypeList::ScriptRailTypeList()
|
||||
{
|
||||
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_road.cpp 26149 2013-12-08 15:44:09Z frosch $ */
|
||||
/* $Id: script_road.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "../../station_base.h"
|
||||
#include "../../script/squirrel_helper_type.hpp"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ ScriptRoad::RoadVehicleType ScriptRoad::GetRoadVehicleTypeForCargo(CargoID cargo_type)
|
||||
{
|
||||
return ScriptCargo::HasCargoClass(cargo_type, ScriptCargo::CC_PASSENGERS) ? ROADVEHTYPE_BUS : ROADVEHTYPE_TRUCK;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_sign.cpp 25488 2013-06-27 19:57:41Z rubidium $ */
|
||||
/* $Id: script_sign.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "../../strings_func.h"
|
||||
#include "../../tile_map.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptSign::IsValidSign(SignID sign_id)
|
||||
{
|
||||
const Sign *si = ::Sign::GetIfValid(sign_id);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_signlist.cpp 23355 2011-11-29 23:15:35Z truebrain $ */
|
||||
/* $Id: script_signlist.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "script_sign.hpp"
|
||||
#include "../../signs_base.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptSignList::ScriptSignList()
|
||||
{
|
||||
Sign *s;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_station.cpp 26398 2014-03-11 22:08:58Z zuu $ */
|
||||
/* $Id: script_station.cpp 27020 2014-10-15 18:31:37Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "../../roadstop_base.h"
|
||||
#include "../../town.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptStation::IsValidStation(StationID station_id)
|
||||
{
|
||||
const Station *st = ::Station::GetIfValid(station_id);
|
||||
@@ -37,45 +39,104 @@
|
||||
return ::GetStationIndex(tile);
|
||||
}
|
||||
|
||||
template<bool Tfrom, bool Tvia>
|
||||
/* static */ bool ScriptStation::IsCargoRequestValid(StationID station_id,
|
||||
StationID from_station_id, StationID via_station_id, CargoID cargo_id)
|
||||
{
|
||||
if (!IsValidStation(station_id)) return false;
|
||||
if (Tfrom && !IsValidStation(from_station_id) && from_station_id != STATION_INVALID) return false;
|
||||
if (Tvia && !IsValidStation(via_station_id) && via_station_id != STATION_INVALID) return false;
|
||||
if (!ScriptCargo::IsValidCargo(cargo_id)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
template<bool Tfrom, bool Tvia>
|
||||
/* static */ int32 ScriptStation::CountCargoWaiting(StationID station_id,
|
||||
StationID from_station_id, StationID via_station_id, CargoID cargo_id)
|
||||
{
|
||||
if (!ScriptStation::IsCargoRequestValid<Tfrom, Tvia>(station_id, from_station_id,
|
||||
via_station_id, cargo_id)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
const StationCargoList &cargo_list = ::Station::Get(station_id)->goods[cargo_id].cargo;
|
||||
if (!Tfrom && !Tvia) return cargo_list.TotalCount();
|
||||
|
||||
uint16 cargo_count = 0;
|
||||
std::pair<StationCargoList::ConstIterator, StationCargoList::ConstIterator> range = Tvia ?
|
||||
cargo_list.Packets()->equal_range(via_station_id) :
|
||||
std::make_pair(StationCargoList::ConstIterator(cargo_list.Packets()->begin()),
|
||||
StationCargoList::ConstIterator(cargo_list.Packets()->end()));
|
||||
for (StationCargoList::ConstIterator it = range.first; it != range.second; it++) {
|
||||
const CargoPacket *cp = *it;
|
||||
if (!Tfrom || cp->SourceStation() == from_station_id) cargo_count += cp->Count();
|
||||
}
|
||||
|
||||
return cargo_count;
|
||||
}
|
||||
|
||||
/* static */ int32 ScriptStation::GetCargoWaiting(StationID station_id, CargoID cargo_id)
|
||||
{
|
||||
if (!IsValidStation(station_id)) return -1;
|
||||
if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
|
||||
|
||||
return ::Station::Get(station_id)->goods[cargo_id].cargo.TotalCount();
|
||||
return CountCargoWaiting<false, false>(station_id, STATION_INVALID, STATION_INVALID, cargo_id);
|
||||
}
|
||||
|
||||
/* static */ int32 ScriptStation::GetCargoWaitingFrom(StationID station_id, StationID from_station_id, CargoID cargo_id)
|
||||
/* static */ int32 ScriptStation::GetCargoWaitingFrom(StationID station_id,
|
||||
StationID from_station_id, CargoID cargo_id)
|
||||
{
|
||||
if (!IsValidStation(station_id)) return -1;
|
||||
if (!IsValidStation(from_station_id) && from_station_id != STATION_INVALID) return -1;
|
||||
if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
|
||||
|
||||
const StationCargoList &cargo_list = ::Station::Get(station_id)->goods[cargo_id].cargo;
|
||||
uint16 cargo_count = 0;
|
||||
for (StationCargoList::ConstIterator it = cargo_list.Packets()->begin(); it != cargo_list.Packets()->end(); it++) {
|
||||
CargoPacket *cp = *it;
|
||||
if (cp->SourceStation() == from_station_id) cargo_count += cp->Count();
|
||||
}
|
||||
|
||||
return cargo_count;
|
||||
return CountCargoWaiting<true, false>(station_id, from_station_id, STATION_INVALID, cargo_id);
|
||||
}
|
||||
|
||||
/* static */ int32 ScriptStation::GetCargoWaitingVia(StationID station_id, StationID via_station_id, CargoID cargo_id)
|
||||
/* static */ int32 ScriptStation::GetCargoWaitingVia(StationID station_id,
|
||||
StationID via_station_id, CargoID cargo_id)
|
||||
{
|
||||
if (!IsValidStation(station_id)) return -1;
|
||||
if (!IsValidStation(via_station_id) && via_station_id != STATION_INVALID) return -1;
|
||||
if (!ScriptCargo::IsValidCargo(cargo_id)) return -1;
|
||||
return CountCargoWaiting<false, true>(station_id, STATION_INVALID, via_station_id, cargo_id);
|
||||
}
|
||||
|
||||
const StationCargoList &cargo_list = ::Station::Get(station_id)->goods[cargo_id].cargo;
|
||||
uint16 cargo_count = 0;
|
||||
std::pair<StationCargoList::ConstIterator, StationCargoList::ConstIterator> range = cargo_list.Packets()->equal_range(via_station_id);
|
||||
for (StationCargoList::ConstIterator it = range.first; it != range.second; it++) {
|
||||
CargoPacket *cp = *it;
|
||||
cargo_count += cp->Count();
|
||||
/* static */ int32 ScriptStation::GetCargoWaitingFromVia(StationID station_id,
|
||||
StationID from_station_id, StationID via_station_id, CargoID cargo_id)
|
||||
{
|
||||
return CountCargoWaiting<true, true>(station_id, from_station_id, via_station_id, cargo_id);
|
||||
}
|
||||
|
||||
template<bool Tfrom, bool Tvia>
|
||||
/* static */ int32 ScriptStation::CountCargoPlanned(StationID station_id,
|
||||
StationID from_station_id, StationID via_station_id, CargoID cargo_id)
|
||||
{
|
||||
if (!ScriptStation::IsCargoRequestValid<Tfrom, Tvia>(station_id, from_station_id,
|
||||
via_station_id, cargo_id)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return cargo_count;
|
||||
const FlowStatMap &flows = ::Station::Get(station_id)->goods[cargo_id].flows;
|
||||
if (Tfrom) {
|
||||
return Tvia ? flows.GetFlowFromVia(from_station_id, via_station_id) :
|
||||
flows.GetFlowFrom(from_station_id);
|
||||
} else {
|
||||
return Tvia ? flows.GetFlowVia(via_station_id) : flows.GetFlow();
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ int32 ScriptStation::GetCargoPlanned(StationID station_id, CargoID cargo_id)
|
||||
{
|
||||
return CountCargoPlanned<false, false>(station_id, STATION_INVALID, STATION_INVALID, cargo_id);
|
||||
}
|
||||
|
||||
/* static */ int32 ScriptStation::GetCargoPlannedFrom(StationID station_id,
|
||||
StationID from_station_id, CargoID cargo_id)
|
||||
{
|
||||
return CountCargoPlanned<true, false>(station_id, from_station_id, STATION_INVALID, cargo_id);
|
||||
}
|
||||
|
||||
/* static */ int32 ScriptStation::GetCargoPlannedVia(StationID station_id,
|
||||
StationID via_station_id, CargoID cargo_id)
|
||||
{
|
||||
return CountCargoPlanned<false, true>(station_id, STATION_INVALID, via_station_id, cargo_id);
|
||||
}
|
||||
|
||||
/* static */ int32 ScriptStation::GetCargoPlannedFromVia(StationID station_id,
|
||||
StationID from_station_id, StationID via_station_id, CargoID cargo_id)
|
||||
{
|
||||
return CountCargoPlanned<true, true>(station_id, from_station_id, via_station_id, cargo_id);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptStation::HasCargoRating(StationID station_id, CargoID cargo_id)
|
||||
@@ -169,7 +230,7 @@
|
||||
return ::Station::Get(station_id)->town->index;
|
||||
}
|
||||
|
||||
/*static */ bool ScriptStation::IsAirportClosed(StationID station_id)
|
||||
/* static */ bool ScriptStation::IsAirportClosed(StationID station_id)
|
||||
{
|
||||
EnforcePrecondition(false, IsValidStation(station_id));
|
||||
EnforcePrecondition(false, HasStationType(station_id, STATION_AIRPORT));
|
||||
@@ -177,7 +238,7 @@
|
||||
return (::Station::Get(station_id)->airport.flags & AIRPORT_CLOSED_block) != 0;
|
||||
}
|
||||
|
||||
/*static */ bool ScriptStation::OpenCloseAirport(StationID station_id)
|
||||
/* static */ bool ScriptStation::OpenCloseAirport(StationID station_id)
|
||||
{
|
||||
EnforcePrecondition(false, IsValidStation(station_id));
|
||||
EnforcePrecondition(false, HasStationType(station_id, STATION_AIRPORT));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_station.hpp 26396 2014-03-10 22:18:53Z zuu $ */
|
||||
/* $Id: script_station.hpp 27123 2015-01-20 19:11:31Z frosch $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -89,6 +89,7 @@ public:
|
||||
/**
|
||||
* See how much cargo with a specific source station there is waiting on a station.
|
||||
* @param station_id The station to get the cargo-waiting of.
|
||||
* @param from_station_id The source station of the cargo. Pass STATION_INVALID to get cargo of which the source has been deleted.
|
||||
* @param cargo_id The cargo to get the cargo-waiting of.
|
||||
* @pre IsValidStation(station_id).
|
||||
* @pre IsValidStation(from_station_id) || from_station_id == STATION_INVALID.
|
||||
@@ -100,17 +101,84 @@ public:
|
||||
|
||||
/**
|
||||
* See how much cargo with a specific via-station there is waiting on a station.
|
||||
* @param station_id The station to get the cargo-waiting of, or pass STATION_INVALID to get waiting cargo for "via any station".
|
||||
* @param station_id The station to get the cargo-waiting of.
|
||||
* @param via_station_id The next station the cargo is going to. Pass STATION_INVALID to get waiting cargo for "via any station".
|
||||
* @param cargo_id The cargo to get the cargo-waiting of.
|
||||
* @pre IsValidStation(station_id).
|
||||
* @pre IsValidStation(via_station_id) || via_station_id == STATION_INVALID.
|
||||
* @pre IsValidCargo(cargo_id).
|
||||
* @return The amount of units waiting at the station with via_station_id as next hop.
|
||||
* @note if ScriptCargo.GetCargoDistributionType(cargo_id) == ScriptCargo.DT_MANUAL, then all waiting cargo will have STATION_INVALID as next hop.
|
||||
|
||||
*/
|
||||
static int32 GetCargoWaitingVia(StationID station_id, StationID via_station_id, CargoID cargo_id);
|
||||
|
||||
/**
|
||||
* See how much cargo with a specific via-station and source station there is waiting on a station.
|
||||
* @param station_id The station to get the cargo-waiting of.
|
||||
* @param from_station_id The source station of the cargo. Pass STATION_INVALID to get cargo of which the source has been deleted.
|
||||
* @param via_station_id The next station the cargo is going to. Pass STATION_INVALID to get waiting cargo for "via any station".
|
||||
* @param cargo_id The cargo to get the cargo-waiting of.
|
||||
* @pre IsValidStation(station_id).
|
||||
* @pre IsValidStation(from_station_id) || from_station_id == STATION_INVALID.
|
||||
* @pre IsValidStation(via_station_id) || via_station_id == STATION_INVALID.
|
||||
* @pre IsValidCargo(cargo_id).
|
||||
* @return The amount of units waiting at the station with from_station_id as source and via_station_id as next hop.
|
||||
* @note if ScriptCargo.GetCargoDistributionType(cargo_id) == ScriptCargo.DT_MANUAL, then all waiting cargo will have STATION_INVALID as next hop.
|
||||
*/
|
||||
static int32 GetCargoWaitingFromVia(StationID station_id, StationID from_station_id, StationID via_station_id, CargoID cargo_id);
|
||||
|
||||
/**
|
||||
* See how much cargo was planned to pass (including production and consumption) this station per month.
|
||||
* @param station_id The station to get the planned flow for.
|
||||
* @param cargo_id The cargo type to get the planned flow for.
|
||||
* @pre IsValidStation(station_id).
|
||||
* @pre IsValidCargo(cargo_id).
|
||||
* @return The amount of cargo units planned to pass the station per month.
|
||||
*/
|
||||
static int32 GetCargoPlanned(StationID station_id, CargoID cargo_id);
|
||||
|
||||
/**
|
||||
* See how much cargo from the specified origin was planned to pass (including production and consumption) this station per month.
|
||||
* @param station_id The station to get the planned flow for.
|
||||
* @param from_station_id The station the cargo originates at.
|
||||
* @param cargo_id The cargo type to get the planned flow for.
|
||||
* @pre IsValidStation(station_id).
|
||||
* @pre IsValidStation(from_station_id) || from_station_id == STATION_INVALID.
|
||||
* @pre IsValidCargo(cargo_id).
|
||||
* @return The amount of cargo units from the specified origin planned to pass the station per month.
|
||||
*/
|
||||
static int32 GetCargoPlannedFrom(StationID station_id, StationID from_station_id, CargoID cargo_id);
|
||||
|
||||
/**
|
||||
* See how much cargo was planned to pass (including production and consumption) this station per month, heading for the specified next hop.
|
||||
* @param station_id The station to get the planned flow for.
|
||||
* @param via_station_id The next station the cargo will go on to.
|
||||
* @param cargo_id The cargo type to get the planned flow for.
|
||||
* @pre IsValidStation(station_id).
|
||||
* @pre IsValidStation(via_station_id) || via_station_id == STATION_INVALID.
|
||||
* @pre IsValidCargo(cargo_id).
|
||||
* @return The amount of cargo units planned to pass the station per month, going via the specified next hop.
|
||||
* @note Cargo planned to go "via" the same station that's being queried is actually planned to be consumed there.
|
||||
*/
|
||||
static int32 GetCargoPlannedVia(StationID station_id, StationID via_station_id, CargoID cargo_id);
|
||||
|
||||
/**
|
||||
* See how much cargo from the specified origin was planned to pass this station per month,
|
||||
* heading for the specified next hop.
|
||||
* @param station_id The station to get the planned flow for.
|
||||
* @param from_station_id The station the cargo originates at.
|
||||
* @param via_station_id The next station the cargo will go on to.
|
||||
* @param cargo_id The cargo type to get the planned flow for.
|
||||
* @pre IsValidStation(station_id).
|
||||
* @pre IsValidStation(from_station_id) || from_station_id == STATION_INVALID.
|
||||
* @pre IsValidStation(via_station_id) || via_station_id == STATION_INVALID.
|
||||
* @pre IsValidCargo(cargo_id).
|
||||
* @return The amount of cargo units from the specified origin planned to pass the station per month, going via the specified next hop.
|
||||
* @note Cargo planned to go "via" the same station that's being queried is actually planned to be consumed there.
|
||||
* @note Cargo planned to pass "from" the same station that's being queried is actually produced there.
|
||||
*/
|
||||
static int32 GetCargoPlannedFromVia(StationID station_id, StationID from_station_id, StationID via_station_id, CargoID cargo_id);
|
||||
|
||||
/**
|
||||
* Check whether the given cargo at the given station a rating.
|
||||
* @param station_id The station to get the cargo-rating state of.
|
||||
@@ -223,9 +291,23 @@ public:
|
||||
* @param station_id The airport to modify.
|
||||
* @pre IsValidStation(station_id).
|
||||
* @pre HasStationType(station_id, STATION_AIRPORT).
|
||||
* @return True if the state could be toggled.
|
||||
* @return True if the state was toggled successfully.
|
||||
*/
|
||||
static bool OpenCloseAirport(StationID station_id);
|
||||
|
||||
private:
|
||||
template<bool Tfrom, bool Tvia>
|
||||
static bool IsCargoRequestValid(StationID station_id, StationID from_station_id,
|
||||
StationID via_station_id, CargoID cargo_id);
|
||||
|
||||
template<bool Tfrom, bool Tvia>
|
||||
static int32 CountCargoWaiting(StationID station_id, StationID from_station_id,
|
||||
StationID via_station_id, CargoID cargo_id);
|
||||
|
||||
template<bool Tfrom, bool Tvia>
|
||||
static int32 CountCargoPlanned(StationID station_id, StationID from_station_id,
|
||||
StationID via_station_id, CargoID cargo_id);
|
||||
|
||||
};
|
||||
|
||||
DECLARE_ENUM_AS_BIT_SET(ScriptStation::StationType)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_stationlist.cpp 23632 2011-12-19 21:05:25Z truebrain $ */
|
||||
/* $Id: script_stationlist.cpp 27020 2014-10-15 18:31:37Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -12,9 +12,12 @@
|
||||
#include "../../stdafx.h"
|
||||
#include "script_stationlist.hpp"
|
||||
#include "script_vehicle.hpp"
|
||||
#include "script_cargo.hpp"
|
||||
#include "../../station_base.h"
|
||||
#include "../../vehicle_base.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptStationList::ScriptStationList(ScriptStation::StationType station_type)
|
||||
{
|
||||
Station *st;
|
||||
@@ -33,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_stationlist.hpp 23615 2011-12-19 20:57:34Z truebrain $ */
|
||||
/* $Id: script_stationlist.hpp 27003 2014-10-12 18:41:53Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -28,6 +28,251 @@ public:
|
||||
ScriptStationList(ScriptStation::StationType station_type);
|
||||
};
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_story_page.cpp 26307 2014-02-06 19:50:34Z zuu $ */
|
||||
/* $Id: script_story_page.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "../../string_func.h"
|
||||
#include "../../tile_map.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptStoryPage::IsValidStoryPage(StoryPageID story_page_id)
|
||||
{
|
||||
return ::StoryPage::IsValidID(story_page_id);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_storypageelementlist.cpp 26305 2014-02-06 19:41:56Z zuu $ */
|
||||
/* $Id: script_storypageelementlist.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "script_storypageelementlist.hpp"
|
||||
#include "../../story_base.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptStoryPageElementList::ScriptStoryPageElementList(ScriptStoryPage::StoryPageID story_page_id)
|
||||
{
|
||||
if (!ScriptStoryPage::IsValidStoryPage(story_page_id)) return;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_storypagelist.cpp 26304 2014-02-06 19:36:19Z zuu $ */
|
||||
/* $Id: script_storypagelist.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "script_story_page.hpp"
|
||||
#include "../../story_base.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptStoryPageList::ScriptStoryPageList(ScriptCompany::CompanyID company)
|
||||
{
|
||||
uint8 c = company;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_subsidy.cpp 26307 2014-02-06 19:50:34Z zuu $ */
|
||||
/* $Id: script_subsidy.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "../../subsidy_base.h"
|
||||
#include "../../station_base.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptSubsidy::IsValidSubsidy(SubsidyID subsidy_id)
|
||||
{
|
||||
return ::Subsidy::IsValidID(subsidy_id);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_subsidylist.cpp 23355 2011-11-29 23:15:35Z truebrain $ */
|
||||
/* $Id: script_subsidylist.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "script_subsidylist.hpp"
|
||||
#include "../../subsidy_base.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptSubsidyList::ScriptSubsidyList()
|
||||
{
|
||||
const Subsidy *s;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_testmode.cpp 24008 2012-03-04 16:54:12Z rubidium $ */
|
||||
/* $Id: script_testmode.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "../script_instance.hpp"
|
||||
#include "../script_fatalerror.hpp"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
bool ScriptTestMode::ModeProc()
|
||||
{
|
||||
/* In test mode we only return 'false', telling the DoCommand it
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_text.cpp 25555 2013-07-04 16:36:47Z rubidium $ */
|
||||
/* $Id: script_text.cpp 27102 2015-01-01 20:50:43Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -17,18 +17,30 @@
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
RawText::RawText(const char *text) : text(stredup(text))
|
||||
{
|
||||
}
|
||||
|
||||
RawText::~RawText()
|
||||
{
|
||||
free(this->text);
|
||||
}
|
||||
|
||||
|
||||
ScriptText::ScriptText(HSQUIRRELVM vm) :
|
||||
ZeroedMemoryAllocator()
|
||||
{
|
||||
int nparam = sq_gettop(vm) - 1;
|
||||
if (nparam < 1) {
|
||||
throw sq_throwerror(vm, _SC("You need to pass at least a StringID to the constructor"));
|
||||
throw sq_throwerror(vm, "You need to pass at least a StringID to the constructor");
|
||||
}
|
||||
|
||||
/* First resolve the StringID. */
|
||||
SQInteger sqstring;
|
||||
if (SQ_FAILED(sq_getinteger(vm, 2, &sqstring))) {
|
||||
throw sq_throwerror(vm, _SC("First argument must be a valid StringID"));
|
||||
throw sq_throwerror(vm, "First argument must be a valid StringID");
|
||||
}
|
||||
this->string = sqstring;
|
||||
|
||||
@@ -39,7 +51,7 @@ ScriptText::ScriptText(HSQUIRRELVM vm) :
|
||||
|
||||
if (SQ_FAILED(this->_SetParam(i, vm))) {
|
||||
this->~ScriptText();
|
||||
throw sq_throwerror(vm, _SC("Invalid parameter"));
|
||||
throw sq_throwerror(vm, "Invalid parameter");
|
||||
}
|
||||
|
||||
/* Pop the parameter again. */
|
||||
@@ -71,7 +83,7 @@ SQInteger ScriptText::_SetParam(int parameter, HSQUIRRELVM vm)
|
||||
const SQChar *value;
|
||||
sq_getstring(vm, -1, &value);
|
||||
|
||||
this->params[parameter] = strdup(SQ2OTTD(value));
|
||||
this->params[parameter] = stredup(value);
|
||||
ValidateString(this->params[parameter]);
|
||||
break;
|
||||
}
|
||||
@@ -92,7 +104,7 @@ SQInteger ScriptText::_SetParam(int parameter, HSQUIRRELVM vm)
|
||||
|
||||
/* Validate if it is a GSText instance */
|
||||
sq_pushroottable(vm);
|
||||
sq_pushstring(vm, _SC("GSText"), -1);
|
||||
sq_pushstring(vm, "GSText", -1);
|
||||
sq_get(vm, -2);
|
||||
sq_pushobject(vm, instance);
|
||||
if (sq_instanceof(vm) != SQTrue) return SQ_ERROR;
|
||||
@@ -145,9 +157,8 @@ SQInteger ScriptText::_set(HSQUIRRELVM vm)
|
||||
int32 k;
|
||||
|
||||
if (sq_gettype(vm, 2) == OT_STRING) {
|
||||
const SQChar *key;
|
||||
sq_getstring(vm, 2, &key);
|
||||
const char *key_string = SQ2OTTD(key);
|
||||
const SQChar *key_string;
|
||||
sq_getstring(vm, 2, &key_string);
|
||||
ValidateString(key_string);
|
||||
|
||||
if (strncmp(key_string, "param_", 6) != 0 || strlen(key_string) > 8) return SQ_ERROR;
|
||||
@@ -190,7 +201,7 @@ char *ScriptText::_GetEncodedText(char *p, char *lastofp, int ¶m_count)
|
||||
p = this->paramt[i]->_GetEncodedText(p, lastofp, param_count);
|
||||
continue;
|
||||
}
|
||||
p += seprintf(p, lastofp,":%X", (uint32)this->parami[i]);
|
||||
p += seprintf(p, lastofp,":" OTTD_PRINTFHEX64, this->parami[i]);
|
||||
param_count++;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_text.hpp 25488 2013-06-27 19:57:41Z rubidium $ */
|
||||
/* $Id: script_text.hpp 27102 2015-01-01 20:50:43Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -42,9 +42,8 @@ public:
|
||||
*/
|
||||
class RawText : public Text {
|
||||
public:
|
||||
RawText(const char *text) :
|
||||
text(strdup(text)) {}
|
||||
~RawText() { free(this->text); }
|
||||
RawText(const char *text);
|
||||
~RawText();
|
||||
|
||||
/* virtual */ const char *GetEncodedText() { return this->text; }
|
||||
private:
|
||||
@@ -130,7 +129,7 @@ public:
|
||||
private:
|
||||
StringID string;
|
||||
char *params[SCRIPT_TEXT_MAX_PARAMETERS];
|
||||
int parami[SCRIPT_TEXT_MAX_PARAMETERS];
|
||||
int64 parami[SCRIPT_TEXT_MAX_PARAMETERS];
|
||||
ScriptText *paramt[SCRIPT_TEXT_MAX_PARAMETERS];
|
||||
int paramc;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_tile.cpp 25815 2013-10-06 11:16:00Z frosch $ */
|
||||
/* $Id: script_tile.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "../../town.h"
|
||||
#include "../../landscape.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptTile::IsBuildable(TileIndex tile)
|
||||
{
|
||||
if (!::IsValidTile(tile)) return false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_tilelist.cpp 23355 2011-11-29 23:15:35Z truebrain $ */
|
||||
/* $Id: script_tilelist.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "../../industry.h"
|
||||
#include "../../station_base.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
void ScriptTileList::AddRectangle(TileIndex t1, TileIndex t2)
|
||||
{
|
||||
if (!::IsValidTile(t1)) return;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_town.cpp 26270 2014-01-20 22:34:22Z frosch $ */
|
||||
/* $Id: script_town.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "../../landscape.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ int32 ScriptTown::GetTownCount()
|
||||
{
|
||||
return (int32)::Town::GetNumItems();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_town.hpp 25969 2013-11-12 17:57:32Z frosch $ */
|
||||
/* $Id: script_town.hpp 26915 2014-09-24 16:45:20Z frosch $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -232,10 +232,10 @@ public:
|
||||
/**
|
||||
* Set the goal of a cargo for this town.
|
||||
* @param town_id The index of the town.
|
||||
* @param towneffect_id The index of the cargo.
|
||||
* @param towneffect_id The index of the towneffect.
|
||||
* @param goal The new goal.
|
||||
* @pre IsValidTown(town_id).
|
||||
* @pre ScriptCargo::IsValidTownEffect(cargo_id).
|
||||
* @pre ScriptCargo::IsValidTownEffect(towneffect_id).
|
||||
* @return True if the action succeeded.
|
||||
* @api -ai
|
||||
*/
|
||||
@@ -247,7 +247,7 @@ public:
|
||||
* @param town_id The index of the town.
|
||||
* @param towneffect_id The index of the towneffect.
|
||||
* @pre IsValidTown(town_id).
|
||||
* @pre ScriptCargo::IsValidTownEffect(cargo_id).
|
||||
* @pre ScriptCargo::IsValidTownEffect(towneffect_id).
|
||||
* @return The goal of the cargo.
|
||||
* @note Goals can change over time. For example with a changing snowline, or
|
||||
* with a growing town.
|
||||
@@ -263,6 +263,7 @@ public:
|
||||
* @return True if the action succeeded.
|
||||
* @note Even when setting a growth rate, towns only grow when the conditions for growth (SetCargoCoal) are met,
|
||||
* and the game settings (economy.town_growth_rate) allow town growth at all.
|
||||
* @note When changing the growth rate, the relative progress is preserved and scaled to the new rate.
|
||||
* @api -ai
|
||||
*/
|
||||
static bool SetGrowthRate(TownID town_id, uint32 days_between_town_growth);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_townlist.cpp 23355 2011-11-29 23:15:35Z truebrain $ */
|
||||
/* $Id: script_townlist.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "script_townlist.hpp"
|
||||
#include "../../town.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptTownList::ScriptTownList()
|
||||
{
|
||||
Town *t;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_tunnel.cpp 26149 2013-12-08 15:44:09Z frosch $ */
|
||||
/* $Id: script_tunnel.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "../script_instance.hpp"
|
||||
#include "../../tunnel_map.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptTunnel::IsTunnelTile(TileIndex tile)
|
||||
{
|
||||
if (!::IsValidTile(tile)) return false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_vehicle.cpp 25488 2013-06-27 19:57:41Z rubidium $ */
|
||||
/* $Id: script_vehicle.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "../../aircraft.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptVehicle::IsValidVehicle(VehicleID vehicle_id)
|
||||
{
|
||||
const Vehicle *v = ::Vehicle::GetIfValid(vehicle_id);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_vehiclelist.cpp 23941 2012-02-12 21:17:32Z smatz $ */
|
||||
/* $Id: script_vehiclelist.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "../../depot_map.h"
|
||||
#include "../../vehicle_base.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptVehicleList::ScriptVehicleList()
|
||||
{
|
||||
const Vehicle *v;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_viewport.cpp 23737 2012-01-03 20:37:56Z truebrain $ */
|
||||
/* $Id: script_viewport.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "script_map.hpp"
|
||||
#include "../../viewport_func.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ void ScriptViewport::ScrollTo(TileIndex tile)
|
||||
{
|
||||
if (ScriptGame::IsMultiplayer()) return;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_waypoint.cpp 23632 2011-12-19 21:05:25Z truebrain $ */
|
||||
/* $Id: script_waypoint.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "script_marine.hpp"
|
||||
#include "../../waypoint_base.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ bool ScriptWaypoint::IsValidWaypoint(StationID waypoint_id)
|
||||
{
|
||||
const Waypoint *wp = ::Waypoint::GetIfValid(waypoint_id);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_waypointlist.cpp 23632 2011-12-19 21:05:25Z truebrain $ */
|
||||
/* $Id: script_waypointlist.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "../../vehicle_base.h"
|
||||
#include "../../waypoint_base.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
ScriptWaypointList::ScriptWaypointList(ScriptWaypoint::WaypointType waypoint_type)
|
||||
{
|
||||
const Waypoint *wp;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_window.cpp 23737 2012-01-03 20:37:56Z truebrain $ */
|
||||
/* $Id: script_window.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "../../window_func.h"
|
||||
#include "../../window_gui.h"
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
/* static */ void ScriptWindow::Close(WindowClass window, uint32 number)
|
||||
{
|
||||
if (ScriptGame::IsMultiplayer()) return;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: script_window.hpp 26320 2014-02-09 13:04:50Z alberth $ */
|
||||
/* $Id: script_window.hpp 27152 2015-02-15 14:56:21Z frosch $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -753,11 +753,17 @@ public:
|
||||
WC_SPRITE_ALIGNER = ::WC_SPRITE_ALIGNER,
|
||||
|
||||
/**
|
||||
* Linkgraph legend; Window numbers:
|
||||
* Linkgraph legend; %Window numbers:
|
||||
* - 0 = #LinkGraphWidgets
|
||||
*/
|
||||
WC_LINKGRAPH_LEGEND = ::WC_LINKGRAPH_LEGEND,
|
||||
|
||||
/**
|
||||
* Save preset; %Window numbers:
|
||||
* - 0 = #SavePresetWidgets
|
||||
*/
|
||||
WC_SAVE_PRESET = ::WC_SAVE_PRESET,
|
||||
|
||||
WC_INVALID = ::WC_INVALID, ///< Invalid window.
|
||||
};
|
||||
|
||||
@@ -917,6 +923,11 @@ public:
|
||||
enum ReplaceVehicleWidgets {
|
||||
WID_RV_CAPTION = ::WID_RV_CAPTION, ///< Caption of the window.
|
||||
|
||||
/* Sort dropdown at the right. */
|
||||
WID_RV_SORT_ASCENDING_DESCENDING = ::WID_RV_SORT_ASCENDING_DESCENDING, ///< Ascending/descending sort order button.
|
||||
WID_RV_SHOW_HIDDEN_ENGINES = ::WID_RV_SHOW_HIDDEN_ENGINES, ///< Toggle whether to display the hidden vehicles.
|
||||
WID_RV_SORT_DROPDOWN = ::WID_RV_SORT_DROPDOWN, ///< Dropdown for the sort criteria.
|
||||
|
||||
/* Left and right matrix + details. */
|
||||
WID_RV_LEFT_MATRIX = ::WID_RV_LEFT_MATRIX, ///< The matrix on the left.
|
||||
WID_RV_LEFT_SCROLLBAR = ::WID_RV_LEFT_SCROLLBAR, ///< The scrollbar for the matrix on the left.
|
||||
@@ -965,13 +976,15 @@ public:
|
||||
/** Widgets of the #BuildVehicleWindow class. */
|
||||
enum BuildVehicleWidgets {
|
||||
WID_BV_CAPTION = ::WID_BV_CAPTION, ///< Caption of window.
|
||||
WID_BV_SORT_ASSENDING_DESCENDING = ::WID_BV_SORT_ASSENDING_DESCENDING, ///< Sort direction.
|
||||
WID_BV_SORT_ASCENDING_DESCENDING = ::WID_BV_SORT_ASCENDING_DESCENDING, ///< Sort direction.
|
||||
WID_BV_SORT_DROPDOWN = ::WID_BV_SORT_DROPDOWN, ///< Criteria of sorting dropdown.
|
||||
WID_BV_CARGO_FILTER_DROPDOWN = ::WID_BV_CARGO_FILTER_DROPDOWN, ///< Cargo filter dropdown.
|
||||
WID_BV_SHOW_HIDDEN_ENGINES = ::WID_BV_SHOW_HIDDEN_ENGINES, ///< Toggle whether to display the hidden vehicles.
|
||||
WID_BV_LIST = ::WID_BV_LIST, ///< List of vehicles.
|
||||
WID_BV_SCROLLBAR = ::WID_BV_SCROLLBAR, ///< Scrollbar of list.
|
||||
WID_BV_PANEL = ::WID_BV_PANEL, ///< Button panel.
|
||||
WID_BV_BUILD = ::WID_BV_BUILD, ///< Build panel.
|
||||
WID_BV_SHOW_HIDE = ::WID_BV_SHOW_HIDE, ///< Button to hide or show the selected engine.
|
||||
WID_BV_BUILD_SEL = ::WID_BV_BUILD_SEL, ///< Build button.
|
||||
WID_BV_RENAME = ::WID_BV_RENAME, ///< Rename button.
|
||||
};
|
||||
@@ -1278,11 +1291,12 @@ public:
|
||||
WID_GL_TOWN_PULLDOWN = ::WID_GL_TOWN_PULLDOWN, ///< Dropdown 'No. of towns'.
|
||||
WID_GL_INDUSTRY_PULLDOWN = ::WID_GL_INDUSTRY_PULLDOWN, ///< Dropdown 'No. of industries'.
|
||||
|
||||
WID_GL_RANDOM_EDITBOX = ::WID_GL_RANDOM_EDITBOX, ///< 'Random seed' editbox.
|
||||
WID_GL_RANDOM_BUTTON = ::WID_GL_RANDOM_BUTTON, ///< 'Randomise' button.
|
||||
|
||||
WID_GL_GENERATE_BUTTON = ::WID_GL_GENERATE_BUTTON, ///< 'Generate' button.
|
||||
|
||||
WID_GL_MAX_HEIGHTLEVEL_DOWN = ::WID_GL_MAX_HEIGHTLEVEL_DOWN, ///< Decrease max. heightlevel
|
||||
WID_GL_MAX_HEIGHTLEVEL_TEXT = ::WID_GL_MAX_HEIGHTLEVEL_TEXT, ///< Max. heightlevel
|
||||
WID_GL_MAX_HEIGHTLEVEL_UP = ::WID_GL_MAX_HEIGHTLEVEL_UP, ///< Increase max. heightlevel
|
||||
|
||||
WID_GL_START_DATE_DOWN = ::WID_GL_START_DATE_DOWN, ///< Decrease start year.
|
||||
WID_GL_START_DATE_TEXT = ::WID_GL_START_DATE_TEXT, ///< Start year.
|
||||
WID_GL_START_DATE_UP = ::WID_GL_START_DATE_UP, ///< Increase start year.
|
||||
@@ -1817,6 +1831,7 @@ public:
|
||||
WID_NS_REMOVE = ::WID_NS_REMOVE, ///< Remove NewGRF from active list.
|
||||
WID_NS_MOVE_UP = ::WID_NS_MOVE_UP, ///< Move NewGRF up in active list.
|
||||
WID_NS_MOVE_DOWN = ::WID_NS_MOVE_DOWN, ///< Move NewGRF down in active list.
|
||||
WID_NS_UPGRADE = ::WID_NS_UPGRADE, ///< Upgrade NewGRFs that have a newer version available.
|
||||
WID_NS_FILTER = ::WID_NS_FILTER, ///< Filter list of available NewGRFs.
|
||||
WID_NS_FILE_LIST = ::WID_NS_FILE_LIST, ///< List window of active NewGRFs.
|
||||
WID_NS_SCROLLBAR = ::WID_NS_SCROLLBAR, ///< Scrollbar for active NewGRF list.
|
||||
@@ -1838,6 +1853,15 @@ public:
|
||||
WID_NS_SHOW_APPLY = ::WID_NS_SHOW_APPLY, ///< Select display of the buttons below the 'details'.
|
||||
};
|
||||
|
||||
/** Widgets of the #SavePresetWindow class. */
|
||||
enum SavePresetWidgets {
|
||||
WID_SVP_PRESET_LIST = ::WID_SVP_PRESET_LIST, ///< List with available preset names.
|
||||
WID_SVP_SCROLLBAR = ::WID_SVP_SCROLLBAR, ///< Scrollbar for the list available preset names.
|
||||
WID_SVP_EDITBOX = ::WID_SVP_EDITBOX, ///< Edit box for changing the preset name.
|
||||
WID_SVP_CANCEL = ::WID_SVP_CANCEL, ///< Button to cancel saving the preset.
|
||||
WID_SVP_SAVE = ::WID_SVP_SAVE, ///< Button to save the preset.
|
||||
};
|
||||
|
||||
/** Widgets of the #ScanProgressWindow class. */
|
||||
enum ScanProgressWidgets {
|
||||
WID_SP_PROGRESS_BAR = ::WID_SP_PROGRESS_BAR, ///< Simple progress bar.
|
||||
@@ -2104,7 +2128,7 @@ public:
|
||||
WID_GO_LANG_DROPDOWN = ::WID_GO_LANG_DROPDOWN, ///< Language dropdown.
|
||||
WID_GO_RESOLUTION_DROPDOWN = ::WID_GO_RESOLUTION_DROPDOWN, ///< Dropdown for the resolution.
|
||||
WID_GO_FULLSCREEN_BUTTON = ::WID_GO_FULLSCREEN_BUTTON, ///< Toggle fullscreen.
|
||||
WID_GO_SCREENSHOT_DROPDOWN = ::WID_GO_SCREENSHOT_DROPDOWN, ///< Select the screenshot type... please use PNG!.
|
||||
WID_GO_GUI_ZOOM_DROPDOWN = ::WID_GO_GUI_ZOOM_DROPDOWN, ///< Dropdown for the GUI zoom level.
|
||||
WID_GO_BASE_GRF_DROPDOWN = ::WID_GO_BASE_GRF_DROPDOWN, ///< Use to select a base GRF.
|
||||
WID_GO_BASE_GRF_STATUS = ::WID_GO_BASE_GRF_STATUS, ///< Info about missing files etc.
|
||||
WID_GO_BASE_GRF_TEXTFILE = ::WID_GO_BASE_GRF_TEXTFILE, ///< Open base GRF readme, changelog (+1) or license (+2).
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: template_news.hpp.sq 23737 2012-01-03 20:37:56Z truebrain $ */
|
||||
/* $Id: template_news.hpp.sq 27164 2015-02-22 17:25:29Z alberth $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -15,6 +15,8 @@ namespace SQConvert {
|
||||
/* Allow enums to be used as Squirrel parameters */
|
||||
template <> inline ScriptNews::NewsType GetParam(ForceType<ScriptNews::NewsType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptNews::NewsType)tmp; }
|
||||
template <> inline int Return<ScriptNews::NewsType>(HSQUIRRELVM vm, ScriptNews::NewsType res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> inline ScriptNews::NewsReferenceType GetParam(ForceType<ScriptNews::NewsReferenceType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptNews::NewsReferenceType)tmp; }
|
||||
template <> inline int Return<ScriptNews::NewsReferenceType>(HSQUIRRELVM vm, ScriptNews::NewsReferenceType res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
|
||||
/* Allow ScriptNews to be used as Squirrel parameter */
|
||||
template <> inline ScriptNews *GetParam(ForceType<ScriptNews *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptNews *)instance; }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: template_stationlist.hpp.sq 23379 2011-11-30 14:11:02Z truebrain $ */
|
||||
/* $Id: template_stationlist.hpp.sq 26893 2014-09-21 16:20:48Z fonsinchen $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -20,6 +20,111 @@ namespace SQConvert {
|
||||
template <> inline int Return<ScriptStationList *>(HSQUIRRELVM vm, ScriptStationList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "StationList", res, NULL, DefSQDestructorCallback<ScriptStationList>, true); return 1; }
|
||||
} // 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; }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: template_window.hpp.sq 25344 2013-06-09 12:48:27Z zuu $ */
|
||||
/* $Id: template_window.hpp.sq 26610 2014-05-24 19:11:20Z alberth $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -161,6 +161,8 @@ namespace SQConvert {
|
||||
template <> inline int Return<ScriptWindow::NewGRFParametersWidgets>(HSQUIRRELVM vm, ScriptWindow::NewGRFParametersWidgets res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> inline ScriptWindow::NewGRFStateWidgets GetParam(ForceType<ScriptWindow::NewGRFStateWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::NewGRFStateWidgets)tmp; }
|
||||
template <> inline int Return<ScriptWindow::NewGRFStateWidgets>(HSQUIRRELVM vm, ScriptWindow::NewGRFStateWidgets res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> inline ScriptWindow::SavePresetWidgets GetParam(ForceType<ScriptWindow::SavePresetWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::SavePresetWidgets)tmp; }
|
||||
template <> inline int Return<ScriptWindow::SavePresetWidgets>(HSQUIRRELVM vm, ScriptWindow::SavePresetWidgets res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> inline ScriptWindow::ScanProgressWidgets GetParam(ForceType<ScriptWindow::ScanProgressWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::ScanProgressWidgets)tmp; }
|
||||
template <> inline int Return<ScriptWindow::ScanProgressWidgets>(HSQUIRRELVM vm, ScriptWindow::ScanProgressWidgets res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> inline ScriptWindow::NewsWidgets GetParam(ForceType<ScriptWindow::NewsWidgets>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptWindow::NewsWidgets)tmp; }
|
||||
|
||||
Reference in New Issue
Block a user