# unmovable_map.h File Reference

`#include "core/bitmath_func.hpp"`
`#include "tile_map.h"`

Go to the source code of this file.

## Enumerations
enum | { HQ_NUM_TILE = 4, HQ_NUM_SIZE = 5 }
enum | UnmovableType { UNMOVABLE_TRANSMITTER = 0, UNMOVABLE_LIGHTHOUSE = 1, UNMOVABLE_STATUE = 2, UNMOVABLE_OWNED_LAND = 3, UNMOVABLE_HQ_NORTH = 0x80, UNMOVABLE_HQ_WEST = 0x81, UNMOVABLE_HQ_EAST = 0x82, UNMOVABLE_HQ_SOUTH = 0x83, UNMOVABLE_HQ_END = UNMOVABLE_HQ_NORTH + HQ_NUM_SIZE * HQ_NUM_TILE }
| Types of unmovable structure. More...
## Functions
static UnmovableType | GetUnmovableType (TileIndex t)
| Gets the UnmovableType of the given unmovable tile.
static bool | IsTransmitterTile (TileIndex t)
| Does the given tile have a transmitter?
static bool | IsOwnedLand (TileIndex t)
| Is this unmovable tile an 'owned land' tile?
static bool | IsOwnedLandTile (TileIndex t)
| Is the given tile (pre-)owned by someone (the little flags)?
static bool | IsCompanyHQ (TileIndex t)
| Is this unmovable tile a HQ tile?
static bool | IsStatue (TileIndex t)
| Is this unmovable tile a statue?
static bool | IsStatueTile (TileIndex t)
| Is the given tile a statue?
static TownID | GetStatueTownID (TileIndex t)
| Get the town of the given statue tile.
static byte | GetCompanyHQSize (TileIndex t)
| Get the 'stage' of the HQ.
static byte | GetCompanyHQSection (TileIndex t)
| Get the 'section' (including stage) of the HQ.
static void | EnlargeCompanyHQ (TileIndex t, byte size)
| Enlarge the given HQ to the given size.
static void | MakeUnmovable (TileIndex t, UnmovableType u, Owner o)
| Make an Unmovable tile.
static void | MakeTransmitter (TileIndex t)
| Make a transmitter tile.
static void | MakeLighthouse (TileIndex t)
| Make a lighthouse tile.
static void | MakeStatue (TileIndex t, Owner o, TownID town_id)
| Make a statue tile.
static void | MakeOwnedLand (TileIndex t, Owner o)
| Make an 'owned land' tile.
static void | MakeCompanyHQ (TileIndex t, Owner o)
| Make an HQ with the give tile as it's northern tile.

## Detailed Description

Definition in file unmovable_map.h.

## Enumeration Type Documentation

anonymous enum

Enumerator:

  HQ_NUM_TILE | Number of HQ tiles.
  HQ_NUM_SIZE | Number of stages of an HQ.

Definition at line 11 of file unmovable_map.h.

enum UnmovableType

Types of unmovable structure.

Enumerator:

  UNMOVABLE_TRANSMITTER | The large antenna.
  UNMOVABLE_LIGHTHOUSE | The nice lighthouse.
  UNMOVABLE_STATUE | Statue in towns.
  UNMOVABLE_OWNED_LAND | Owned land 'flag'.
  UNMOVABLE_HQ_NORTH | Offset for the northern HQ tile.
  UNMOVABLE_HQ_WEST | Offset for the western HQ tile.
  UNMOVABLE_HQ_EAST | Offset for the eastern HQ tile.
  UNMOVABLE_HQ_SOUTH | Offset for the southern HQ tile.
  UNMOVABLE_HQ_END | End of the HQ (rather end + 1 for IsInside).

Definition at line 17 of file unmovable_map.h.

## Function Documentation

static void EnlargeCompanyHQ | ( | TileIndex | t,
|  | byte | size |
| ) |  |  | `[inline, static]`

Enlarge the given HQ to the given size.

If the new size is larger than the current size, nothing happens.

