# HG changeset patch
# User truebrain
# Date 1205769508 0
# Node ID 8352ca2a207a6d8f2b4947dc2fa62268ea8d4ac3
# Parent a84fc1be9e3bc46cc38b05ffc1d13f3546cfd18e
(svn r12376) [NoAI] -Remove: from this day on, C++ is removed as supported language to write your NoAI in. The only language to use is Squirrel.
This commit is as preparation of the complete removal of this support.
For reasons why, please check http://wiki.openttd.org/index.php/AI:Why_No_C%2B%2B
diff -r a84fc1be9e3b -r 8352ca2a207a projects/openttd_vs80.vcproj
--- a/projects/openttd_vs80.vcproj Mon Mar 03 16:15:24 2008 +0000
+++ b/projects/openttd_vs80.vcproj Mon Mar 17 15:58:28 2008 +0000
@@ -1913,18 +1913,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
GetTick() == 1) {
- if (!this->company.SetCompanyName("NoAI")) {
- char name[32];
- snprintf(name, lengthof(name), "NoAI %d", this->base.Rand());
- this->company.SetCompanyName(name);
- }
- printf("Map size: %d by %d, %d tiles\n", this->map.GetMapSizeX(),
- this->map.GetMapSizeY(), this->map.GetMapSize());
- }
-
- if (this->GetTick() < 10) {
- char *cargo_label = this->cargo.GetCargoLabel(this->GetTick());
- printf("%s is %sfreight and the income is %d per 20 tiles in 10 days\n",
- cargo_label, this->cargo.IsFreight(this->GetTick()) ? "" : "not ",
- this->cargo.GetCargoIncome(20, 10, this->GetTick()));
- free(cargo_label);
- }
-
- if (this->GetTick() < this->industry.GetMaxIndustryID()) {
- if (this->industry.IsValidIndustry(this->GetTick())) {
- char *industry_name = this->industry.GetName(this->GetTick());
- TileIndex t = this->industry.GetLocation(this->GetTick());
-
- printf("Industry %s [%d of %d] at (%d, %d)\n",
- industry_name, this->GetTick(), this->industry.GetIndustryCount(),
- this->map.GetTileX(t), this->map.GetTileY(t));
- }
- }
-
- if (this->GetTick() % 10 == 0) {
- char *company_name = this->company.GetCompanyName(AICompany::MY_COMPANY);
- printf("%s has loaned %d\n", company_name, this->company.GetLoanAmount());
- free(company_name);
- }
-
- if (this->GetTick() % 14 == 0) {
- uint level = (this->company.GetMaxLoanAmount() / this->company.GetLoanInterval()) + 1;
- this->company.SetLoanAmount(this->base.RandRange(level) * this->company.GetLoanInterval());
- }
-
- if (this->GetTick() % 13 == 0) {
- TownID town_id = this->base.RandRange(this->town.GetMaxTownID());
- if (this->town.IsValidTown(town_id)) {
- char *town_name = this->town.GetName(town_id);
- TileIndex t = this->town.GetLocation(town_id);
-
- printf("Town %s [%d of %d] at (%d, %d) with %d inhabitants\n",
- town_name, town_id, this->town.GetTownCount(),
- this->map.GetTileX(t), this->map.GetTileY(t),
- this->town.GetPopulation(town_id));
- }
- }
-}
-
-/* virtual */ void NoAI::Start()
-{
- this->stop = false;
- while (!stop) {
- this->Sleep(1);
- this->GameLoop();
- }
-}
-
-/* virtual */ void NoAI::Stop()
-{
- this->stop = true;
-}
diff -r a84fc1be9e3b -r 8352ca2a207a src/ai/NoAI/NoAI.hpp
--- a/src/ai/NoAI/NoAI.hpp Mon Mar 03 16:15:24 2008 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/* $Id$ */
-
-/** @file NoAI.hpp declarations of the class for a simple C++ AI that will never be an AI */
-
-#ifndef NOAI_HPP
-#define NOAI_HPP
-
-#include "../ai_factory.hpp"
-#include "../api/ai_controller.hpp"
-#include "../api/ai_base.hpp"
-#include "../api/ai_cargo.hpp"
-#include "../api/ai_company.hpp"
-#include "../api/ai_industry.hpp"
-#include "../api/ai_map.hpp"
-#include "../api/ai_town.hpp"
-
-class NoAI: public AIController {
-private:
- AIBase base;
- AICargo cargo;
- AICompany company;
- AIIndustry industry;
- AIMap map;
- AITown town;
- bool stop;
-
-public:
- /* virtual */ void Start();
- /* virtual */ void Stop();
- void GameLoop();
-};
-
-class FNoAI: public AIFactory {
-public:
- /* virtual */ const char *GetAuthor() { return "OpenTTD Dev Team"; }
- /* virtual */ const char *GetName() { return "NoAI"; }
- /* virtual */ const char *GetDescription() { return "Rather simple AI that tests all the functions of the AI layer."; }
- /* virtual */ int GetVersion() { return 1; }
- /* virtual */ const char *GetDate() { return "2007-03-14"; }
- /* virtual */ AIController *CreateInstance() { return new NoAI(); }
-};
-
-#endif /* NOAI_HPP */