summaryrefslogtreecommitdiff
path: root/src/town.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-09-16 16:31:57 +0000
committerrubidium <rubidium@openttd.org>2010-09-16 16:31:57 +0000
commitaf18c30f30d550b98f7fe3dc89c8977a2aeb7f51 (patch)
tree9c154aa95356c740d333b8f92ee34259272cc914 /src/town.h
parentb01c63cd23b3c60de3b48478b5287cdaeffed974 (diff)
downloadopenttd-af18c30f30d550b98f7fe3dc89c8977a2aeb7f51.tar.xz
(svn r20816) -Codechange [FS#3835]: make waypoint default names work like depots, stations and vehicles (Krille)
Diffstat (limited to 'src/town.h')
-rw-r--r--src/town.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/town.h b/src/town.h
index 6e3533d8d..d2f0ba143 100644
--- a/src/town.h
+++ b/src/town.h
@@ -240,8 +240,8 @@ extern TownID _new_town_id;
template <class T>
void MakeDefaultName(T *obj)
{
- /* We only want to set names if it hasn't been set before. */
- assert(obj->name == NULL);
+ /* We only want to set names if it hasn't been set before, or when we're calling from afterload. */
+ assert(obj->name == NULL || obj->town_cn == UINT16_MAX);
obj->town = ClosestTownFromTile(obj->xy, UINT_MAX);
@@ -266,8 +266,8 @@ void MakeDefaultName(T *obj)
/* check only valid waypoints... */
if (lobj != NULL && obj != lobj) {
- /* only objects with 'generic' name within the same city and with the same type*/
- if (lobj->name == NULL && lobj->town == obj->town && lobj->IsOfType(obj)) {
+ /* only objects within the same city and with the same type */
+ if (lobj->town == obj->town && lobj->IsOfType(obj)) {
/* if lobj->town_cn < next, uint will overflow to '+inf' */
uint i = (uint)lobj->town_cn - next;