diff options
author | truelight <truelight@openttd.org> | 2004-12-31 18:57:24 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2004-12-31 18:57:24 +0000 |
commit | 92ac503b744bb226d4b91fa55b42f92bd4bd9f69 (patch) | |
tree | d5f1d90b0c2c0315541e26c9c0bac1cfe02bfa48 /town_cmd.c | |
parent | 1fef394fdec6baaae1fcd0b7bc6f4b3499d03b12 (diff) | |
download | openttd-92ac503b744bb226d4b91fa55b42f92bd4bd9f69.tar.xz |
(svn r1312) -Add: Patch which is on by default: population in label of the town
-Fix: Expand town is a bit more agressive
-Fix: Fixed a bug in growing algorithm
Diffstat (limited to 'town_cmd.c')
-rw-r--r-- | town_cmd.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/town_cmd.c b/town_cmd.c index bb72d2bf1..b15e1f93d 100644 --- a/town_cmd.c +++ b/town_cmd.c @@ -171,11 +171,32 @@ static bool IsCloseToTown(uint tile, uint dist) 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 @@ no_slope: 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 UpdateTownRadius(Town *t) } } -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 @@ void ExpandTown(Town *t) _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; |