mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: let IsUnique.* functions accept std::string
This commit is contained in:
parent
b4aedef848
commit
661728558e
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue