town_cmd.c
changeset 835 a22d6bc16a51
parent 830 8114845804c9
child 836 2874738bce7c
--- a/town_cmd.c	Fri Dec 31 15:55:14 2004 +0000
+++ b/town_cmd.c	Fri Dec 31 18:57:24 2004 +0000
@@ -171,11 +171,32 @@
 	return false;
 }
 
+static void MarkTownSignDirty(Town *t)
+{
+	MarkAllViewportsDirty(
+		t->sign.left-6,
+		t->sign.top-3,
+		t->sign.left+t->sign.width_1*4+12,
+		t->sign.top + 45
+	);
+}
+
+void UpdateTownVirtCoord(Town *t)
+{
+	MarkTownSignDirty(t);
+	Point pt = RemapCoords2(GET_TILE_X(t->xy)*16, GET_TILE_Y(t->xy)*16);
+	SetDParam(0, t->townnametype);
+	SetDParam(1, t->townnameparts);
+	SetDParam(2, t->population);
+	UpdateViewportSignPos(&t->sign, pt.x, pt.y - 24, _patches.population_in_label ? STR_TOWN_LABEL_POP : STR_2001);
+	MarkTownSignDirty(t);
+}
 
 static void ChangePopulation(Town *t, int mod)
 {
 	t->population += mod;
 	InvalidateWindow(WC_TOWN_VIEW, t->index);
+	UpdateTownVirtCoord(t);
 
 	if (_town_sort_order & 2) _town_sort_dirty = true;
 }
@@ -456,7 +477,9 @@
 			return false;
 		}
 
-		tile = TILE_ADD(tile, _roadblock_tileadd[dir]);
+		/* Can somebody explain for what this is needed? :s */
+		// tile = TILE_ADD(tile, _roadblock_tileadd[dir]);
+		return true;
 	}
 }
 
@@ -814,13 +837,6 @@
 	}
 }
 
-static void UpdateTownVirtCoord(Town *t)
-{
-	Point pt = RemapCoords2(GET_TILE_X(t->xy)*16, GET_TILE_Y(t->xy)*16);
-	SetDParam(0, t->townnameparts);
-	UpdateViewportSignPos(&t->sign, pt.x, pt.y - 24, t->townnametype);
-}
-
 static void CreateTownName(Town *t1)
 {
 	Town *t2;
@@ -1407,11 +1423,12 @@
 
 	_generating_world = true;
 
-	amount = ((int)Random()&3) + 3;
+	/* The more houses, the faster we grow */
+	amount = RandomRange(t->num_houses / 10) + 3;
 	t->num_houses += amount;
 	UpdateTownRadius(t);
 
-	n = amount * 4;
+	n = amount * 10;
 	do GrowTown(t); while (--n);
 
 	t->num_houses -= amount;