Parameters:

  | t | the tile of the HQ.
  | size | the new size of the HQ.

Precondition:
  t is the northern tile of the HQ

Definition at line 154 of file unmovable_map.h.

References _m, GB(), GetCompanyHQSection(), Tile::m5, TileDiffXY(), UNMOVABLE_HQ_EAST, UNMOVABLE_HQ_NORTH, UNMOVABLE_HQ_SOUTH, and UNMOVABLE_HQ_WEST.

static byte GetCompanyHQSection | ( | TileIndex | t | ) | `[inline, static]`

Get the 'section' (including stage) of the HQ.

Parameters:

  | t | a tile of the HQ.

Precondition:
  IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t)

Returns:
  the 'section' of the HQ.

Definition at line 141 of file unmovable_map.h.

References _m, GB(), IsCompanyHQ(), IsTileType(), and MP_UNMOVABLE.

Referenced by EnlargeCompanyHQ().

static byte GetCompanyHQSize | ( | TileIndex | t | ) | `[inline, static]`

Get the 'stage' of the HQ.

Parameters:

  | t | a tile of the HQ.

Precondition:
  IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t)

Returns:
  the 'stage' of the HQ.

Definition at line 129 of file unmovable_map.h.

References _m, GB(), IsCompanyHQ(), IsTileType(), and MP_UNMOVABLE.

static TownID GetStatueTownID | ( | TileIndex | t | ) | `[inline, static]`

Get the town of the given statue tile.

Parameters:

  | t | the tile of the statue.

Precondition:
  IsStatueTile(t)

Returns:
  the town the given statue is in.

Definition at line 117 of file unmovable_map.h.

References _m, IsStatueTile(), and Tile::m2.

static UnmovableType GetUnmovableType | ( | TileIndex | t | ) | `[inline, static]`

Gets the UnmovableType of the given unmovable tile.

Parameters:

  | t | the tile to get the type from.

Precondition:
  IsTileType(t, MP_UNMOVABLE)

Returns:
  the type.

Definition at line 39 of file unmovable_map.h.

References _m, IsTileType(), Tile::m5, and MP_UNMOVABLE.

Referenced by IsCompanyHQ(), IsOwnedLand(), IsStatue(), and IsTransmitterTile().

static bool IsCompanyHQ | ( | TileIndex | t | ) | `[inline, static]`

Is this unmovable tile a HQ tile?

Parameters:

  | t | the tile to inspect.

Precondition:
  IsTileType(t, MP_UNMOVABLE)

Returns:
  true if and only if the tile is a HQ tile.

Definition at line 83 of file unmovable_map.h.

References GetUnmovableType(), IsInsideMM(), IsTileType(), MP_UNMOVABLE, UNMOVABLE_HQ_END, and UNMOVABLE_HQ_NORTH.

Referenced by GetCompanyHQSection(), and GetCompanyHQSize().

static bool IsOwnedLand | ( | TileIndex | t | ) | `[inline, static]`

Is this unmovable tile an 'owned land' tile?

Parameters:

  | t | the tile to inspect.

Precondition:
  IsTileType(t, MP_UNMOVABLE)

Returns:
  true if and only if the tile is an 'owned land' tile.

Definition at line 61 of file unmovable_map.h.

References GetUnmovableType(), IsTileType(), MP_UNMOVABLE, and UNMOVABLE_OWNED_LAND.

Referenced by CmdBuildBridge(), and IsOwnedLandTile().

static bool IsOwnedLandTile | ( | TileIndex | t | ) | `[inline, static]`

Is the given tile (pre-)owned by someone (the little flags)?

Parameters:

  | t | the tile to inspect.

Returns:
  true if and only if the tile is an 'owned land' tile.

Definition at line 72 of file unmovable_map.h.

References IsOwnedLand(), IsTileType(), and MP_UNMOVABLE.

Referenced by CmdPurchaseLandArea(), and CmdSellLandArea().

static bool IsStatue | ( | TileIndex | t | ) | `[inline, static]`

Is this unmovable tile a statue?

