summaryrefslogtreecommitdiff
path: root/src/depot_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/depot_cmd.cpp')
-rw-r--r--src/depot_cmd.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/depot_cmd.cpp b/src/depot_cmd.cpp
index a142fbe7d..9379afb82 100644
--- 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 tile, DoCommandFlag flags, uint32 p1, uint3
}
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 */