summaryrefslogtreecommitdiff
path: root/src/base_station_base.h
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2020-05-17 23:31:59 +0200
committerMichael Lutz <michi@icosahedron.de>2020-05-21 20:02:34 +0200
commit63ccb36ef3ecd53a503c0e9fea87f0784802af0f (patch)
treed3e1134029fd437d1ad2d948f83592b930e9456f /src/base_station_base.h
parent9b6f5e3bb850b6cff02cc761767fcdf49c681645 (diff)
downloadopenttd-63ccb36ef3ecd53a503c0e9fea87f0784802af0f.tar.xz
Codechange: Use std::string for most of the user-settable custom names.
Diffstat (limited to 'src/base_station_base.h')
-rw-r--r--src/base_station_base.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/base_station_base.h b/src/base_station_base.h
index 0467866e5..40543f1b8 100644
--- a/src/base_station_base.h
+++ b/src/base_station_base.h
@@ -54,7 +54,7 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
TrackedViewportSign sign; ///< NOSAVE: Dimensions of sign
byte delete_ctr; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted.
- char *name; ///< Custom name
+ std::string name; ///< Custom name
StringID string_id; ///< Default name (town area) of station
mutable std::string cached_name; ///< NOSAVE: Cache of the resolved name of the station, if not using a custom name
@@ -111,7 +111,7 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
inline const char *GetCachedName() const
{
- if (this->name != nullptr) return this->name;
+ if (!this->name.empty()) return this->name.c_str();
if (this->cached_name.empty()) this->FillCachedName();
return this->cached_name.c_str();
}