OpenTTD Source 20241224-master-gf74b0cf984
|
Functions related to NewGRF houses. More...
#include "newgrf_callbacks.h"
#include "tile_cmd.h"
#include "house_type.h"
#include "newgrf_spritegroup.h"
#include "newgrf_town.h"
Go to the source code of this file.
Data Structures | |
struct | HouseScopeResolver |
Scope resolver for houses. More... | |
struct | HouseResolverObject |
Resolver object to be used for houses (feature 07 spritegroups). More... | |
struct | HouseClassMapping |
Makes class IDs unique to each GRF file. More... | |
Enumerations | |
enum | HouseTrigger { HOUSE_TRIGGER_TILE_LOOP = 0x01 , HOUSE_TRIGGER_TILE_LOOP_TOP = 0x02 } |
Functions | |
void | ResetHouseClassIDs () |
HouseClassID | AllocateHouseClassID (uint8_t grf_class_id, uint32_t grfid) |
void | InitializeBuildingCounts () |
Initialise global building counts and all town building counts. | |
void | InitializeBuildingCounts (Town *t) |
Initialise building counts for a town. | |
void | IncreaseBuildingCount (Town *t, HouseID house_id) |
IncreaseBuildingCount() Increase the count of a building when it has been added by a town. | |
void | DecreaseBuildingCount (Town *t, HouseID house_id) |
DecreaseBuildingCount() Decrease the number of a building when it is deleted. | |
std::span< const uint > | GetBuildingHouseIDCounts () |
Get read-only span of total HouseID building counts. | |
void | DrawNewHouseTile (TileInfo *ti, HouseID house_id) |
void | AnimateNewHouseTile (TileIndex tile) |
void | AnimateNewHouseConstruction (TileIndex tile) |
uint16_t | GetHouseCallback (CallbackID callback, uint32_t param1, uint32_t param2, HouseID house_id, Town *town, TileIndex tile, bool not_yet_constructed=false, uint8_t initial_random_bits=0, CargoTypes watched_cargo_triggers=0, int view=0) |
void | WatchedCargoCallback (TileIndex tile, CargoTypes trigger_cargoes) |
Run watched cargo accepted callback for a house. | |
bool | CanDeleteHouse (TileIndex tile) |
bool | NewHouseTileLoop (TileIndex tile) |
void | TriggerHouse (TileIndex t, HouseTrigger trigger) |
Functions related to NewGRF houses.
Definition in file newgrf_house.h.
enum HouseTrigger |
Definition at line 112 of file newgrf_house.h.
HouseClassID AllocateHouseClassID | ( | uint8_t | grf_class_id, |
uint32_t | grfid | ||
) |
Definition at line 137 of file newgrf_house.cpp.
void AnimateNewHouseConstruction | ( | TileIndex | tile | ) |
Definition at line 602 of file newgrf_house.cpp.
void AnimateNewHouseTile | ( | TileIndex | tile | ) |
Definition at line 594 of file newgrf_house.cpp.
bool CanDeleteHouse | ( | TileIndex | tile | ) |
Definition at line 611 of file newgrf_house.cpp.
DecreaseBuildingCount() Decrease the number of a building when it is deleted.
t | The town that the building was built in |
house_id | The id of the house being removed |
Definition at line 209 of file newgrf_house.cpp.
References TownCache::building_counts, Town::cache, HouseSpec::class_id, and HouseSpec::Get().
Referenced by DoClearTownHouseHelper().
Definition at line 553 of file newgrf_house.cpp.
std::span< const uint > GetBuildingHouseIDCounts | ( | ) |
Get read-only span of total HouseID building counts.
Definition at line 179 of file newgrf_house.cpp.
Referenced by HousePickerCallbacks::FillUsedItems().
uint16_t GetHouseCallback | ( | CallbackID | callback, |
uint32_t | param1, | ||
uint32_t | param2, | ||
HouseID | house_id, | ||
Town * | town, | ||
TileIndex | tile, | ||
bool | not_yet_constructed = false , |
||
uint8_t | initial_random_bits = 0 , |
||
CargoTypes | watched_cargo_triggers = 0 , |
||
int | view = 0 |
||
) |
Definition at line 518 of file newgrf_house.cpp.
IncreaseBuildingCount() Increase the count of a building when it has been added by a town.
t | The town that the building is being built in |
house_id | The id of the house being added |
Definition at line 190 of file newgrf_house.cpp.
References TownCache::building_counts, Town::cache, HouseSpec::class_id, and HouseSpec::Get().
Referenced by ClearMakeHouseTile(), and RebuildTownCaches().
void InitializeBuildingCounts | ( | ) |
Initialise global building counts and all town building counts.
Definition at line 163 of file newgrf_house.cpp.
References InitializeBuildingCounts(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_town_pool >::Iterate(), and HouseSpec::Specs().
Referenced by DoCreateTown(), GenerateWorld(), InitializeBuildingCounts(), and RebuildTownCaches().
void InitializeBuildingCounts | ( | Town * | t | ) |
Initialise building counts for a town.
t | Town cache to initialise. |
Definition at line 152 of file newgrf_house.cpp.
References TownCache::building_counts, Town::cache, and HouseSpec::Specs().
bool NewHouseTileLoop | ( | TileIndex | tile | ) |
Definition at line 639 of file newgrf_house.cpp.
void ResetHouseClassIDs | ( | ) |
Definition at line 129 of file newgrf_house.cpp.
void TriggerHouse | ( | TileIndex | t, |
HouseTrigger | trigger | ||
) |
Definition at line 729 of file newgrf_house.cpp.
void WatchedCargoCallback | ( | TileIndex | tile, |
CargoTypes | trigger_cargoes | ||
) |
Run watched cargo accepted callback for a house.
tile | House tile. |
trigger_cargoes | Triggering cargo types. |
Definition at line 754 of file newgrf_house.cpp.
References HouseSpec::building_flags, DoWatchedCargoCallback(), HouseSpec::Get(), GetHouseNorthPart(), GetHouseType(), IsTileType(), MP_HOUSE, TileAddXY(), and HouseSpec::watched_cargoes.
Referenced by TriggerWatchedCargoCallbacks().