Merge branch 'master' into jgrpp

# Conflicts:
#	projects/openttd_vs140.vcxproj.filters
#	projects/openttd_vs141.vcxproj.filters
#	projects/openttd_vs142.vcxproj.filters
#	src/base_consist.h
#	src/company_base.h
#	src/newgrf_config.cpp
#	src/newgrf_config.h
#	src/openttd.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/saveload/station_sl.cpp
#	src/settings.cpp
#	src/signs_base.h
#	src/string.cpp
#	src/string_func.h
#	src/table/misc_settings.ini
#	src/table/settings.h.preamble
#	src/town_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_cmd.cpp
#	src/video/cocoa/cocoa_v.mm
#	src/video/null_v.cpp
This commit is contained in:
Jonathan G Rennison
2020-05-21 20:19:57 +01:00
162 changed files with 2519 additions and 1448 deletions

View File

@@ -63,7 +63,7 @@ struct Town : TownPool::PoolItem<&_town_pool> {
uint32 townnamegrfid;
uint16 townnametype;
uint32 townnameparts;
char *name; ///< Custom town name. If nullptr, the town was not renamed and uses the generated name.
std::string name; ///< Custom town name. If empty, the town was not renamed and uses the generated name.
mutable std::string cached_name; ///< NOSAVE: Cache of the resolved name of the town, if not using a custom town name
byte flags; ///< See #TownFlags.
@@ -84,7 +84,7 @@ struct Town : TownPool::PoolItem<&_town_pool> {
TransportedCargoStat<uint16> received[NUM_TE]; ///< Cargo statistics about received cargotypes.
uint32 goal[NUM_TE]; ///< Amount of cargo required for the town to grow.
char *text; ///< General text with additional information.
std::string text; ///< General text with additional information.
inline byte GetPercentTransported(CargoID cid) const { return this->supplied[cid].old_act * 256 / (this->supplied[cid].old_max + 1); }
@@ -162,7 +162,7 @@ struct Town : TownPool::PoolItem<&_town_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();
}
@@ -279,7 +279,7 @@ template <class T>
void MakeDefaultName(T *obj)
{
/* We only want to set names if it hasn't been set before, or when we're calling from afterload. */
assert(obj->name == nullptr || obj->town_cn == UINT16_MAX);
assert(obj->name.empty() || obj->town_cn == UINT16_MAX);
obj->town = ClosestTownFromTile(obj->xy, UINT_MAX);