summaryrefslogtreecommitdiff
path: root/src/script/api/script_industrytype.cpp
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-11-29 23:15:35 +0000
committertruebrain <truebrain@openttd.org>2011-11-29 23:15:35 +0000
commit98103121d4f2ed1f1581919b7b1f343ccd410c12 (patch)
tree1e760dd6517a6b0f9fb669ec277139a8e3f9a4a3 /src/script/api/script_industrytype.cpp
parentafdb67a3534f85b4efbd3327ece8137211042d7b (diff)
downloadopenttd-98103121d4f2ed1f1581919b7b1f343ccd410c12.tar.xz
(svn r23355) -Codechange: rename all AI* to Script* (Rubidium)
Diffstat (limited to 'src/script/api/script_industrytype.cpp')
-rw-r--r--src/script/api/script_industrytype.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/script/api/script_industrytype.cpp b/src/script/api/script_industrytype.cpp
index 0a369b8f1..f61bedd3f 100644
--- a/src/script/api/script_industrytype.cpp
+++ b/src/script/api/script_industrytype.cpp
@@ -7,7 +7,7 @@
* 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_industrytype.cpp Implementation of AIIndustryType. */
+/** @file script_industrytype.cpp Implementation of ScriptIndustryType. */
#include "../../stdafx.h"
#include "script_industrytype.hpp"
@@ -18,21 +18,21 @@
#include "../../newgrf_industries.h"
#include "../../core/random_func.hpp"
-/* static */ bool AIIndustryType::IsValidIndustryType(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::IsValidIndustryType(IndustryType industry_type)
{
if (industry_type >= NUM_INDUSTRYTYPES) return false;
return ::GetIndustrySpec(industry_type)->enabled;
}
-/* static */ bool AIIndustryType::IsRawIndustry(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::IsRawIndustry(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return false;
return ::GetIndustrySpec(industry_type)->IsRawIndustry();
}
-/* static */ bool AIIndustryType::ProductionCanIncrease(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::ProductionCanIncrease(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return false;
@@ -40,7 +40,7 @@
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_DONT_INCR_PROD) == 0;
}
-/* static */ Money AIIndustryType::GetConstructionCost(IndustryType industry_type)
+/* static */ Money ScriptIndustryType::GetConstructionCost(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return -1;
if (::GetIndustrySpec(industry_type)->IsRawIndustry() && _settings_game.construction.raw_industry_construction == 0) return -1;
@@ -48,7 +48,7 @@
return ::GetIndustrySpec(industry_type)->GetConstructionCost();
}
-/* static */ char *AIIndustryType::GetName(IndustryType industry_type)
+/* static */ char *ScriptIndustryType::GetName(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return NULL;
static const int len = 64;
@@ -59,13 +59,13 @@
return industrytype_name;
}
-/* static */ AIList *AIIndustryType::GetProducedCargo(IndustryType industry_type)
+/* static */ ScriptList *ScriptIndustryType::GetProducedCargo(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return NULL;
const IndustrySpec *ins = ::GetIndustrySpec(industry_type);
- AIList *list = new AIList();
+ ScriptList *list = new ScriptList();
for (size_t i = 0; i < lengthof(ins->produced_cargo); i++) {
if (ins->produced_cargo[i] != CT_INVALID) list->AddItem(ins->produced_cargo[i]);
}
@@ -73,13 +73,13 @@
return list;
}
-/* static */ AIList *AIIndustryType::GetAcceptedCargo(IndustryType industry_type)
+/* static */ ScriptList *ScriptIndustryType::GetAcceptedCargo(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return NULL;
const IndustrySpec *ins = ::GetIndustrySpec(industry_type);
- AIList *list = new AIList();
+ ScriptList *list = new ScriptList();
for (size_t i = 0; i < lengthof(ins->accepts_cargo); i++) {
if (ins->accepts_cargo[i] != CT_INVALID) list->AddItem(ins->accepts_cargo[i]);
}
@@ -87,7 +87,7 @@
return list;
}
-/* static */ bool AIIndustryType::CanBuildIndustry(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::CanBuildIndustry(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return false;
@@ -98,7 +98,7 @@
return _settings_game.construction.raw_industry_construction == 1;
}
-/* static */ bool AIIndustryType::CanProspectIndustry(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::CanProspectIndustry(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return false;
@@ -109,38 +109,38 @@
return _settings_game.construction.raw_industry_construction == 2;
}
-/* static */ bool AIIndustryType::BuildIndustry(IndustryType industry_type, TileIndex tile)
+/* static */ bool ScriptIndustryType::BuildIndustry(IndustryType industry_type, TileIndex tile)
{
EnforcePrecondition(false, CanBuildIndustry(industry_type));
- EnforcePrecondition(false, AIMap::IsValidTile(tile));
+ EnforcePrecondition(false, ScriptMap::IsValidTile(tile));
uint32 seed = ::InteractiveRandom();
- return AIObject::DoCommand(tile, (::InteractiveRandomRange(::GetIndustrySpec(industry_type)->num_table) << 8) | industry_type, seed, CMD_BUILD_INDUSTRY);
+ return ScriptObject::DoCommand(tile, (::InteractiveRandomRange(::GetIndustrySpec(industry_type)->num_table) << 8) | industry_type, seed, CMD_BUILD_INDUSTRY);
}
-/* static */ bool AIIndustryType::ProspectIndustry(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::ProspectIndustry(IndustryType industry_type)
{
EnforcePrecondition(false, CanProspectIndustry(industry_type));
uint32 seed = ::InteractiveRandom();
- return AIObject::DoCommand(0, industry_type, seed, CMD_BUILD_INDUSTRY);
+ return ScriptObject::DoCommand(0, industry_type, seed, CMD_BUILD_INDUSTRY);
}
-/* static */ bool AIIndustryType::IsBuiltOnWater(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::IsBuiltOnWater(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return false;
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0;
}
-/* static */ bool AIIndustryType::HasHeliport(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::HasHeliport(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return false;
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
}
-/* static */ bool AIIndustryType::HasDock(IndustryType industry_type)
+/* static */ bool ScriptIndustryType::HasDock(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return false;