OpenTTD Source: HouseSpec Struct Reference

OpenTTD Source 15.3

Public Member Functions | Static Public Member Functions | Data Fields
HouseSpec Struct Reference

## Public Member Functions
HouseID | Index () const
| Gets the index of this spec.
Money | GetRemovalCost () const
| Get the cost for removing this house.

## Static Public Member Functions
static std::vector< HouseSpec > & | Specs ()
| Get a reference to all HouseSpecs.
static HouseSpec * | Get (size_t house_id)
| Get the spec for a house ID.

## Data Fields
TimerGameCalendar::Year | min_year
| introduction year of the house
TimerGameCalendar::Year | max_year
| last year it can be built
uint8_t | population
| population (Zero on other tiles in multi tile house.)
uint8_t | removal_cost
| cost multiplier for removing it
StringID | building_name
| building name
uint16_t | remove_rating_decrease
| rating decrease if removed
uint8_t | mail_generation
| mail generation multiplier (tile based, as the acceptances below)
uint8_t | cargo_acceptance [HOUSE_NUM_ACCEPTS]
| acceptance level for the cargo slots
CargoType | accepts_cargo [HOUSE_NUM_ACCEPTS]
| input cargo slots
BuildingFlags | building_flags
| some flags that describe the house (size, stadium etc...)
HouseZones | building_availability
| where can it be built (climates, zones)
bool | enabled
| the house is available to build (true by default, but can be disabled by newgrf)
SubstituteGRFFileProps | grf_prop
| Properties related the the grf file.
HouseCallbackMasks | callback_mask
| Bitmask of house callbacks that have to be called.
Colours | random_colour [4]
| 4 "random" colours
uint8_t | probability
| Relative probability of appearing (16 is the standard value)
HouseExtraFlags | extra_flags {}
| some more flags
HouseClassID | class_id
| defines the class this house has (not grf file based)
AnimationInfo< void > | animation
| information about the animation.
uint8_t | processing_time
| Periodic refresh multiplier.
uint8_t | minimum_life
| The minimum number of years this house will survive before the town rebuilds it.
CargoTypes | watched_cargoes
| Cargo types watched for acceptance.
std::vector< BadgeID > | badges
CargoLabel | accepts_cargo_label [HOUSE_ORIGINAL_NUM_ACCEPTS]
| input landscape cargo slots

## Detailed Description

Definition at line 98 of file house.h.

## Member Function Documentation

## ◆ Get()

HouseSpec * HouseSpec::Get | ( | size_t | house_id | ) |
| static

Get the spec for a house ID.

Parameters

  house_id | The ID of the house.

Returns
  The HouseSpec associated with the ID.

Definition at line 70 of file newgrf_house.cpp.

References NUM_HOUSES.

Referenced by AdvanceHouseConstruction(), AdvanceSingleHouseConstruction(), AfterLoadGame(), AnimateTile_Town(), ClearMakeHouseTile(), ClearTile_Town(), ClearTownHouse(), CmdPlaceHouse(), DecreaseBuildingCount(), DoTriggerHouseAnimation_WatchedCargoAccepted(), DrawHouseInGUI(), DrawTile_Town(), HousePickerCallbacks::FillUsedItems(), FinaliseHouseArray(), NIHHouse::GetBadges(), HouseResolverObject::GetDebugID(), GetDistanceFromNearbyHouse(), GetFoundation_Town(), NIHHouse::GetGRFID(), GetHouseNorthPart(), GetHouseSpecGrf(), HousePickerCallbacks::GetPickerItem(), NIHHouse::GetSpec(), GetTranslatedHouseID(), HousePickerCallbacks::GetTypeBadges(), HousePickerCallbacks::GetTypeName(), HouseScopeResolver::GetVariable(), HouseResolverObject::HouseResolverObject(), IncreaseBuildingCount(), IsHouseSpecValid(), NIHHouse::IsInspectable(), HousePickerCallbacks::IsTypeAvailable(), MakeHouseTile(), MakeTownHouse(), BuildHouseWindow::OnInvalidateData(), BuildHouseWindow::OnPlaceObject(), RebuildTownCaches(), HouseOverrideManager::SetEntitySpec(), TileLoop_Town(), TownHouseChangeInfo(), TriggerHouseAnimation_TileLoop(), TriggerHouseAnimation_WatchedCargoAccepted(), TryBuildTownHouse(), UpdateHousesAndTowns(), and HousePickerCallbacks::UpdateSavedItems().

