mirror of https://github.com/OpenTTD/OpenTTD
(svn r4196) -Codechange: Add and make use of an accessor that modifies the size of the Company HQ
parent
1c19e7be00
commit
20c29f10df
|
@ -67,20 +67,13 @@ void UpdateCompanyHQ(Player *p, uint score)
|
||||||
if (tile == 0)
|
if (tile == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
(val = 128, score < 170) ||
|
(val = 0, score < 170) ||
|
||||||
(val+= 4, score < 350) ||
|
(val++, score < 350) ||
|
||||||
(val+= 4, score < 520) ||
|
(val++, score < 520) ||
|
||||||
(val+= 4, score < 720) ||
|
(val++, score < 720) ||
|
||||||
(val+= 4, true);
|
(val++, true);
|
||||||
|
|
||||||
/* house is already big enough */
|
EnlargeCompanyHQ(tile, val);
|
||||||
if (val <= _m[tile].m5)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_m[tile + TileDiffXY(0, 0)].m5 = val;
|
|
||||||
_m[tile + TileDiffXY(0, 1)].m5 = ++val;
|
|
||||||
_m[tile + TileDiffXY(1, 0)].m5 = ++val;
|
|
||||||
_m[tile + TileDiffXY(1, 1)].m5 = ++val;
|
|
||||||
|
|
||||||
MarkTileDirtyByTile(tile + TileDiffXY(0, 0));
|
MarkTileDirtyByTile(tile + TileDiffXY(0, 0));
|
||||||
MarkTileDirtyByTile(tile + TileDiffXY(0, 1));
|
MarkTileDirtyByTile(tile + TileDiffXY(0, 1));
|
||||||
|
|
|
@ -39,6 +39,17 @@ static inline bool IsOwnedLandTile(TileIndex t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void EnlargeCompanyHQ(TileIndex t, byte size)
|
||||||
|
{
|
||||||
|
if (size <= _m[t].m5 - UNMOVABLE_HQ_NORTH) return;
|
||||||
|
|
||||||
|
_m[t + TileDiffXY(0, 0)].m5 = UNMOVABLE_HQ_NORTH + size * 4;
|
||||||
|
_m[t + TileDiffXY(0, 1)].m5 = UNMOVABLE_HQ_WEST + size * 4;
|
||||||
|
_m[t + TileDiffXY(1, 0)].m5 = UNMOVABLE_HQ_EAST + size * 4;
|
||||||
|
_m[t + TileDiffXY(1, 1)].m5 = UNMOVABLE_HQ_SOUTH + size * 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void MakeUnmovable(TileIndex t, UnmovableType u, Owner o)
|
static inline void MakeUnmovable(TileIndex t, UnmovableType u, Owner o)
|
||||||
{
|
{
|
||||||
SetTileType(t, MP_UNMOVABLE);
|
SetTileType(t, MP_UNMOVABLE);
|
||||||
|
|
Loading…
Reference in New Issue