OpenTTD Source 20241224-master-gee860a5c8e
HousePickerCallbacks Class Reference
Inheritance diagram for HousePickerCallbacks:
PickerCallbacks

Public Member Functions

void SetClimateMask ()
 Set climate mask for filtering buildings from current landscape.
 
StringID GetClassTooltip () const override
 Get the tooltip string for the class list.
 
StringID GetTypeTooltip () const override
 Get the tooltip string for the type grid.
 
bool IsActive () const override
 Should picker class/type selection be enabled?
 
bool HasClassChoice () const override
 Are there multiple classes to chose from?
 
int GetClassCount () const override
 Get the number of classes.
 
void Close (int data) override
 
int GetSelectedClass () const override
 Get the index of the selected class.
 
void SetSelectedClass (int cls_id) const override
 Set the selected class.
 
StringID GetClassName (int id) const override
 Get the name of a class.
 
int GetTypeCount (int cls_id) const override
 Get the number of types in a class.
 
PickerItem GetPickerItem (int cls_id, int id) const override
 Get data about an item.
 
int GetSelectedType () const override
 Get the selected type.
 
void SetSelectedType (int id) const override
 Set the selected type.
 
StringID GetTypeName (int cls_id, int id) const override
 Get the item of a type.
 
bool IsTypeAvailable (int, int id) const override
 Test if an item is currently buildable.
 
void DrawType (int x, int y, int, int id) const override
 Draw preview image of an item.
 
void FillUsedItems (std::set< PickerItem > &items) override
 Fill a set with all items that are used by the current player.
 
std::set< PickerItemUpdateSavedItems (const std::set< PickerItem > &src) override
 Update link between grfid/localidx and class_index/index in saved items.
 
- Public Member Functions inherited from PickerCallbacks
 PickerCallbacks (const std::string &ini_group)
 

Data Fields

HouseZones climate_mask
 
uint8_t class_mask
 Mask of available 'classes'.
 
- Data Fields inherited from PickerCallbacks
Listing class_last_sorting = { false, 0 }
 Default sorting of PickerClassList.
 
Filtering class_last_filtering = { false, 0 }
 Default filtering of PickerClassList.
 
Listing type_last_sorting = { false, 0 }
 Default sorting of PickerTypeList.
 
Filtering type_last_filtering = { false, 0 }
 Default filtering of PickerTypeList.
 
const std::string ini_group
 Ini Group for saving favourites.
 
uint8_t mode = 0
 Bitmask of PickerFilterModes.
 
std::set< PickerItemused
 Set of items used in the current game by the current company.
 
std::set< PickerItemsaved
 Set of saved favourite items.
 

Static Public Attributes

static int sel_class
 Currently selected 'class'.
 
static int sel_type
 Currently selected HouseID.
 
static int sel_view
 Currently selected 'view'. This is not controllable as its based on random data.
 
static const std::array< StringID, HZB_END > zone_names
 
static HousePickerCallbacks instance
 

Detailed Description

Definition at line 1476 of file town_gui.cpp.

Constructor & Destructor Documentation

◆ HousePickerCallbacks()

HousePickerCallbacks::HousePickerCallbacks ( )
inline

Definition at line 1478 of file town_gui.cpp.

Member Function Documentation

◆ Close()

void HousePickerCallbacks::Close ( int  data)
inlineoverridevirtual

Reimplemented from PickerCallbacks.

Definition at line 1534 of file town_gui.cpp.

◆ DrawType()

void HousePickerCallbacks::DrawType ( int  x,
int  y,
int  cls_id,
int  id 
) const
inlineoverridevirtual

Draw preview image of an item.

Implements PickerCallbacks.

Definition at line 1583 of file town_gui.cpp.

References DrawHouseInGUI(), and sel_view.

◆ FillUsedItems()

void HousePickerCallbacks::FillUsedItems ( std::set< PickerItem > &  items)
inlineoverridevirtual

Fill a set with all items that are used by the current player.

Implements PickerCallbacks.

Definition at line 1588 of file town_gui.cpp.

References HouseSpec::building_availability, FindFirstBit(), HouseSpec::Get(), GetBuildingHouseIDCounts(), and HZ_ZONALL.

◆ GetClassCount()

int HousePickerCallbacks::GetClassCount ( ) const
inlineoverridevirtual

Get the number of classes.

Note
Used only to estimate space requirements.

Implements PickerCallbacks.

Definition at line 1532 of file town_gui.cpp.

Referenced by GetClassName(), GetTypeCount(), and SetClimateMask().

◆ GetClassName()

StringID HousePickerCallbacks::GetClassName ( int  id) const
inlineoverridevirtual

Get the name of a class.

Implements PickerCallbacks.

Definition at line 1539 of file town_gui.cpp.

References GetClassCount(), HasBit(), and INVALID_STRING_ID.

◆ GetClassTooltip()

StringID HousePickerCallbacks::GetClassTooltip ( ) const
inlineoverridevirtual

Get the tooltip string for the class list.

Implements PickerCallbacks.

Definition at line 1527 of file town_gui.cpp.

◆ GetPickerItem()

PickerItem HousePickerCallbacks::GetPickerItem ( int  cls_id,
int  id 
) const
inlineoverridevirtual

Get data about an item.

Implements PickerCallbacks.

Definition at line 1552 of file town_gui.cpp.

References HouseSpec::Get().

