OpenTTD Source: src/house.h File Reference

OpenTTD Source 15.0-RC2

Data Structures | Typedefs | Enumerations | Functions | Variables
house.h File Reference

definition of HouseSpec and accessors More...

`#include "cargo_type.h"`
`#include "timer/timer_game_calendar.h"`
`#include "house_type.h"`
`#include "newgrf_animation_type.h"`
`#include "newgrf_badge_type.h"`
`#include "newgrf_callbacks.h"`
`#include "newgrf_commons.h"`

Go to the source code of this file.

## Data Structures
struct | HouseSpec

## Typedefs
using | BuildingFlags = EnumBitSet< BuildingFlag, uint8_t >
using | HouseZones = EnumBitSet< HouseZone, uint16_t >
using | HouseExtraFlags = EnumBitSet< HouseExtraFlag, uint8_t >

## Enumerations
enum class | BuildingFlag : uint8_t { Size1x1 = 0 , NotSloped = 1 , Size2x1 = 2 , Size1x2 = 3 , Size2x2 = 4 , IsAnimated = 5 , IsChurch = 6 , IsStadium = 7 }
enum class | HouseZone : uint8_t { TownEdge = 0 , TownOutskirt = 1 , TownOuterSuburb = 2 , TownInnerSuburb = 3 , TownCentre = 4 , TownEnd , ClimateSubarcticAboveSnow = 11 , ClimateTemperate = 12 , ClimateSubarcticBelowSnow = 13 , ClimateSubtropic = 14 , ClimateToyland = 15 }
enum class | HouseExtraFlag : uint8_t { BuildingIsHistorical = 0 , BuildingIsProtected = 1 , SynchronisedCallback1B = 2 , Callback1ARandomBits = 3 }

## Functions
HouseID | GetTranslatedHouseID (HouseID hid)
| Do HouseID translation for NewGRFs.
void | ShowBuildHousePicker (struct Window *)
HouseZones | GetClimateMaskForLandscape ()
| Get the HouseZones climate mask for the current landscape type.

## Variables
static const uint8_t | TOWN_HOUSE_COMPLETED = 3
| Simple value that indicates the house has reached the final stage of construction.
static const uint | HOUSE_NO_CLASS = 0
static const HouseID | NEW_HOUSE_OFFSET = 110
| Offset for new houses.
static const HouseID | NUM_HOUSES = 4096
| Total number of houses.
static const HouseID | INVALID_HOUSE_ID = UINT16_MAX
static const HouseID | NUM_HOUSES_PER_GRF = NUM_HOUSES
| Number of supported houses per NewGRF.
static const uint | HOUSE_NUM_ACCEPTS = 16
| Max number of cargoes accepted by a tile.
static const uint | HOUSE_ORIGINAL_NUM_ACCEPTS = 3
| Original number of accepted cargo types.
static constexpr BuildingFlags | BUILDING_HAS_1_TILE = {BuildingFlag::Size1x1, BuildingFlag::Size2x1, BuildingFlag::Size1x2, BuildingFlag::Size2x2}
static constexpr BuildingFlags | BUILDING_HAS_2_TILES = {BuildingFlag::Size2x1, BuildingFlag::Size1x2, BuildingFlag::Size2x2}
static constexpr BuildingFlags | BUILDING_2_TILES_X = {BuildingFlag::Size2x1, BuildingFlag::Size2x2}
static constexpr BuildingFlags | BUILDING_2_TILES_Y = {BuildingFlag::Size1x2, BuildingFlag::Size2x2}
static constexpr BuildingFlags | BUILDING_HAS_4_TILES = {BuildingFlag::Size2x2}
static constexpr uint | NUM_HOUSE_ZONES = to_underlying(HouseZone::TownEnd)
static constexpr HouseZones | HZ_ZONE_ALL
static constexpr HouseZones | HZ_CLIMATE_ALL

## Detailed Description

definition of HouseSpec and accessors

Definition in file house.h.

## Typedef Documentation

## ◆ BuildingFlags

