diff --git a/src/depot_cmd.cpp b/src/depot_cmd.cpp --- a/src/depot_cmd.cpp +++ b/src/depot_cmd.cpp @@ -29,7 +29,7 @@ static bool IsUniqueDepotName(const char *name) { for (const Depot *d : Depot::Iterate()) { - if (d->name != nullptr && strcmp(d->name, name) == 0) return false; + if (!d->name.empty() && d->name == name) return false; } return true; @@ -60,13 +60,11 @@ CommandCost CmdRenameDepot(TileIndex til } if (flags & DC_EXEC) { - free(d->name); - if (reset) { - d->name = nullptr; + d->name.clear(); MakeDefaultName(d); } else { - d->name = stredup(text); + d->name = text; } /* Update the orders and depot */