summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/game_instance.cpp5
-rw-r--r--src/script/api/ai/ai_company.hpp.sq19
-rw-r--r--src/script/api/game/game_client.hpp.sq34
-rw-r--r--src/script/api/game/game_clientlist.hpp.sq37
-rw-r--r--src/script/api/game/game_company.hpp.sq1
-rw-r--r--src/script/api/game_changelog.hpp6
-rw-r--r--src/script/api/script_client.cpp74
-rw-r--r--src/script/api/script_client.hpp70
-rw-r--r--src/script/api/script_clientlist.cpp49
-rw-r--r--src/script/api/script_clientlist.hpp42
-rw-r--r--src/script/api/script_company.hpp9
-rw-r--r--src/script/api/template/template_client.hpp.sq25
-rw-r--r--src/script/api/template/template_clientlist.hpp.sq30
13 files changed, 387 insertions, 14 deletions
diff --git a/src/game/game_instance.cpp b/src/game/game_instance.cpp
index c5e5c7f05..e2b377511 100644
--- a/src/game/game_instance.cpp
+++ b/src/game/game_instance.cpp
@@ -34,6 +34,8 @@
#include "../script/api/game/game_cargo.hpp.sq"
#include "../script/api/game/game_cargolist.hpp.sq"
#include "../script/api/game/game_cargomonitor.hpp.sq"
+#include "../script/api/game/game_client.hpp.sq"
+#include "../script/api/game/game_clientlist.hpp.sq"
#include "../script/api/game/game_company.hpp.sq"
#include "../script/api/game/game_companymode.hpp.sq"
#include "../script/api/game/game_controller.hpp.sq"
@@ -122,6 +124,9 @@ void GameInstance::RegisterAPI()
SQGSCargoList_IndustryProducing_Register(this->engine);
SQGSCargoList_StationAccepting_Register(this->engine);
SQGSCargoMonitor_Register(this->engine);
+ SQGSClient_Register(this->engine);
+ SQGSClientList_Register(this->engine);
+ SQGSClientList_Company_Register(this->engine);
SQGSCompany_Register(this->engine);
SQGSCompanyMode_Register(this->engine);
SQGSDate_Register(this->engine);
diff --git a/src/script/api/ai/ai_company.hpp.sq b/src/script/api/ai/ai_company.hpp.sq
index 76cc18e3a..7ed55d97b 100644
--- a/src/script/api/ai/ai_company.hpp.sq
+++ b/src/script/api/ai/ai_company.hpp.sq
@@ -21,15 +21,16 @@ void SQAICompany_Register(Squirrel *engine)
SQAICompany.PreRegister(engine);
SQAICompany.AddConstructor<void (ScriptCompany::*)(), 1>(engine, "x");
- SQAICompany.DefSQConst(engine, ScriptCompany::CURRENT_QUARTER, "CURRENT_QUARTER");
- SQAICompany.DefSQConst(engine, ScriptCompany::EARLIEST_QUARTER, "EARLIEST_QUARTER");
- SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_FIRST, "COMPANY_FIRST");
- SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_LAST, "COMPANY_LAST");
- SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_INVALID, "COMPANY_INVALID");
- SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_SELF, "COMPANY_SELF");
- SQAICompany.DefSQConst(engine, ScriptCompany::GENDER_MALE, "GENDER_MALE");
- SQAICompany.DefSQConst(engine, ScriptCompany::GENDER_FEMALE, "GENDER_FEMALE");
- SQAICompany.DefSQConst(engine, ScriptCompany::GENDER_INVALID, "GENDER_INVALID");
+ SQAICompany.DefSQConst(engine, ScriptCompany::CURRENT_QUARTER, "CURRENT_QUARTER");
+ SQAICompany.DefSQConst(engine, ScriptCompany::EARLIEST_QUARTER, "EARLIEST_QUARTER");
+ SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_FIRST, "COMPANY_FIRST");
+ SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_LAST, "COMPANY_LAST");
+ SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_INVALID, "COMPANY_INVALID");
+ SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_SELF, "COMPANY_SELF");
+ SQAICompany.DefSQConst(engine, ScriptCompany::COMPANY_SPECTATOR, "COMPANY_SPECTATOR");
+ SQAICompany.DefSQConst(engine, ScriptCompany::GENDER_MALE, "GENDER_MALE");
+ SQAICompany.DefSQConst(engine, ScriptCompany::GENDER_FEMALE, "GENDER_FEMALE");
+ SQAICompany.DefSQConst(engine, ScriptCompany::GENDER_INVALID, "GENDER_INVALID");
SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::ResolveCompanyID, "ResolveCompanyID", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &ScriptCompany::IsMine, "IsMine", 2, ".i");
diff --git a/src/script/api/game/game_client.hpp.sq b/src/script/api/game/game_client.hpp.sq
new file mode 100644
index 000000000..b4230a6d0
--- /dev/null
+++ b/src/script/api/game/game_client.hpp.sq
@@ -0,0 +1,34 @@
+/* $Id$ */
+
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */
+
+#include "../script_client.hpp"
+#include "../template/template_client.hpp.sq"
+
+
+template <> const char *GetClassName<ScriptClient, ST_GS>() { return "GSClient"; }
+
+void SQGSClient_Register(Squirrel *engine)
+{
+ DefSQClass<ScriptClient, ST_GS> SQGSClient("GSClient");
+ SQGSClient.PreRegister(engine);
+ SQGSClient.AddConstructor<void (ScriptClient::*)(), 1>(engine, "x");
+
+ SQGSClient.DefSQConst(engine, ScriptClient::CLIENT_INVALID, "CLIENT_INVALID");
+ SQGSClient.DefSQConst(engine, ScriptClient::CLIENT_SERVER, "CLIENT_SERVER");
+ SQGSClient.DefSQConst(engine, ScriptClient::CLIENT_FIRST, "CLIENT_FIRST");
+
+ SQGSClient.DefSQStaticMethod(engine, &ScriptClient::ResolveClientID, "ResolveClientID", 2, ".i");
+ SQGSClient.DefSQStaticMethod(engine, &ScriptClient::GetName, "GetName", 2, ".i");
+ SQGSClient.DefSQStaticMethod(engine, &ScriptClient::GetCompany, "GetCompany", 2, ".i");
+ SQGSClient.DefSQStaticMethod(engine, &ScriptClient::GetJoinDate, "GetJoinDate", 2, ".i");
+
+ SQGSClient.PostRegister(engine);
+}
diff --git a/src/script/api/game/game_clientlist.hpp.sq b/src/script/api/game/game_clientlist.hpp.sq
new file mode 100644
index 000000000..ef0258647
--- /dev/null
+++ b/src/script/api/game/game_clientlist.hpp.sq
@@ -0,0 +1,37 @@
+/* $Id$ */
+
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */
+
+#include "../script_clientlist.hpp"
+#include "../template/template_clientlist.hpp.sq"
+
+
+template <> const char *GetClassName<ScriptClientList, ST_GS>() { return "GSClientList"; }
+
+void SQGSClientList_Register(Squirrel *engine)
+{
+ DefSQClass<ScriptClientList, ST_GS> SQGSClientList("GSClientList");
+ SQGSClientList.PreRegister(engine, "GSList");
+ SQGSClientList.AddConstructor<void (ScriptClientList::*)(), 1>(engine, "x");
+
+ SQGSClientList.PostRegister(engine);
+}
+
+
+template <> const char *GetClassName<ScriptClientList_Company, ST_GS>() { return "GSClientList_Company"; }
+
+void SQGSClientList_Company_Register(Squirrel *engine)
+{
+ DefSQClass<ScriptClientList_Company, ST_GS> SQGSClientList_Company("GSClientList_Company");
+ SQGSClientList_Company.PreRegister(engine, "GSList");
+ SQGSClientList_Company.AddConstructor<void (ScriptClientList_Company::*)(ScriptCompany::CompanyID company), 2>(engine, "xi");
+
+ SQGSClientList_Company.PostRegister(engine);
+}
diff --git a/src/script/api/game/game_company.hpp.sq b/src/script/api/game/game_company.hpp.sq
index 56917a5b2..29476fc8a 100644
--- a/src/script/api/game/game_company.hpp.sq
+++ b/src/script/api/game/game_company.hpp.sq
@@ -27,6 +27,7 @@ void SQGSCompany_Register(Squirrel *engine)
SQGSCompany.DefSQConst(engine, ScriptCompany::COMPANY_LAST, "COMPANY_LAST");
SQGSCompany.DefSQConst(engine, ScriptCompany::COMPANY_INVALID, "COMPANY_INVALID");
SQGSCompany.DefSQConst(engine, ScriptCompany::COMPANY_SELF, "COMPANY_SELF");
+ SQGSCompany.DefSQConst(engine, ScriptCompany::COMPANY_SPECTATOR, "COMPANY_SPECTATOR");
SQGSCompany.DefSQConst(engine, ScriptCompany::GENDER_MALE, "GENDER_MALE");
SQGSCompany.DefSQConst(engine, ScriptCompany::GENDER_FEMALE, "GENDER_FEMALE");
SQGSCompany.DefSQConst(engine, ScriptCompany::GENDER_INVALID, "GENDER_INVALID");
diff --git a/src/script/api/game_changelog.hpp b/src/script/api/game_changelog.hpp
index d6d62057a..776dd892e 100644
--- a/src/script/api/game_changelog.hpp
+++ b/src/script/api/game_changelog.hpp
@@ -18,10 +18,14 @@
* \b 1.9.0
*
* 1.9.0 is not yet released. The following changes are not set in stone yet.
+ * API additions:
+ * \li GSClient
+ * \li GSClientList
+ * \li GSClientList_Company
*
* \b 1.8.0
*
- * 1.8.0 is not yet released. The following changes are not set in stone yet.
+ * No changes
*
* \b 1.7.0 - 1.7.2
*
diff --git a/src/script/api/script_client.cpp b/src/script/api/script_client.cpp
new file mode 100644
index 000000000..771a0ae4e
--- /dev/null
+++ b/src/script/api/script_client.cpp
@@ -0,0 +1,74 @@
+/* $Id$ */
+
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file script_client.cpp Implementation of ScriptClient. */
+
+#include "../../stdafx.h"
+#include "script_client.hpp"
+#include "../../network/network.h"
+#include "../../network/network_base.h"
+
+#include "../../safeguards.h"
+
+#ifdef ENABLE_NETWORK
+/**
+ * Finds NetworkClientInfo given client-identifier,
+ * is used by other methods to resolve client-identifier.
+ * @param client The client to get info structure for
+ * @return A pointer to corresponding CI struct or NULL when not found.
+ */
+static NetworkClientInfo *FindClientInfo(ScriptClient::ClientID client)
+{
+ if (client == ScriptClient::CLIENT_INVALID) return NULL;
+ if (!_networking) return NULL;
+ return NetworkClientInfo::GetByClientID((::ClientID)client);
+}
+#endif
+
+/* static */ ScriptClient::ClientID ScriptClient::ResolveClientID(ScriptClient::ClientID client)
+{
+#ifdef ENABLE_NETWORK
+ return (FindClientInfo(client) == NULL ? ScriptClient::CLIENT_INVALID : client);
+#else
+ return CLIENT_INVALID;
+#endif
+}
+
+/* static */ char *ScriptClient::GetName(ScriptClient::ClientID client)
+{
+#ifdef ENABLE_NETWORK
+ NetworkClientInfo *ci = FindClientInfo(client);
+ if (ci == NULL) return NULL;
+ return stredup(ci->client_name);
+#else
+ return NULL;
+#endif
+}
+
+/* static */ ScriptCompany::CompanyID ScriptClient::GetCompany(ScriptClient::ClientID client)
+{
+#ifdef ENABLE_NETWORK
+ NetworkClientInfo *ci = FindClientInfo(client);
+ if (ci == NULL) return ScriptCompany::COMPANY_INVALID;
+ return (ScriptCompany::CompanyID)ci->client_playas;
+#else
+ return ScriptCompany::COMPANY_INVALID;
+#endif
+}
+
+/* static */ ScriptDate::Date ScriptClient::GetJoinDate(ScriptClient::ClientID client)
+{
+#ifdef ENABLE_NETWORK
+ NetworkClientInfo *ci = FindClientInfo(client);
+ if (ci == NULL) return ScriptDate::DATE_INVALID;
+ return (ScriptDate::Date)ci->join_date;
+#else
+ return ScriptDate::DATE_INVALID;
+#endif
+}
diff --git a/src/script/api/script_client.hpp b/src/script/api/script_client.hpp
new file mode 100644
index 000000000..423f134c0
--- /dev/null
+++ b/src/script/api/script_client.hpp
@@ -0,0 +1,70 @@
+/* $Id$ */
+
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file script_client.hpp Everything to query a network client's information */
+
+#ifndef SCRIPT_CLIENT_HPP
+#define SCRIPT_CLIENT_HPP
+
+#include "script_text.hpp"
+#include "script_date.hpp"
+#include "script_company.hpp"
+#include "../../network/network_type.h"
+
+/**
+ * Class that handles all client related functions.
+ *
+ * @api game
+ */
+class ScriptClient : public ScriptObject {
+public:
+
+ /** Different constants related to ClientID. */
+ enum ClientID {
+ CLIENT_INVALID = 0, ///< Client is not part of anything
+ CLIENT_SERVER = 1, ///< Servers always have this ID
+ CLIENT_FIRST = 2, ///< The first client ID
+ };
+
+ /**
+ * Resolves the given client id to the correct index for the client.
+ * If the client with the given id does not exist it will
+ * return CLIENT_INVALID.
+ * @param client The client id to resolve.
+ * @return The resolved client id.
+ */
+ static ClientID ResolveClientID(ClientID client);
+
+ /**
+ * Get the name of the given client.
+ * @param client The client to get the name for.
+ * @pre ResolveClientID(client) != CLIENT_INVALID.
+ * @return The name of the given client.
+ */
+ static char *GetName(ClientID client);
+
+ /**
+ * Get the company in which the given client is playing.
+ * @param client The client to get company for.
+ * @pre ResolveClientID(client) != CLIENT_INVALID.
+ * @return The company in which client is playing or COMPANY_SPECTATOR.
+ */
+ static ScriptCompany::CompanyID GetCompany(ClientID client);
+
+ /**
+ * Get the game date when the given client has joined.
+ * @param client The client to get joining date for.
+ * @pre ResolveClientID(client) != CLIENT_INVALID.
+ * @return The date when client has joined.
+ */
+ static ScriptDate::Date GetJoinDate(ClientID client);
+};
+
+
+#endif /* SCRIPT_CLIENT_HPP */
diff --git a/src/script/api/script_clientlist.cpp b/src/script/api/script_clientlist.cpp
new file mode 100644
index 000000000..2f7a19a9f
--- /dev/null
+++ b/src/script/api/script_clientlist.cpp
@@ -0,0 +1,49 @@
+/* $Id$ */
+
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file script_clientlist.cpp Implementation of ScriptClientList and friends. */
+
+#include "../../stdafx.h"
+#include "script_company.hpp"
+#include "script_clientlist.hpp"
+#include "../../network/network.h"
+#include "../../network/network_base.h"
+
+#include "../../safeguards.h"
+
+ScriptClientList::ScriptClientList()
+{
+#ifdef ENABLE_NETWORK
+ if (!_networking) return;
+ NetworkClientInfo *ci;
+ FOR_ALL_CLIENT_INFOS(ci) {
+ this->AddItem(ci->client_id);
+ }
+#endif
+}
+
+ScriptClientList_Company::ScriptClientList_Company(ScriptCompany::CompanyID company)
+{
+#ifdef ENABLE_NETWORK
+ if (!_networking) return;
+ CompanyID c;
+ if (company == ScriptCompany::COMPANY_SPECTATOR) {
+ c = ::COMPANY_SPECTATOR;
+ } else {
+ company = ScriptCompany::ResolveCompanyID(company);
+ if (company == ScriptCompany::COMPANY_INVALID) return;
+ c = (CompanyID)company;
+ }
+
+ NetworkClientInfo *ci;
+ FOR_ALL_CLIENT_INFOS(ci) {
+ if (ci->client_playas == c) this->AddItem(ci->client_id);
+ }
+#endif
+}
diff --git a/src/script/api/script_clientlist.hpp b/src/script/api/script_clientlist.hpp
new file mode 100644
index 000000000..58d0177b2
--- /dev/null
+++ b/src/script/api/script_clientlist.hpp
@@ -0,0 +1,42 @@
+/* $Id$ */
+
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file script_clientlist.hpp List all the TODO. */
+
+#ifndef SCRIPT_CLIENTLIST_HPP
+#define SCRIPT_CLIENTLIST_HPP
+
+#include "script_list.hpp"
+#include "script_company.hpp"
+
+
+/**
+ * Creates a list of clients that are currently in game.
+ * @api game
+ * @ingroup ScriptList
+ */
+class ScriptClientList : public ScriptList {
+public:
+ ScriptClientList();
+};
+
+/**
+ * Creates a list of clients that are playing in the company.
+ * @api game
+ * @ingroup ScriptList
+ */
+class ScriptClientList_Company : public ScriptList {
+public:
+ /**
+ * @param company_id The company to list clients for.
+ */
+ ScriptClientList_Company(ScriptCompany::CompanyID company);
+};
+
+#endif /* SCRIPT_CIENTLIST_HPP */
diff --git a/src/script/api/script_company.hpp b/src/script/api/script_company.hpp
index 4deaeed5e..4bfe0d02e 100644
--- a/src/script/api/script_company.hpp
+++ b/src/script/api/script_company.hpp
@@ -30,12 +30,13 @@ public:
/** Different constants related to CompanyID. */
enum CompanyID {
/* Note: these values represent part of the in-game Owner enum */
- COMPANY_FIRST = ::COMPANY_FIRST, ///< The first available company.
- COMPANY_LAST = ::MAX_COMPANIES, ///< The last available company.
+ COMPANY_FIRST = ::COMPANY_FIRST, ///< The first available company.
+ COMPANY_LAST = ::MAX_COMPANIES, ///< The last available company.
/* Custom added value, only valid for this API */
- COMPANY_INVALID = -1, ///< An invalid company.
- COMPANY_SELF = 254, ///< Constant that gets resolved to the correct company index for your company.
+ COMPANY_INVALID = -1, ///< An invalid company.
+ COMPANY_SELF = 254, ///< Constant that gets resolved to the correct company index for your company.
+ COMPANY_SPECTATOR = 255, ///< Constant indicating that player is spectating (gets resolved to COMPANY_INVALID)
};
/** Possible genders for company presidents. */
diff --git a/src/script/api/template/template_client.hpp.sq b/src/script/api/template/template_client.hpp.sq
new file mode 100644
index 000000000..13b9d68b6
--- /dev/null
+++ b/src/script/api/template/template_client.hpp.sq
@@ -0,0 +1,25 @@
+/* $Id$ */
+
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */
+
+#include "../script_client.hpp"
+
+namespace SQConvert {
+ /* Allow enums to be used as Squirrel parameters */
+ template <> inline ScriptClient::ClientID GetParam(ForceType<ScriptClient::ClientID>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (ScriptClient::ClientID)tmp; }
+ template <> inline int Return<ScriptClient::ClientID>(HSQUIRRELVM vm, ScriptClient::ClientID res) { sq_pushinteger(vm, (int32)res); return 1; }
+
+ /* Allow ScriptClient to be used as Squirrel parameter */
+ template <> inline ScriptClient *GetParam(ForceType<ScriptClient *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptClient *)instance; }
+ template <> inline ScriptClient &GetParam(ForceType<ScriptClient &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptClient *)instance; }
+ template <> inline const ScriptClient *GetParam(ForceType<const ScriptClient *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptClient *)instance; }
+ template <> inline const ScriptClient &GetParam(ForceType<const ScriptClient &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptClient *)instance; }
+ template <> inline int Return<ScriptClient *>(HSQUIRRELVM vm, ScriptClient *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "Client", res, NULL, DefSQDestructorCallback<ScriptClient>, true); return 1; }
+} // namespace SQConvert
diff --git a/src/script/api/template/template_clientlist.hpp.sq b/src/script/api/template/template_clientlist.hpp.sq
new file mode 100644
index 000000000..74c3f4525
--- /dev/null
+++ b/src/script/api/template/template_clientlist.hpp.sq
@@ -0,0 +1,30 @@
+/* $Id$ */
+
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */
+
+#include "../script_clientlist.hpp"
+
+namespace SQConvert {
+ /* Allow ScriptClientList to be used as Squirrel parameter */
+ template <> inline ScriptClientList *GetParam(ForceType<ScriptClientList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptClientList *)instance; }
+ template <> inline ScriptClientList &GetParam(ForceType<ScriptClientList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptClientList *)instance; }
+ template <> inline const ScriptClientList *GetParam(ForceType<const ScriptClientList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptClientList *)instance; }
+ template <> inline const ScriptClientList &GetParam(ForceType<const ScriptClientList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptClientList *)instance; }
+ template <> inline int Return<ScriptClientList *>(HSQUIRRELVM vm, ScriptClientList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "ClientList", res, NULL, DefSQDestructorCallback<ScriptClientList>, true); return 1; }
+} // namespace SQConvert
+
+namespace SQConvert {
+ /* Allow ScriptClientList_Company to be used as Squirrel parameter */
+ template <> inline ScriptClientList_Company *GetParam(ForceType<ScriptClientList_Company *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptClientList_Company *)instance; }
+ template <> inline ScriptClientList_Company &GetParam(ForceType<ScriptClientList_Company &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptClientList_Company *)instance; }
+ template <> inline const ScriptClientList_Company *GetParam(ForceType<const ScriptClientList_Company *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (ScriptClientList_Company *)instance; }
+ template <> inline const ScriptClientList_Company &GetParam(ForceType<const ScriptClientList_Company &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(ScriptClientList_Company *)instance; }
+ template <> inline int Return<ScriptClientList_Company *>(HSQUIRRELVM vm, ScriptClientList_Company *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "ClientList_Company", res, NULL, DefSQDestructorCallback<ScriptClientList_Company>, true); return 1; }
+} // namespace SQConvert