OpenTTD Source 20241224-master-gf74b0cf984
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_commons.h"

Go to the source code of this file.

Data Structures

struct  HouseSpec
 

Enumerations

enum  BuildingFlags : uint8_t {
  TILE_NO_FLAG = 0 , TILE_SIZE_1x1 = 1U << 0 , TILE_NOT_SLOPED = 1U << 1 , TILE_SIZE_2x1 = 1U << 2 ,
  TILE_SIZE_1x2 = 1U << 3 , TILE_SIZE_2x2 = 1U << 4 , BUILDING_IS_ANIMATED = 1U << 5 , BUILDING_IS_CHURCH = 1U << 6 ,
  BUILDING_IS_STADIUM = 1U << 7 , BUILDING_HAS_1_TILE = TILE_SIZE_1x1 | TILE_SIZE_2x1 | TILE_SIZE_1x2 | TILE_SIZE_2x2 , BUILDING_HAS_2_TILES = TILE_SIZE_2x1 | TILE_SIZE_1x2 | TILE_SIZE_2x2 , BUILDING_2_TILES_X = TILE_SIZE_2x1 | TILE_SIZE_2x2 ,
  BUILDING_2_TILES_Y = TILE_SIZE_1x2 | TILE_SIZE_2x2 , BUILDING_HAS_4_TILES = TILE_SIZE_2x2
}
 
enum  HouseZonesBits : uint8_t {
  HZB_BEGIN = 0 , HZB_TOWN_EDGE = 0 , HZB_TOWN_OUTSKIRT , HZB_TOWN_OUTER_SUBURB ,
  HZB_TOWN_INNER_SUBURB , HZB_TOWN_CENTRE , HZB_END
}
 
enum  HouseZones : uint16_t {
  HZ_NOZNS = 0x0000 , HZ_ZON1 = 1U << HZB_TOWN_EDGE , HZ_ZON2 = 1U << HZB_TOWN_OUTSKIRT , HZ_ZON3 = 1U << HZB_TOWN_OUTER_SUBURB ,
  HZ_ZON4 = 1U << HZB_TOWN_INNER_SUBURB , HZ_ZON5 = 1U << HZB_TOWN_CENTRE , HZ_ZONALL = 0x001F , HZ_SUBARTC_ABOVE = 0x0800 ,
  HZ_TEMP = 0x1000 , HZ_SUBARTC_BELOW = 0x2000 , HZ_SUBTROPIC = 0x4000 , HZ_TOYLND = 0x8000 ,
  HZ_CLIMALL = 0xF800
}
 
enum  HouseExtraFlags : uint8_t {
  NO_EXTRA_FLAG = 0 , BUILDING_IS_HISTORICAL = 1U << 0 , BUILDING_IS_PROTECTED = 1U << 1 , SYNCHRONISED_CALLBACK_1B = 1U << 2 ,
  CALLBACK_1A_RANDOM_BITS = 1U << 3
}
 

Functions

HouseID GetTranslatedHouseID (HouseID hid)
 Do HouseID translation for NewGRFs.
 
void ShowBuildHousePicker (struct Window *)
 

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.
 

Detailed Description

definition of HouseSpec and accessors

Definition in file house.h.

Enumeration Type Documentation

◆ BuildingFlags

enum BuildingFlags : uint8_t

Definition at line 35 of file house.h.

◆ HouseExtraFlags

enum HouseExtraFlags : uint8_t
Enumerator
BUILDING_IS_HISTORICAL 

this house will only appear during town generation in random games, thus the historical

BUILDING_IS_PROTECTED 

towns and AI will not remove this house, while human players will be able to

SYNCHRONISED_CALLBACK_1B 

synchronized callback 1B will be performed, on multi tile houses

CALLBACK_1A_RANDOM_BITS 

callback 1A needs random bits

Definition at line 83 of file house.h.

◆ HouseZones

enum HouseZones : uint16_t
Enumerator
HZ_NOZNS 

0 This is just to get rid of zeros, meaning none

HZ_ZON1 

0..4 1,2,4,8,10 which town zones the building can be built in, Zone1 been the further suburb

HZ_ZON5 

center of town

HZ_ZONALL 

1F This is just to englobe all above types at once

HZ_SUBARTC_ABOVE 

11 800 can appear in sub-arctic climate above the snow line

HZ_TEMP 

12 1000 can appear in temperate climate

HZ_SUBARTC_BELOW 

13 2000 can appear in sub-arctic climate below the snow line

HZ_SUBTROPIC 

14 4000 can appear in subtropical climate

HZ_TOYLND 

15 8000 can appear in toyland climate

HZ_CLIMALL 

Bitmask of all climate bits.

Definition at line 66 of file house.h.

◆ HouseZonesBits

enum HouseZonesBits : uint8_t

Definition at line 53 of file house.h.

Function Documentation

◆ GetTranslatedHouseID()

HouseID GetTranslatedHouseID ( HouseID  hid)
inline

Do HouseID translation for NewGRFs.

Parameters
hidthe HouseID to get the override for.
Returns
the HouseID to actually work with.

Definition at line 134 of file house.h.

References HouseSpec::Get(), HouseSpec::grf_prop, and GRFFileProps::override.

Referenced by GetHouseType().

◆ ShowBuildHousePicker()

void ShowBuildHousePicker ( struct Window parent)

Definition at line 1787 of file town_gui.cpp.

Variable Documentation

◆ HOUSE_NO_CLASS

const uint HOUSE_NO_CLASS = 0
static

Definition at line 25 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 32 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 33 of file house.h.

Referenced by TownHouseChangeInfo().

◆ INVALID_HOUSE_ID

const HouseID INVALID_HOUSE_ID = UINT16_MAX
static

Definition at line 28 of file house.h.

◆ NEW_HOUSE_OFFSET

◆ NUM_HOUSES

const HouseID NUM_HOUSES = 4096
static

Total number of houses.

Definition at line 27 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 30 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 23 of file house.h.

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