Codechange: Use std::string for most of the user-settable custom names.

This commit is contained in:
Michael Lutz
2020-05-17 23:31:59 +02:00
parent 9b6f5e3bb8
commit 63ccb36ef3
41 changed files with 160 additions and 177 deletions

View File

@@ -290,11 +290,6 @@ Group::Group(Owner owner)
this->folded = false;
}
Group::~Group()
{
free(this->name);
}
/**
* Create a new vehicle group.
@@ -422,10 +417,12 @@ CommandCost CmdAlterGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
}
if (flags & DC_EXEC) {
/* Delete the old name */
free(g->name);
/* Assign the new one */
g->name = reset ? nullptr : stredup(text);
if (reset) {
g->name.clear();
} else {
g->name = text;
}
}
} else {
/* Set group parent */