## ◆ GetRemovalCost()

Money HouseSpec::GetRemovalCost | ( |  | ) | const

Get the cost for removing this house.

Returns
  The cost adjusted for inflation, etc.

Definition at line 232 of file town_cmd.cpp.

References removal_cost.

Referenced by ClearTile_Town().

## ◆ Index()

HouseID HouseSpec::Index | ( |  | ) | const

Gets the index of this spec.

Returns
  The index.

Definition at line 60 of file newgrf_house.cpp.

Referenced by GetAcceptedCargoOfHouse(), GetHouseName(), GetProducedCargoOfHouse(), BuildHouseWindow::OnPlaceObject(), and TryBuildTownHouse().

## ◆ Specs()

std::vector< HouseSpec > & HouseSpec::Specs | ( |  | ) |
| static

Get a reference to all HouseSpecs.

Returns
  Reference to vector of all HouseSpecs.

Definition at line 51 of file newgrf_house.cpp.

Referenced by CmdPlaceHouse(), CargoesRow::ConnectIndustryAccepted(), EnsureEarlyHouse(), FinaliseHouseArray(), HousePickerCallbacks::GetTypeCount(), IndustryCargoesWindow::HousesCanAccept(), InitializeBuildingCounts(), InitializeBuildingCounts(), HouseOverrideManager::SetEntitySpec(), TryBuildTownHouse(), and HousePickerCallbacks::UpdateSavedItems().

## Field Documentation

## ◆ accepts_cargo

CargoType HouseSpec::accepts_cargo[HOUSE_NUM_ACCEPTS]

input cargo slots

Definition at line 108 of file house.h.

Referenced by AddAcceptedCargoOfHouse(), and FinaliseHouseArray().

## ◆ accepts_cargo_label

CargoLabel HouseSpec::accepts_cargo_label[HOUSE_ORIGINAL_NUM_ACCEPTS]

input landscape cargo slots

Definition at line 126 of file house.h.

Referenced by FinaliseHouseArray().

## ◆ animation

AnimationInfo<void> HouseSpec::animation

information about the animation.

Definition at line 120 of file house.h.

## ◆ badges

std::vector<BadgeID> HouseSpec::badges

Definition at line 124 of file house.h.

## ◆ building_availability

HouseZones HouseSpec::building_availability

where can it be built (climates, zones)

Definition at line 110 of file house.h.

Referenced by HousePickerCallbacks::FillUsedItems(), HousePickerCallbacks::GetTypeName(), IsHouseSpecValid(), TryBuildTownHouse(), and HousePickerCallbacks::UpdateSavedItems().

## ◆ building_flags

BuildingFlags HouseSpec::building_flags

some flags that describe the house (size, stadium etc...)

Definition at line 109 of file house.h.

Referenced by AdvanceHouseConstruction(), BuildTownHouse(), ClearTownHouse(), CmdPlaceHouse(), DrawHouseInGUI(), FinaliseHouseArray(), BuildHouseWindow::GetHouseInformation(), IsHouseSpecValid(), MakeTownHouse(), TileLoop_Town(), TriggerHouseAnimation_WatchedCargoAccepted(), TryBuildTownHouse(), and UpdateHousesAndTowns().

## ◆ building_name

StringID HouseSpec::building_name

building name

Definition at line 104 of file house.h.

Referenced by GetHouseName().

## ◆ callback_mask

HouseCallbackMasks HouseSpec::callback_mask

Bitmask of house callbacks that have to be called.

Definition at line 115 of file house.h.

Referenced by AddAcceptedCargoOfHouse(), DrawNewHouseTileInGUI(), GetFoundation_Town(), GetProducedCargoOfHouse(), TileLoop_Town(), TriggerHouseAnimation_TileLoop(), and TryBuildTownHouse().

## ◆ cargo_acceptance

uint8_t HouseSpec::cargo_acceptance[HOUSE_NUM_ACCEPTS]

acceptance level for the cargo slots

Definition at line 107 of file house.h.

Referenced by AddAcceptedCargoOfHouse(), and FinaliseHouseArray().

## ◆ class_id

HouseClassID HouseSpec::class_id

defines the class this house has (not grf file based)

