Merge branch 'master' into jgrpp

# Conflicts:
#	src/base_station_base.h
#	src/industry.h
#	src/industry_cmd.cpp
#	src/industry_gui.cpp
#	src/lang/korean.txt
#	src/os/macosx/crashlog_osx.cpp
#	src/station_cmd.cpp
#	src/town.h
#	src/town_cmd.cpp
#	src/town_gui.cpp
This commit is contained in:
Jonathan G Rennison
2020-01-20 18:36:55 +00:00
39 changed files with 604 additions and 225 deletions

View File

@@ -225,13 +225,11 @@ void Town::UpdateLabel()
}
}
void Town::FillCachedName()
void Town::FillCachedName() const
{
char buf[MAX_LENGTH_TOWN_NAME_CHARS * MAX_CHAR_LENGTH];
char *end = GetTownName(buf, this, lastof(buf));
char *alloced = MallocT<char>(end - buf + 1);
memcpy(alloced, buf, end - buf + 1);
this->cached_name.reset(alloced);
this->cached_name.assign(buf, end);
}
/**
@@ -533,7 +531,7 @@ void UpdateAllTownVirtCoords()
void ClearAllTownCachedNames()
{
for (Town *t : Town::Iterate()) {
t->cached_name.reset();
t->cached_name.clear();
}
}
@@ -2985,7 +2983,7 @@ CommandCost CmdRenameTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
}
if (flags & DC_EXEC) {
t->cached_name.reset();
t->cached_name.clear();
free(t->name);
t->name = reset ? nullptr : stredup(text);