Changeset - r25561:3defb050f30b
[Not reviewed]
master
0 7 0
rubidium42 - 3 years ago 2021-05-29 14:07:42
rubidium@openttd.org
Codechange: let IsUnique.* functions accept std::string
7 files changed with 8 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/company_cmd.cpp
Show inline comments
 
@@ -1049,7 +1049,7 @@ CommandCost CmdSetCompanyColour(TileInde
 
 * @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 t
 
 * @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;
src/depot_cmd.cpp
Show inline comments
 
@@ -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;
src/engine.cpp
Show inline comments
 
@@ -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;
src/station_cmd.cpp
Show inline comments
 
@@ -3915,7 +3915,7 @@ static uint UpdateStationWaiting(Station
 
	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;
src/town_cmd.cpp
Show inline comments
 
@@ -1907,7 +1907,7 @@ static CommandCost TownCanBePlacedHere(T
 
 * @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;
src/vehicle_cmd.cpp
Show inline comments
 
@@ -748,7 +748,7 @@ CommandCost CmdDepotMassAutoReplace(Tile
 
 * @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;
src/waypoint_cmd.cpp
Show inline comments
 
@@ -395,7 +395,7 @@ CommandCost RemoveBuoy(TileIndex tile, D
 
 * @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;
0 comments (0 inline, 0 general)