Definition at line 119 of file house.h.

Referenced by DecreaseBuildingCount(), GetDistanceFromNearbyHouse(), HouseScopeResolver::GetVariable(), IncreaseBuildingCount(), and TryBuildTownHouse().

## ◆ enabled

bool HouseSpec::enabled

the house is available to build (true by default, but can be disabled by newgrf)

Definition at line 111 of file house.h.

Referenced by CmdPlaceHouse(), HousePickerCallbacks::GetTypeName(), IsHouseSpecValid(), HousePickerCallbacks::IsTypeAvailable(), BuildHouseWindow::OnInvalidateData(), TownHouseChangeInfo(), and TryBuildTownHouse().

## ◆ extra_flags

HouseExtraFlags HouseSpec::extra_flags {}

some more flags

Definition at line 118 of file house.h.

Referenced by AfterLoadGame(), BuildTownHouse(), BuildHouseWindow::OnInvalidateData(), TriggerHouseAnimation_TileLoop(), and TryBuildTownHouse().

## ◆ grf_prop

SubstituteGRFFileProps HouseSpec::grf_prop

Properties related the the grf file.

Definition at line 114 of file house.h.

Referenced by AddAcceptedCargoOfHouse(), DrawHouseInGUI(), DrawTile_Town(), HouseResolverObject::GetDebugID(), GetDistanceFromNearbyHouse(), GetFoundation_Town(), NIHHouse::GetGRFID(), GetHouseName(), GetHouseSpecGrf(), GetProducedCargoOfHouse(), GetTranslatedHouseID(), HouseScopeResolver::GetVariable(), HouseResolverObject::HouseResolverObject(), IsHouseSpecValid(), NIHHouse::IsInspectable(), HouseOverrideManager::SetEntitySpec(), TileLoop_Town(), TryBuildTownHouse(), and HousePickerCallbacks::UpdateSavedItems().

## ◆ mail_generation

uint8_t HouseSpec::mail_generation

mail generation multiplier (tile based, as the acceptances below)

Definition at line 106 of file house.h.

Referenced by TileLoop_Town().

## ◆ max_year

TimerGameCalendar::Year HouseSpec::max_year

last year it can be built

Definition at line 101 of file house.h.

Referenced by BuildHouseWindow::GetHouseInformation(), and TryBuildTownHouse().

## ◆ min_year

TimerGameCalendar::Year HouseSpec::min_year

introduction year of the house

Definition at line 100 of file house.h.

Referenced by BuildHouseWindow::GetHouseInformation().

## ◆ minimum_life

uint8_t HouseSpec::minimum_life

The minimum number of years this house will survive before the town rebuilds it.

Definition at line 122 of file house.h.

Referenced by TileLoop_Town().

## ◆ population

uint8_t HouseSpec::population

population (Zero on other tiles in multi tile house.)

Definition at line 102 of file house.h.

Referenced by BuildTownHouse(), ClearTownHouse(), BuildHouseWindow::GetHouseInformation(), IsHouseSpecValid(), RebuildTownCaches(), and TileLoop_Town().

## ◆ probability

uint8_t HouseSpec::probability

Relative probability of appearing (16 is the standard value)

Definition at line 117 of file house.h.

Referenced by TryBuildTownHouse().

## ◆ processing_time

uint8_t HouseSpec::processing_time

Periodic refresh multiplier.

Definition at line 121 of file house.h.

## ◆ random_colour

Colours HouseSpec::random_colour[4]

4 "random" colours

Definition at line 116 of file house.h.

Referenced by DrawNewHouseTileInGUI().

## ◆ removal_cost

uint8_t HouseSpec::removal_cost

cost multiplier for removing it

Definition at line 103 of file house.h.

Referenced by GetRemovalCost().

## ◆ remove_rating_decrease

uint16_t HouseSpec::remove_rating_decrease

rating decrease if removed

Definition at line 105 of file house.h.

Referenced by ClearTile_Town().

## ◆ watched_cargoes

CargoTypes HouseSpec::watched_cargoes

Cargo types watched for acceptance.

Definition at line 123 of file house.h.

Referenced by TriggerHouseAnimation_WatchedCargoAccepted().

The documentation for this struct was generated from the following files:

- src/house.h
- src/newgrf_house.cpp
- src/town_cmd.cpp