# unmovable_map.h File Reference

Map accessors for unmovable tiles. More...

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

Go to the source code of this file.

## Enumerations

enum | UnmovableType { UNMOVABLE_TRANSMITTER = 0, UNMOVABLE_LIGHTHOUSE = 1, UNMOVABLE_STATUE = 2, UNMOVABLE_OWNED_LAND = 3, UNMOVABLE_HQ = 4, UNMOVABLE_MAX }
| 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 void | SetCompanyHQSize (TileIndex t, uint8 size)
| Set the 'stage' of the HQ.
static byte | GetCompanyHQSection (TileIndex t)
| Get the 'section' of the HQ.
static void | SetCompanyHQSection (TileIndex t, uint8 section)
| Set the 'section' 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 | MakeUnmovableHQHelper (TileIndex t, uint8 section, Owner o)
| Make a HeadQuarter tile after making it an Unmovable.
static void | MakeCompanyHQ (TileIndex t, Owner o)
| Make an HQ with the give tile as it's northern tile.

## Detailed Description

Map accessors for unmovable tiles.

Definition in file unmovable_map.h.

## Enumeration Type Documentation

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 | HeadQuarter of a player.

Definition at line 12 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 167 of file unmovable_map.h.

References GetCompanyHQSection(), GetCompanyHQSize(), SetCompanyHQSize(), and TileDiffXY().

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

Get the 'section' of the HQ.

The scetion is in fact which side of teh HQ the tile represent

Parameters:

  | t | a tile of the HQ.

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

Returns:
  the 'section' of the HQ.

Definition at line 142 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 117 of file unmovable_map.h.

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

Referenced by EnlargeCompanyHQ().

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 105 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 27 of file unmovable_map.h.

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

Referenced by 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 71 of file unmovable_map.h.

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

Referenced by GetCompanyHQSection(), GetCompanyHQSize(), SetCompanyHQSection(), and SetCompanyHQSize().

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 49 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 60 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 83 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 94 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 38 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 257 of file unmovable_map.h.

References MakeUnmovableHQHelper(), and TileDiffXY().

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 213 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 235 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 224 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 204 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 187 of file unmovable_map.h.

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

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

static void MakeUnmovableHQHelper | ( | TileIndex | t,
|  | uint8 | section,
|  | Owner | o |
| ) |  |  | `[inline, static]`

Make a HeadQuarter tile after making it an Unmovable.

Parameters:

  | t | the tile to make an HQ.
  | section | the part of the HQ this one will be.
  | o | the new owner of the tile.

Definition at line 246 of file unmovable_map.h.

References MakeUnmovable(), SetCompanyHQSection(), and UNMOVABLE_HQ.

Referenced by MakeCompanyHQ().

static void SetCompanyHQSection | ( | TileIndex | t,
|  | uint8 | section |
| ) |  |  | `[inline, static]`

Set the 'section' of the HQ.

Parameters:

  | t | a tile of the HQ. param section to be set.

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

Definition at line 154 of file unmovable_map.h.

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

Referenced by MakeUnmovableHQHelper().

static void SetCompanyHQSize | ( | TileIndex | t,
|  | uint8 | size |
| ) |  |  | `[inline, static]`

Set the 'stage' of the HQ.

Parameters:

  | t | a tile of the HQ.
  | size | the actual stage of the HQ

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

Definition at line 129 of file unmovable_map.h.

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

Referenced by EnlargeCompanyHQ().