◆ GetSelectedClass()

int HousePickerCallbacks::GetSelectedClass ( ) const
inlineoverridevirtual

Get the index of the selected class.

Implements PickerCallbacks.

Definition at line 1536 of file town_gui.cpp.

References sel_class.

◆ GetSelectedType()

int HousePickerCallbacks::GetSelectedType ( ) const
inlineoverridevirtual

Get the selected type.

Implements PickerCallbacks.

Definition at line 1559 of file town_gui.cpp.

References sel_type.

◆ GetTypeCount()

int HousePickerCallbacks::GetTypeCount ( int  cls_id) const
inlineoverridevirtual

Get the number of types in a class.

Note
Used only to estimate space requirements.

Implements PickerCallbacks.

Definition at line 1546 of file town_gui.cpp.

References GetClassCount(), and HouseSpec::Specs().

Referenced by SetClimateMask().

◆ GetTypeName()

StringID HousePickerCallbacks::GetTypeName ( int  cls_id,
int  id 
) const
inlineoverridevirtual

Get the item of a type.

Implements PickerCallbacks.

Definition at line 1562 of file town_gui.cpp.

References HouseSpec::building_availability, HouseSpec::enabled, HouseSpec::Get(), GetHouseName(), HasBit(), and INVALID_STRING_ID.

Referenced by SetClimateMask().

◆ GetTypeTooltip()

StringID HousePickerCallbacks::GetTypeTooltip ( ) const
inlineoverridevirtual

Get the tooltip string for the type grid.

Implements PickerCallbacks.

Definition at line 1528 of file town_gui.cpp.

◆ HasClassChoice()

bool HousePickerCallbacks::HasClassChoice ( ) const
inlineoverridevirtual

Are there multiple classes to chose from?

Implements PickerCallbacks.

Definition at line 1531 of file town_gui.cpp.

◆ IsActive()

bool HousePickerCallbacks::IsActive ( ) const
inlineoverridevirtual

Should picker class/type selection be enabled?

Implements PickerCallbacks.

Definition at line 1529 of file town_gui.cpp.

◆ IsTypeAvailable()

bool HousePickerCallbacks::IsTypeAvailable ( int  cls_id,
int  id 
) const
inlineoverridevirtual

Test if an item is currently buildable.

Implements PickerCallbacks.

Definition at line 1577 of file town_gui.cpp.

References HouseSpec::enabled, and HouseSpec::Get().

◆ SetClimateMask()

void HousePickerCallbacks::SetClimateMask ( )
inline

◆ SetSelectedClass()

void HousePickerCallbacks::SetSelectedClass ( int  id) const
inlineoverridevirtual

Set the selected class.

Implements PickerCallbacks.

Definition at line 1537 of file town_gui.cpp.

References sel_class.

◆ SetSelectedType()

void HousePickerCallbacks::SetSelectedType ( int  id) const
inlineoverridevirtual

Set the selected type.

Implements PickerCallbacks.

Definition at line 1560 of file town_gui.cpp.

References sel_type.

◆ UpdateSavedItems()

std::set< PickerItem > HousePickerCallbacks::UpdateSavedItems ( const std::set< PickerItem > &  src)
inlineoverridevirtual

Update link between grfid/localidx and class_index/index in saved items.

Implements PickerCallbacks.

Definition at line 1600 of file town_gui.cpp.

References FindFirstBit(), HouseSpec::grf_prop, GRFFilePropsBase< Tcnt >::grfid, HZ_ZONALL, GRFFilePropsBase< Tcnt >::local_id, and HouseSpec::Specs().

Field Documentation

◆ class_mask

uint8_t HousePickerCallbacks::class_mask

Mask of available 'classes'.

Definition at line 1511 of file town_gui.cpp.

Referenced by SetClimateMask().

◆ climate_mask

HouseZones HousePickerCallbacks::climate_mask

Definition at line 1510 of file town_gui.cpp.

◆ instance

HousePickerCallbacks HousePickerCallbacks::instance
static

Definition at line 1625 of file town_gui.cpp.

◆ sel_class

int HousePickerCallbacks::sel_class
inlinestatic

Currently selected 'class'.

Definition at line 1513 of file town_gui.cpp.

Referenced by GetSelectedClass(), and SetSelectedClass().

◆ sel_type

int HousePickerCallbacks::sel_type
inlinestatic

Currently selected HouseID.

Definition at line 1514 of file town_gui.cpp.

Referenced by GetSelectedType(), BuildHouseWindow::OnInvalidateData(), BuildHouseWindow::OnPlaceObject(), and SetSelectedType().

◆ sel_view

int HousePickerCallbacks::sel_view
inlinestatic

Currently selected 'view'. This is not controllable as its based on random data.

Definition at line 1515 of file town_gui.cpp.

Referenced by DrawType().

◆ zone_names

const std::array<StringID, HZB_END> HousePickerCallbacks::zone_names
inlinestatic
Initial value:
= {
STR_HOUSE_PICKER_CLASS_ZONE1,
STR_HOUSE_PICKER_CLASS_ZONE2,
STR_HOUSE_PICKER_CLASS_ZONE3,
STR_HOUSE_PICKER_CLASS_ZONE4,
STR_HOUSE_PICKER_CLASS_ZONE5,
}

Definition at line 1519 of file town_gui.cpp.


The documentation for this class was generated from the following file: