diff --git a/src/town.h b/src/town.h --- a/src/town.h +++ b/src/town.h @@ -125,11 +125,11 @@ struct Town : TownPool::PoolItem<&_town_ void UpdateVirtCoord(); - inline const char *GetCachedName() const + inline const std::string &GetCachedName() const { - if (!this->name.empty()) return this->name.c_str(); + if (!this->name.empty()) return this->name; if (this->cached_name.empty()) this->FillCachedName(); - return this->cached_name.c_str(); + return this->cached_name; } static inline Town *GetByTile(TileIndex tile)