Codechange: Use std::string for most of the user-settable custom names.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user