changeset 18804:71d835830d4c draft

(svn r23652) -Fix: don't include/document ScriptText for AIs. It is not usable
author truebrain <truebrain@openttd.org>
date Wed, 21 Dec 2011 15:06:00 +0000
parents 4444cc87af24
children 5f0016276390
files src/ai/ai_instance.cpp src/script/api/ai/ai_text.hpp.sq src/script/api/script_text.hpp src/script/api/squirrel_export.sh
diffstat 4 files changed, 5 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/src/ai/ai_instance.cpp
+++ b/src/ai/ai_instance.cpp
@@ -26,6 +26,9 @@
 #include "ai_info.hpp"
 #include "ai_instance.hpp"
 
+/* Manually include the Text glue. */
+#include "../script/api/template/template_text.hpp.sq"
+
 /* Convert all AI related classes to Squirrel data.
  * Note: this line is a marker in squirrel_export.sh. Do not change! */
 #include "../script/api/ai/ai_accounting.hpp.sq"
@@ -69,7 +72,6 @@
 #include "../script/api/ai/ai_subsidy.hpp.sq"
 #include "../script/api/ai/ai_subsidylist.hpp.sq"
 #include "../script/api/ai/ai_testmode.hpp.sq"
-#include "../script/api/ai/ai_text.hpp.sq"
 #include "../script/api/ai/ai_tile.hpp.sq"
 #include "../script/api/ai/ai_tilelist.hpp.sq"
 #include "../script/api/ai/ai_town.hpp.sq"
@@ -172,7 +174,6 @@
 	SQAISubsidy_Register(this->engine);
 	SQAISubsidyList_Register(this->engine);
 	SQAITestMode_Register(this->engine);
-	SQAIText_Register(this->engine);
 	SQAITile_Register(this->engine);
 	SQAITileList_Register(this->engine);
 	SQAITileList_IndustryAccepting_Register(this->engine);
deleted file mode 100644
--- a/src/script/api/ai/ai_text.hpp.sq
+++ /dev/null
@@ -1,31 +0,0 @@
-/* $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_text.hpp"
-#include "../template/template_text.hpp.sq"
-
-
-template <> const char *GetClassName<ScriptText, ST_AI>() { return "AIText"; }
-
-void SQAIText_Register(Squirrel *engine)
-{
-	DefSQClass<ScriptText, ST_AI> SQAIText("AIText");
-	SQAIText.PreRegister(engine);
-	SQAIText.AddSQAdvancedConstructor(engine);
-
-	SQAIText.DefSQConst(engine, ScriptText::SCRIPT_TEXT_MAX_PARAMETERS, "SCRIPT_TEXT_MAX_PARAMETERS");
-
-	SQAIText.DefSQAdvancedMethod(engine, &ScriptText::_set, "_set");
-	SQAIText.DefSQAdvancedMethod(engine, &ScriptText::SetParam, "SetParam");
-	SQAIText.DefSQAdvancedMethod(engine, &ScriptText::AddParam, "AddParam");
-
-	SQAIText.PostRegister(engine);
-}
--- a/src/script/api/script_text.hpp
+++ b/src/script/api/script_text.hpp
@@ -65,7 +65,7 @@
  *  can directly give those arguments to the ScriptText constructor, like this:
  * \code local text = ScriptText(ScriptText.STR_NEWS, 1); \endcode
  *
- * @api ai game
+ * @api game
  */
 class ScriptText : public Text , public ZeroedMemoryAllocator {
 public:
--- a/src/script/api/squirrel_export.sh
+++ b/src/script/api/squirrel_export.sh
@@ -106,7 +106,7 @@
 
 echo "
 { }
-/.hpp.sq/ { next }
+/.hpp.sq/ { if (match(\$0, \"template\")) print \$0; next }
 /SQ${apiuc}Controller_Register/ { print \$0; next }
 /SQ${apiuc}.*_Register/ { next }