|
@@ -222,124 +222,123 @@ static void GetAcceptedCargo_Unmovable(T
|
|
|
byte m5 = _m[tile].m5;
|
|
|
uint level; // HQ level (depends on company performance) in the range 1..5.
|
|
|
|
|
|
if (!(m5 & 0x80)) {
|
|
|
/* not used */
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
/* HQ accepts passenger and mail; but we have to divide the values
|
|
|
* between 4 tiles it occupies! */
|
|
|
|
|
|
level = (m5 & ~0x80) / 4 + 1;
|
|
|
|
|
|
// Top town building generates 10, so to make HQ interesting, the top
|
|
|
// type makes 20.
|
|
|
ac[CT_PASSENGERS] = max(1, level);
|
|
|
|
|
|
// Top town building generates 4, HQ can make up to 8. The
|
|
|
// proportion passengers:mail is different because such a huge
|
|
|
// commercial building generates unusually high amount of mail
|
|
|
// correspondence per physical visitor.
|
|
|
ac[CT_MAIL] = max(1, level / 2);
|
|
|
}
|
|
|
|
|
|
static const StringID _unmovable_tile_str[] = {
|
|
|
STR_5803_COMPANY_HEADQUARTERS,
|
|
|
STR_5801_TRANSMITTER,
|
|
|
STR_5802_LIGHTHOUSE,
|
|
|
STR_2016_STATUE,
|
|
|
STR_5805_COMPANY_OWNED_LAND,
|
|
|
};
|
|
|
|
|
|
static void GetTileDesc_Unmovable(TileIndex tile, TileDesc *td)
|
|
|
{
|
|
|
int i = _m[tile].m5;
|
|
|
if (i & 0x80) i = -1;
|
|
|
td->str = _unmovable_tile_str[i + 1];
|
|
|
td->owner = GetTileOwner(tile);
|
|
|
}
|
|
|
|
|
|
static void AnimateTile_Unmovable(TileIndex tile)
|
|
|
{
|
|
|
/* not used */
|
|
|
}
|
|
|
|
|
|
static void TileLoop_Unmovable(TileIndex tile)
|
|
|
{
|
|
|
byte m5 = _m[tile].m5;
|
|
|
byte level; // HQ level (depends on company performance) in the range 1..5.
|
|
|
uint level; // HQ level (depends on company performance) in the range 1..5.
|
|
|
uint32 r;
|
|
|
|
|
|
if (!(m5 & 0x80)) {
|
|
|
/* not used */
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
/* HQ accepts passenger and mail; but we have to divide the values
|
|
|
* between 4 tiles it occupies! */
|
|
|
|
|
|
level = (m5 & ~0x80) / 4 + 1;
|
|
|
level = GB(m5, 0, 7) / 4 + 1;
|
|
|
assert(level < 6);
|
|
|
|
|
|
r = Random();
|
|
|
// Top town buildings generate 250, so the top HQ type makes 256.
|
|
|
if ((byte) r < (256 / 4 / (6 - level))) {
|
|
|
uint amt = ((byte) r >> 3) / 4 + 1;
|
|
|
if (GB(r, 0, 8) < (256 / 4 / (6 - level))) {
|
|
|
uint amt = GB(r, 0, 8) / 8 / 4 + 1;
|
|
|
if (_economy.fluct <= 0) amt = (amt + 1) >> 1;
|
|
|
MoveGoodsToStation(tile, 2, 2, CT_PASSENGERS, amt);
|
|
|
}
|
|
|
|
|
|
r >>= 8;
|
|
|
// Top town building generates 90, HQ can make up to 196. The
|
|
|
// proportion passengers:mail is about the same as in the acceptance
|
|
|
// equations.
|
|
|
if ((byte) r < (196 / 4 / (6 - level))) {
|
|
|
uint amt = ((byte) r >> 3) / 4 + 1;
|
|
|
if (GB(r, 8, 8) < (196 / 4 / (6 - level))) {
|
|
|
uint amt = GB(r, 8, 8) / 8 / 4 + 1;
|
|
|
if (_economy.fluct <= 0) amt = (amt + 1) >> 1;
|
|
|
MoveGoodsToStation(tile, 2, 2, CT_MAIL, amt);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
static uint32 GetTileTrackStatus_Unmovable(TileIndex tile, TransportType mode)
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
static void ClickTile_Unmovable(TileIndex tile)
|
|
|
{
|
|
|
if (_m[tile].m5 & 0x80) {
|
|
|
ShowPlayerCompany(GetTileOwner(tile));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static const TileIndexDiffC _tile_add[] = {
|
|
|
{ 1, 0},
|
|
|
{ 0, 1},
|
|
|
{-1, 0},
|
|
|
{ 0, -1}
|
|
|
};
|
|
|
|
|
|
/* checks, if a radio tower is within a 9x9 tile square around tile */
|
|
|
static bool checkRadioTowerNearby(TileIndex tile)
|
|
|
{
|
|
|
TileIndex tile_s = tile - TileDiffXY(4, 4);
|
|
|
|
|
|
BEGIN_TILE_LOOP(tile, 9, 9, tile_s)
|
|
|
// already a radio tower here?
|
|
|
if (IsTileType(tile, MP_UNMOVABLE) && _m[tile].m5 == 0)
|
|
|
return false;
|
|
|
END_TILE_LOOP(tile, 9, 9, tile_s)
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
void GenerateUnmovables(void)
|
|
|
{
|
|
|
int i,j;
|
|
|
TileIndex tile;
|
|
|
uint32 r;
|
|
|
int dir;
|
|
|
uint h;
|
|
|
|
|
|
if (_opt.landscape == LT_CANDY)
|
|
|
return;
|