using BuildingFlags = EnumBitSet<BuildingFlag, uint8_t>

Definition at line 47 of file house.h.

## ◆ HouseExtraFlags

using HouseExtraFlags = EnumBitSet<HouseExtraFlag, uint8_t>

Definition at line 96 of file house.h.

## ◆ HouseZones

using HouseZones = EnumBitSet<HouseZone, uint16_t>

Definition at line 69 of file house.h.

## Enumeration Type Documentation

## ◆ BuildingFlag

enum class BuildingFlag : uint8_t
| strong

Definition at line 37 of file house.h.

## ◆ HouseExtraFlag

enum class HouseExtraFlag : uint8_t
| strong

Enumerator
BuildingIsHistorical | this house will only appear during town generation in random games, thus the historical
BuildingIsProtected | towns and AI will not remove this house, while human players will be able to
SynchronisedCallback1B | synchronized callback 1B will be performed, on multi tile houses
Callback1ARandomBits | callback 1A needs random bits

Definition at line 90 of file house.h.

## ◆ HouseZone

enum class HouseZone : uint8_t
| strong

Enumerator
ClimateSubarcticAboveSnow | Building can appear in sub-arctic climate above the snow line.
ClimateTemperate | Building can appear in temperate climate.
ClimateSubarcticBelowSnow | Building can appear in sub-arctic climate below the snow line.
ClimateSubtropic | Building can appear in subtropical climate.
ClimateToyland | Building can appear in toyland climate.

Definition at line 55 of file house.h.

## Function Documentation

## ◆ GetClimateMaskForLandscape()

HouseZones GetClimateMaskForLandscape | ( |  | ) |

Get the HouseZones climate mask for the current landscape type.

Returns
  HouseZones climate mask.

Definition at line 2357 of file town_cmd.cpp.

References _settings_game, ClimateSubarcticAboveSnow, ClimateSubarcticBelowSnow, ClimateSubtropic, ClimateTemperate, ClimateToyland, GameSettings::game_creation, and GameCreationSettings::landscape.

Referenced by FinaliseHouseArray(), IndustryCargoesWindow::HousesCanAccept(), and HousePickerCallbacks::SetClimateMask().

## ◆ GetTranslatedHouseID()

HouseID GetTranslatedHouseID | ( | HouseID | hid | ) |
| inline

Do HouseID translation for NewGRFs.

Parameters

  hid | the HouseID to get the override for.

Returns
  the HouseID to actually work with.

Definition at line 140 of file house.h.

References HouseSpec::Get(), HouseSpec::grf_prop, and SubstituteGRFFileProps::override_id.

Referenced by GetHouseType().

## ◆ ShowBuildHousePicker()

void ShowBuildHousePicker | ( | struct Window * | parent | ) |

Definition at line 1848 of file town_gui.cpp.

## Variable Documentation

## ◆ BUILDING_2_TILES_X

constexpr BuildingFlags BUILDING_2_TILES_X = {BuildingFlag::Size2x1, BuildingFlag::Size2x2}
| staticconstexpr

Definition at line 51 of file house.h.

## ◆ BUILDING_2_TILES_Y

constexpr BuildingFlags BUILDING_2_TILES_Y = {BuildingFlag::Size1x2, BuildingFlag::Size2x2}
| staticconstexpr

Definition at line 52 of file house.h.

## ◆ BUILDING_HAS_1_TILE

constexpr BuildingFlags BUILDING_HAS_1_TILE = {BuildingFlag::Size1x1, BuildingFlag::Size2x1, BuildingFlag::Size1x2, BuildingFlag::Size2x2}
| staticconstexpr

Definition at line 49 of file house.h.

## ◆ BUILDING_HAS_2_TILES

constexpr BuildingFlags BUILDING_HAS_2_TILES = {BuildingFlag::Size2x1, BuildingFlag::Size1x2, BuildingFlag::Size2x2}
| staticconstexpr

Definition at line 50 of file house.h.

## ◆ BUILDING_HAS_4_TILES

