summaryrefslogtreecommitdiff
path: root/src/ai/api
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2009-01-17 15:31:30 +0000
committertruebrain <truebrain@openttd.org>2009-01-17 15:31:30 +0000
commit3abb8abd07e56b4b051d57cd6e6f1c56ab8bdb64 (patch)
tree14e7ce689d02dc05c06feede936f8d1c1bdb8c02 /src/ai/api
parent7e8d9a3e667385113636cfc09d7cab4887591cf7 (diff)
downloadopenttd-3abb8abd07e56b4b051d57cd6e6f1c56ab8bdb64.tar.xz
(svn r15123) -Fix [NoAI]: 'const char *' implies that the return value should not be free'd, which is should .. so make them 'char *'
Diffstat (limited to 'src/ai/api')
-rw-r--r--src/ai/api/ai_bridge.cpp2
-rw-r--r--src/ai/api/ai_bridge.hpp2
-rw-r--r--src/ai/api/ai_cargo.cpp2
-rw-r--r--src/ai/api/ai_cargo.hpp2
-rw-r--r--src/ai/api/ai_company.cpp6
-rw-r--r--src/ai/api/ai_company.hpp6
-rw-r--r--src/ai/api/ai_engine.cpp2
-rw-r--r--src/ai/api/ai_engine.hpp2
-rw-r--r--src/ai/api/ai_error.cpp4
-rw-r--r--src/ai/api/ai_error.hpp2
-rw-r--r--src/ai/api/ai_event_types.cpp2
-rw-r--r--src/ai/api/ai_event_types.hpp2
-rw-r--r--src/ai/api/ai_group.cpp2
-rw-r--r--src/ai/api/ai_group.hpp2
-rw-r--r--src/ai/api/ai_industry.cpp2
-rw-r--r--src/ai/api/ai_industry.hpp2
-rw-r--r--src/ai/api/ai_industrytype.cpp2
-rw-r--r--src/ai/api/ai_industrytype.hpp2
-rw-r--r--src/ai/api/ai_sign.cpp2
-rw-r--r--src/ai/api/ai_sign.hpp2
-rw-r--r--src/ai/api/ai_station.cpp2
-rw-r--r--src/ai/api/ai_station.hpp2
-rw-r--r--src/ai/api/ai_town.cpp2
-rw-r--r--src/ai/api/ai_town.hpp2
-rw-r--r--src/ai/api/ai_vehicle.cpp2
-rw-r--r--src/ai/api/ai_vehicle.hpp2
26 files changed, 31 insertions, 31 deletions
diff --git a/src/ai/api/ai_bridge.cpp b/src/ai/api/ai_bridge.cpp
index 56fe7061b..e67794e2a 100644
--- a/src/ai/api/ai_bridge.cpp
+++ b/src/ai/api/ai_bridge.cpp
@@ -120,7 +120,7 @@ static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
}
-/* static */ const char *AIBridge::GetName(BridgeID bridge_id)
+/* static */ char *AIBridge::GetName(BridgeID bridge_id)
{
if (!IsValidBridge(bridge_id)) return NULL;
diff --git a/src/ai/api/ai_bridge.hpp b/src/ai/api/ai_bridge.hpp
index 7bd637277..819242e79 100644
--- a/src/ai/api/ai_bridge.hpp
+++ b/src/ai/api/ai_bridge.hpp
@@ -57,7 +57,7 @@ public:
* @pre IsValidBridge(bridge_id).
* @return The name the bridge has.
*/
- static const char *GetName(BridgeID bridge_id);
+ static char *GetName(BridgeID bridge_id);
/**
* Get the maximum speed of a bridge (in km/h).
diff --git a/src/ai/api/ai_cargo.cpp b/src/ai/api/ai_cargo.cpp
index 6843f7134..dccf2af6e 100644
--- a/src/ai/api/ai_cargo.cpp
+++ b/src/ai/api/ai_cargo.cpp
@@ -15,7 +15,7 @@
return (cargo_type < NUM_CARGO && ::GetCargo(cargo_type)->IsValid());
}
-/* static */ const char *AICargo::GetCargoLabel(CargoID cargo_type)
+/* static */ char *AICargo::GetCargoLabel(CargoID cargo_type)
{
if (!IsValidCargo(cargo_type)) return NULL;
const CargoSpec *cargo = ::GetCargo(cargo_type);
diff --git a/src/ai/api/ai_cargo.hpp b/src/ai/api/ai_cargo.hpp
index bde235758..c8f8a04dd 100644
--- a/src/ai/api/ai_cargo.hpp
+++ b/src/ai/api/ai_cargo.hpp
@@ -56,7 +56,7 @@ public:
* @note Never use this to check if it is a certain cargo. NewGRF can
* redefine all of the names.
*/
- static const char *GetCargoLabel(CargoID cargo_type);
+ static char *GetCargoLabel(CargoID cargo_type);
/**
* Checks whether the give cargo is a freight or not.
diff --git a/src/ai/api/ai_company.cpp b/src/ai/api/ai_company.cpp
index 4040ab9c1..439215a7e 100644
--- a/src/ai/api/ai_company.cpp
+++ b/src/ai/api/ai_company.cpp
@@ -43,13 +43,13 @@
return AIObject::DoCommand(0, 0, 0, CMD_RENAME_COMPANY, name);
}
-/* static */ const char *AICompany::GetCompanyName(AICompany::CompanyID company)
+/* static */ char *AICompany::GetCompanyName(AICompany::CompanyID company)
{
AILog::Error("AICompany::GetCompanyName is obsolete. Use AICompany::GetName instead.");
return AICompany::GetName(company);
}
-/* static */ const char *AICompany::GetName(AICompany::CompanyID company)
+/* static */ char *AICompany::GetName(AICompany::CompanyID company)
{
company = ResolveCompanyID(company);
if (company == COMPANY_INVALID) return NULL;
@@ -69,7 +69,7 @@
return AIObject::DoCommand(0, 0, 0, CMD_RENAME_PRESIDENT, name);
}
-/* static */ const char *AICompany::GetPresidentName(AICompany::CompanyID company)
+/* static */ char *AICompany::GetPresidentName(AICompany::CompanyID company)
{
company = ResolveCompanyID(company);
diff --git a/src/ai/api/ai_company.hpp b/src/ai/api/ai_company.hpp
index bc08e9630..9a3e324ea 100644
--- a/src/ai/api/ai_company.hpp
+++ b/src/ai/api/ai_company.hpp
@@ -61,7 +61,7 @@ public:
/**
* Obsolete, use AICompany::GetName instead.
*/
- static const char *GetCompanyName(CompanyID company);
+ static char *GetCompanyName(CompanyID company);
/**
* Get the name of the given company.
@@ -69,7 +69,7 @@ public:
* @pre ResolveCompanyID(company) != COMPANY_INVALID
* @return The name of the given company.
*/
- static const char *GetName(CompanyID company);
+ static char *GetName(CompanyID company);
/**
* Set the name of your president.
@@ -86,7 +86,7 @@ public:
* @pre ResolveCompanyID(company) != COMPANY_INVALID
* @return The name of the president of the given company.
*/
- static const char *GetPresidentName(CompanyID company);
+ static char *GetPresidentName(CompanyID company);
/**
* Sets the amount to loan.
diff --git a/src/ai/api/ai_engine.cpp b/src/ai/api/ai_engine.cpp
index 443f03482..06ed3d728 100644
--- a/src/ai/api/ai_engine.cpp
+++ b/src/ai/api/ai_engine.cpp
@@ -25,7 +25,7 @@
return ::IsEngineIndex(engine_id) && HasBit(::GetEngine(engine_id)->company_avail, _current_company);
}
-/* static */ const char *AIEngine::GetName(EngineID engine_id)
+/* static */ char *AIEngine::GetName(EngineID engine_id)
{
if (!IsValidEngine(engine_id)) return NULL;
diff --git a/src/ai/api/ai_engine.hpp b/src/ai/api/ai_engine.hpp
index 1dfe76e08..7e49558a1 100644
--- a/src/ai/api/ai_engine.hpp
+++ b/src/ai/api/ai_engine.hpp
@@ -31,7 +31,7 @@ public:
* @pre IsValidEngine(engine_id).
* @return The name the engine has.
*/
- static const char *GetName(EngineID engine_id);
+ static char *GetName(EngineID engine_id);
/**
* Get the cargo-type of an engine. In case it can transport 2 cargos, it
diff --git a/src/ai/api/ai_error.cpp b/src/ai/api/ai_error.cpp
index 4c21db726..e060532d4 100644
--- a/src/ai/api/ai_error.cpp
+++ b/src/ai/api/ai_error.cpp
@@ -14,9 +14,9 @@ AIError::AIErrorMapString AIError::error_map_string = AIError::AIErrorMapString(
return AIObject::GetLastError();
}
-/* static */ const char *AIError::GetLastErrorString()
+/* static */ char *AIError::GetLastErrorString()
{
- return (*error_map_string.find(AIError::GetLastError())).second;
+ return strdup((*error_map_string.find(AIError::GetLastError())).second);
}
/* static */ AIErrorType AIError::StringToError(StringID internal_string_id)
diff --git a/src/ai/api/ai_error.hpp b/src/ai/api/ai_error.hpp
index 6a448ff3a..b9fd572bb 100644
--- a/src/ai/api/ai_error.hpp
+++ b/src/ai/api/ai_error.hpp
@@ -134,7 +134,7 @@ public:
* Get the last error in string format (for human readability).
* @return An ErrorMessage enum item, as string.
*/
- static const char *GetLastErrorString();
+ static char *GetLastErrorString();
/**
* Get the error based on the OpenTTD StringID.
diff --git a/src/ai/api/ai_event_types.cpp b/src/ai/api/ai_event_types.cpp
index b865ca59d..09d801e70 100644
--- a/src/ai/api/ai_event_types.cpp
+++ b/src/ai/api/ai_event_types.cpp
@@ -19,7 +19,7 @@ bool AIEventVehicleCrashed::CloneCrashedVehicle(TileIndex depot)
return false;
}
-const char *AIEventEnginePreview::GetName()
+char *AIEventEnginePreview::GetName()
{
static const int len = 64;
char *engine_name = MallocT<char>(len);
diff --git a/src/ai/api/ai_event_types.hpp b/src/ai/api/ai_event_types.hpp
index 9c0e8a396..6fbf5be3f 100644
--- a/src/ai/api/ai_event_types.hpp
+++ b/src/ai/api/ai_event_types.hpp
@@ -254,7 +254,7 @@ public:
* Get the name of the offered engine.
* @return The name the engine has.
*/
- const char *GetName();
+ char *GetName();
/**
* Get the cargo-type of the offered engine. In case it can transport 2 cargos, it
diff --git a/src/ai/api/ai_group.cpp b/src/ai/api/ai_group.cpp
index 5dc676303..ea3af7d8c 100644
--- a/src/ai/api/ai_group.cpp
+++ b/src/ai/api/ai_group.cpp
@@ -52,7 +52,7 @@
return AIObject::DoCommand(0, group_id, 0, CMD_RENAME_GROUP, name);
}
-/* static */ const char *AIGroup::GetName(GroupID group_id)
+/* static */ char *AIGroup::GetName(GroupID group_id)
{
if (!IsValidGroup(group_id)) return NULL;
diff --git a/src/ai/api/ai_group.hpp b/src/ai/api/ai_group.hpp
index 51a4c47aa..85202d2f0 100644
--- a/src/ai/api/ai_group.hpp
+++ b/src/ai/api/ai_group.hpp
@@ -77,7 +77,7 @@ public:
* @pre IsValidGroup(group_id).
* @return The name the group has.
*/
- static const char *GetName(GroupID group_id);
+ static char *GetName(GroupID group_id);
/**
* Enable or disable autoreplace protected. If the protection is
diff --git a/src/ai/api/ai_industry.cpp b/src/ai/api/ai_industry.cpp
index 068a92865..772df722e 100644
--- a/src/ai/api/ai_industry.cpp
+++ b/src/ai/api/ai_industry.cpp
@@ -27,7 +27,7 @@
return ::IsValidIndustryID(industry_id);
}
-/* static */ const char *AIIndustry::GetName(IndustryID industry_id)
+/* static */ char *AIIndustry::GetName(IndustryID industry_id)
{
if (!IsValidIndustry(industry_id)) return NULL;
static const int len = 64;
diff --git a/src/ai/api/ai_industry.hpp b/src/ai/api/ai_industry.hpp
index 1b3365a97..ed44cada5 100644
--- a/src/ai/api/ai_industry.hpp
+++ b/src/ai/api/ai_industry.hpp
@@ -43,7 +43,7 @@ public:
* @pre IsValidIndustry(industry_id).
* @return The name of the industry.
*/
- static const char *GetName(IndustryID industry_id);
+ static char *GetName(IndustryID industry_id);
/**
* Gets the production of a cargo of the industry.
diff --git a/src/ai/api/ai_industrytype.cpp b/src/ai/api/ai_industrytype.cpp
index 34d69f5f8..18ea41de5 100644
--- a/src/ai/api/ai_industrytype.cpp
+++ b/src/ai/api/ai_industrytype.cpp
@@ -40,7 +40,7 @@
return ::GetIndustrySpec(industry_type)->GetConstructionCost();
}
-/* static */ const char *AIIndustryType::GetName(IndustryType industry_type)
+/* static */ char *AIIndustryType::GetName(IndustryType industry_type)
{
if (!IsValidIndustryType(industry_type)) return NULL;
static const int len = 64;
diff --git a/src/ai/api/ai_industrytype.hpp b/src/ai/api/ai_industrytype.hpp
index 88ba6d730..2e38166b3 100644
--- a/src/ai/api/ai_industrytype.hpp
+++ b/src/ai/api/ai_industrytype.hpp
@@ -29,7 +29,7 @@ public:
* @pre IsValidIndustryType(industry_type).
* @return The name of an industry.
*/
- static const char *GetName(IndustryType industry_type);
+ static char *GetName(IndustryType industry_type);
/**
* Get a list of CargoID possible produced by this industry-type.
diff --git a/src/ai/api/ai_sign.cpp b/src/ai/api/ai_sign.cpp
index 561b5c857..4683e2d32 100644
--- a/src/ai/api/ai_sign.cpp
+++ b/src/ai/api/ai_sign.cpp
@@ -33,7 +33,7 @@
return AIObject::DoCommand(0, sign_id, 0, CMD_RENAME_SIGN, name);
}
-/* static */ const char *AISign::GetName(SignID sign_id)
+/* static */ char *AISign::GetName(SignID sign_id)
{
if (!IsValidSign(sign_id)) return NULL;
diff --git a/src/ai/api/ai_sign.hpp b/src/ai/api/ai_sign.hpp
index 8bf7e0b79..441b9b349 100644
--- a/src/ai/api/ai_sign.hpp
+++ b/src/ai/api/ai_sign.hpp
@@ -60,7 +60,7 @@ public:
* @pre IsValidSign(sign_id).
* @return The name of the sign.
*/
- static const char *GetName(SignID sign_id);
+ static char *GetName(SignID sign_id);
/**
* Gets the location of the sign.
diff --git a/src/ai/api/ai_station.cpp b/src/ai/api/ai_station.cpp
index aaaedd972..4086b56a2 100644
--- a/src/ai/api/ai_station.cpp
+++ b/src/ai/api/ai_station.cpp
@@ -30,7 +30,7 @@
return ::GetStationIndex(tile);
}
-/* static */ const char *AIStation::GetName(StationID station_id)
+/* static */ char *AIStation::GetName(StationID station_id)
{
if (!IsValidStation(station_id)) return NULL;
diff --git a/src/ai/api/ai_station.hpp b/src/ai/api/ai_station.hpp
index 6e263c912..5a25f16ed 100644
--- a/src/ai/api/ai_station.hpp
+++ b/src/ai/api/ai_station.hpp
@@ -70,7 +70,7 @@ public:
* @pre IsValidStation(station_id).
* @return The name of the station.
*/
- static const char *GetName(StationID station_id);
+ static char *GetName(StationID station_id);
/**
* Set the name this station.
diff --git a/src/ai/api/ai_town.cpp b/src/ai/api/ai_town.cpp
index 921e5a73e..bb7dee9f2 100644
--- a/src/ai/api/ai_town.cpp
+++ b/src/ai/api/ai_town.cpp
@@ -30,7 +30,7 @@
return ::IsValidTownID(town_id);
}
-/* static */ const char *AITown::GetName(TownID town_id)
+/* static */ char *AITown::GetName(TownID town_id)
{
if (!IsValidTown(town_id)) return NULL;
static const int len = 64;
diff --git a/src/ai/api/ai_town.hpp b/src/ai/api/ai_town.hpp
index f9152106f..a4516f94b 100644
--- a/src/ai/api/ai_town.hpp
+++ b/src/ai/api/ai_town.hpp
@@ -112,7 +112,7 @@ public:
* @pre IsValidTown(town_id).
* @return The name of the town.
*/
- static const char *GetName(TownID town_id);
+ static char *GetName(TownID town_id);
/**
* Gets the number of inhabitants in the town.
diff --git a/src/ai/api/ai_vehicle.cpp b/src/ai/api/ai_vehicle.cpp
index 7427025af..ec5d42f65 100644
--- a/src/ai/api/ai_vehicle.cpp
+++ b/src/ai/api/ai_vehicle.cpp
@@ -227,7 +227,7 @@
return ::GetVehicle(vehicle_id)->unitnumber;
}
-/* static */ const char *AIVehicle::GetName(VehicleID vehicle_id)
+/* static */ char *AIVehicle::GetName(VehicleID vehicle_id)
{
if (!IsValidVehicle(vehicle_id)) return NULL;
diff --git a/src/ai/api/ai_vehicle.hpp b/src/ai/api/ai_vehicle.hpp
index 1336e9efe..f0be433da 100644
--- a/src/ai/api/ai_vehicle.hpp
+++ b/src/ai/api/ai_vehicle.hpp
@@ -126,7 +126,7 @@ public:
* @pre IsValidVehicle(vehicle_id).
* @return The name the vehicle has.
*/
- static const char *GetName(VehicleID vehicle_id);
+ static char *GetName(VehicleID vehicle_id);
/**
* Get the current location of a vehicle.