diff options
author | rubidium42 <rubidium@openttd.org> | 2021-05-29 16:07:42 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-05-29 19:02:18 +0200 |
commit | 661728558e9ce2eb8cfdb6afd7182b85e1f19a67 (patch) | |
tree | 24f5f4c38e70edd1b6b4adead7253dcf4930642f | |
parent | b4aedef848822649d3f7a045504eb2a9870b4b7e (diff) | |
download | openttd-661728558e9ce2eb8cfdb6afd7182b85e1f19a67.tar.xz |
Codechange: let IsUnique.* functions accept std::string
-rw-r--r-- | src/company_cmd.cpp | 4 | ||||
-rw-r--r-- | src/depot_cmd.cpp | 2 | ||||
-rw-r--r-- | src/engine.cpp | 2 | ||||
-rw-r--r-- | src/station_cmd.cpp | 2 | ||||
-rw-r--r-- | src/town_cmd.cpp | 2 | ||||
-rw-r--r-- | src/vehicle_cmd.cpp | 2 | ||||
-rw-r--r-- | src/waypoint_cmd.cpp | 2 |
7 files changed, 8 insertions, 8 deletions
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 85809544d..5a2b9ba1d 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -1049,7 +1049,7 @@ CommandCost CmdSetCompanyColour(TileIndex tile, DoCommandFlag flags, uint32 p1, * @param name Name to search. * @return \c true if the name us unique (that is, not in use), else \c false. */ -static bool IsUniqueCompanyName(const char *name) +static bool IsUniqueCompanyName(const std::string &name) { for (const Company *c : Company::Iterate()) { if (!c->name.empty() && c->name == name) return false; @@ -1095,7 +1095,7 @@ CommandCost CmdRenameCompany(TileIndex tile, DoCommandFlag flags, uint32 p1, uin * @param name Name to search. * @return \c true if the name us unique (that is, not in use), else \c false. */ -static bool IsUniquePresidentName(const char *name) +static bool IsUniquePresidentName(const std::string &name) { for (const Company *c : Company::Iterate()) { if (!c->president_name.empty() && c->president_name == name) return false; diff --git a/src/depot_cmd.cpp b/src/depot_cmd.cpp index 9379afb82..729678072 100644 --- a/src/depot_cmd.cpp +++ b/src/depot_cmd.cpp @@ -26,7 +26,7 @@ * @param name The name to check. * @return True if there is no depot with the given name. */ -static bool IsUniqueDepotName(const char *name) +static bool IsUniqueDepotName(const std::string &name) { for (const Depot *d : Depot::Iterate()) { if (!d->name.empty() && d->name == name) return false; diff --git a/src/engine.cpp b/src/engine.cpp index 41cd9dba8..e60cd7f4d 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -1061,7 +1061,7 @@ void EnginesMonthlyLoop() * @param name New name of an engine. * @return \c false if the name is being used already, else \c true. */ -static bool IsUniqueEngineName(const char *name) +static bool IsUniqueEngineName(const std::string &name) { for (const Engine *e : Engine::Iterate()) { if (!e->name.empty() && e->name == name) return false; diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index d9529da11..887c347d4 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -3915,7 +3915,7 @@ static uint UpdateStationWaiting(Station *st, CargoID type, uint amount, SourceT return amount; } -static bool IsUniqueStationName(const char *name) +static bool IsUniqueStationName(const std::string &name) { for (const Station *st : Station::Iterate()) { if (!st->name.empty() && st->name == name) return false; diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 177b507e4..f70776c57 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1907,7 +1907,7 @@ static CommandCost TownCanBePlacedHere(TileIndex tile) * @param name name to check * @return is this name unique? */ -static bool IsUniqueTownName(const char *name) +static bool IsUniqueTownName(const std::string &name) { for (const Town *t : Town::Iterate()) { if (!t->name.empty() && t->name == name) return false; diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index 9da6b89ce..f55e66ace 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -748,7 +748,7 @@ CommandCost CmdDepotMassAutoReplace(TileIndex tile, DoCommandFlag flags, uint32 * @param name Name to test. * @return True ifffffff the name is unique. */ -static bool IsUniqueVehicleName(const char *name) +static bool IsUniqueVehicleName(const std::string &name) { for (const Vehicle *v : Vehicle::Iterate()) { if (!v->name.empty() && v->name == name) return false; diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index e8e9e6945..b41e80f97 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -395,7 +395,7 @@ CommandCost RemoveBuoy(TileIndex tile, DoCommandFlag flags) * @param name The name to check. * @return True iff the name is unique. */ -static bool IsUniqueWaypointName(const char *name) +static bool IsUniqueWaypointName(const std::string &name) { for (const Waypoint *wp : Waypoint::Iterate()) { if (!wp->name.empty() && wp->name == name) return false; |