constexpr BuildingFlags BUILDING_HAS_4_TILES = {BuildingFlag::Size2x2}
| staticconstexpr

Definition at line 53 of file house.h.

## ◆ HOUSE_NO_CLASS

const uint HOUSE_NO_CLASS = 0
| static

Definition at line 27 of file house.h.

## ◆ HOUSE_NUM_ACCEPTS

const uint HOUSE_NUM_ACCEPTS = 16
| static

Max number of cargoes accepted by a tile.

Definition at line 34 of file house.h.

## ◆ HOUSE_ORIGINAL_NUM_ACCEPTS

const uint HOUSE_ORIGINAL_NUM_ACCEPTS = 3
| static

Original number of accepted cargo types.

Definition at line 35 of file house.h.

Referenced by TownHouseChangeInfo().

## ◆ HZ_CLIMATE_ALL

constexpr HouseZones HZ_CLIMATE_ALL
| staticconstexpr

Initial value:
= {
HouseZone::ClimateSubarcticAboveSnow,
HouseZone::ClimateTemperate,
HouseZone::ClimateSubarcticBelowSnow,
HouseZone::ClimateSubtropic,
HouseZone::ClimateToyland,
}
HouseZone::ClimateSubarcticAboveSnow
@ ClimateSubarcticAboveSnow
Building can appear in sub-arctic climate above the snow line.
HouseZone::ClimateSubarcticBelowSnow
@ ClimateSubarcticBelowSnow
Building can appear in sub-arctic climate below the snow line.
HouseZone::ClimateTemperate
@ ClimateTemperate
Building can appear in temperate climate.
HouseZone::ClimateToyland
@ ClimateToyland
Building can appear in toyland climate.
HouseZone::ClimateSubtropic
@ ClimateSubtropic
Building can appear in subtropical climate.

Definition at line 82 of file house.h.

## ◆ HZ_ZONE_ALL

constexpr HouseZones HZ_ZONE_ALL
| staticconstexpr

Initial value:
= {
HouseZone::TownEdge,
HouseZone::TownOutskirt,
HouseZone::TownOuterSuburb,
HouseZone::TownInnerSuburb,
HouseZone::TownCentre,
}

Definition at line 74 of file house.h.

## ◆ INVALID_HOUSE_ID

const HouseID INVALID_HOUSE_ID = UINT16_MAX
| static

Definition at line 30 of file house.h.

## ◆ NEW_HOUSE_OFFSET

const HouseID NEW_HOUSE_OFFSET = 110
| static

Offset for new houses.

Definition at line 28 of file house.h.

Referenced by AfterLoadGame(), AnimateTile_Town(), DrawHouseInGUI(), DrawTile_Town(), GetFoundation_Town(), HouseScopeResolver::GetVariable(), TileLoop_Town(), TownHouseChangeInfo(), and UpdateHousesAndTowns().

## ◆ NUM_HOUSE_ZONES

constexpr uint NUM_HOUSE_ZONES = to_underlying(HouseZone::TownEnd)
| staticconstexpr

Definition at line 71 of file house.h.

## ◆ NUM_HOUSES

const HouseID NUM_HOUSES = 4096
| static

Total number of houses.

Definition at line 29 of file house.h.

Referenced by FinaliseHouseArray(), and HouseSpec::Get().

## ◆ NUM_HOUSES_PER_GRF

const HouseID NUM_HOUSES_PER_GRF = NUM_HOUSES
| static

Number of supported houses per NewGRF.

Definition at line 32 of file house.h.

Referenced by TownHouseChangeInfo().

## ◆ TOWN_HOUSE_COMPLETED

const uint8_t TOWN_HOUSE_COMPLETED = 3
| static

Simple value that indicates the house has reached the final stage of construction.

Definition at line 25 of file house.h.

Referenced by AfterLoadGame(), BuildTownHouse(), DrawHouseInGUI(), DrawNewHouseTileInGUI(), GetHouseBuildingStage(), HouseScopeResolver::GetVariable(), IncHouseConstructionTick(), and MakeHouseTile().