Parameters:

  | t | the tile to inspect.

Precondition:
  IsTileType(t, MP_UNMOVABLE)

Returns:
  true if and only if the tile is a statue.

Definition at line 95 of file unmovable_map.h.

References GetUnmovableType(), IsTileType(), MP_UNMOVABLE, and UNMOVABLE_STATUE.

Referenced by IsStatueTile().

static bool IsStatueTile | ( | TileIndex | t | ) | `[inline, static]`

Is the given tile a statue?

Parameters:

  | t | the tile to inspect.

Returns:
  true if and only if the tile is a statue.

Definition at line 106 of file unmovable_map.h.

References IsStatue(), IsTileType(), and MP_UNMOVABLE.

Referenced by GetStatueTownID().

static bool IsTransmitterTile | ( | TileIndex | t | ) | `[inline, static]`

Does the given tile have a transmitter?

Parameters:

  | t | the tile to inspect.

Returns:
  true if and only if the tile has a transmitter.

Definition at line 50 of file unmovable_map.h.

References GetUnmovableType(), IsTileType(), MP_UNMOVABLE, and UNMOVABLE_TRANSMITTER.

static void MakeCompanyHQ | ( | TileIndex | t,
|  | Owner | o |
| ) |  |  | `[inline, static]`

Make an HQ with the give tile as it's northern tile.

Parameters:

  | t | the tile to make the northern tile of a HQ.
  | o | the owner of the HQ.

Definition at line 231 of file unmovable_map.h.

References MakeUnmovable(), TileDiffXY(), UNMOVABLE_HQ_EAST, UNMOVABLE_HQ_NORTH, UNMOVABLE_HQ_SOUTH, and UNMOVABLE_HQ_WEST.

Referenced by CmdBuildCompanyHQ().

static void MakeLighthouse | ( | TileIndex | t | ) | `[inline, static]`

Make a lighthouse tile.

Parameters:

  | t | the tile to make a transmitter.

Definition at line 199 of file unmovable_map.h.

References MakeUnmovable(), OWNER_NONE, and UNMOVABLE_LIGHTHOUSE.

static void MakeOwnedLand | ( | TileIndex | t,
|  | Owner | o |
| ) |  |  | `[inline, static]`

Make an 'owned land' tile.

Parameters:

  | t | the tile to make an 'owned land' tile.
  | o | the owner of the land.

Definition at line 221 of file unmovable_map.h.

References MakeUnmovable(), and UNMOVABLE_OWNED_LAND.

Referenced by CmdPurchaseLandArea().

static void MakeStatue | ( | TileIndex | t,
|  | Owner | o,
|  | TownID | town_id |
| ) |  |  | `[inline, static]`

Make a statue tile.

Parameters:

  | t | the tile to make a statue.
  | o | the owner of the statue.
  | town_id | the town the statue was built in.

Definition at line 210 of file unmovable_map.h.

References _m, Tile::m2, MakeUnmovable(), and UNMOVABLE_STATUE.

static void MakeTransmitter | ( | TileIndex | t | ) | `[inline, static]`

Make a transmitter tile.

Parameters:

  | t | the tile to make a transmitter.

Definition at line 190 of file unmovable_map.h.

References MakeUnmovable(), OWNER_NONE, and UNMOVABLE_TRANSMITTER.

static void MakeUnmovable | ( | TileIndex | t,
|  | UnmovableType | u,
|  | Owner | o |
| ) |  |  | `[inline, static]`

Make an Unmovable tile.

Note:
  do not use this function directly. Use one of the other Make* functions.

Parameters:

  | t | the tile to make unmovable.
  | u | the unmovable type of the tile.
  | o | the new owner of the tile.

Definition at line 175 of file unmovable_map.h.

References _m, Tile::m2, Tile::m3, Tile::m4, Tile::m5, MP_UNMOVABLE, SetTileOwner(), and SetTileType().

Referenced by MakeCompanyHQ(), MakeLighthouse(), MakeOwnedLand(), MakeStatue(), and MakeTransmitter().