forked from mirror/OpenTTD
(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
This commit is contained in:
37
town_cmd.c
37
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;
|
||||
|
Reference in New Issue
Block a user