|
OpenTTD Source 20251116-master-g21329071df
|
A cargo data entry representing one possible row in the station view window's top part. More...
Public Member Functions | |
| CargoDataEntry & | InsertOrRetrieve (StationID station) |
| Insert a new child or retrieve an existing child using a station ID as ID. | |
| CargoDataEntry & | InsertOrRetrieve (CargoType cargo) |
| Insert a new child or retrieve an existing child using a cargo type as ID. | |
| void | Update (uint count) |
| Update the count for this entry and propagate the change to the parent entry if there is one. | |
| void | Remove (StationID station) |
| Remove a child associated with the given station. | |
| void | Remove (CargoType cargo) |
| Remove a child associated with the given cargo. | |
| CargoDataEntry * | Retrieve (StationID station) const |
| Retrieve a child for the given station. | |
| CargoDataEntry * | Retrieve (CargoType cargo) const |
| Retrieve a child for the given cargo. | |
| void | Resort (CargoSortType type, SortOrder order) |
| StationID | GetStation () const |
| Get the station ID for this entry. | |
| CargoType | GetCargo () const |
| Get the cargo type for this entry. | |
| uint | GetCount () const |
| Get the cargo count for this entry. | |
| CargoDataEntry * | GetParent () const |
| Get the parent entry for this entry. | |
| uint | GetNumChildren () const |
| Get the number of children for this entry. | |
| CargoDataSet::iterator | Begin () const |
| Get an iterator pointing to the begin of the set of children. | |
| CargoDataSet::iterator | End () const |
| Get an iterator pointing to the end of the set of children. | |
| bool | HasTransfers () const |
| Has this entry transfers. | |
| void | SetTransfers (bool value) |
| Set the transfers state. | |
| void | Clear () |
| Delete all subentries, reset count and num_children and adapt parent's count. | |
| CargoDataEntry (StationID station, uint count, CargoDataEntry *parent) | |
| CargoDataEntry (CargoType cargo, uint count, CargoDataEntry *parent) | |
| CargoDataEntry (StationID station) | |
| CargoDataEntry (CargoType cargo) | |
Private Member Functions | |
| CargoDataEntry * | Retrieve (CargoDataSet::iterator i) const |
| template<class Tid > | |
| CargoDataEntry & | InsertOrRetrieve (Tid s) |
| Retrieve a subentry or insert it if it doesn't exist, yet. | |
| void | Remove (CargoDataEntry &entry) |
| Remove a subentry from this one and delete it. | |
| void | IncrementSize () |
| Increment. | |
Private Attributes | ||
| CargoDataEntry * | parent | |
| the parent of this entry. | ||
| union { | ||
| StationID station | ||
| ID of the station this entry is associated with. More... | ||
| struct { | ||
| CargoType cargo | ||
| ID of the cargo this entry is associated with. More... | ||
| bool transfers | ||
| If there are transfers for this cargo. More... | ||
| } | ||
| }; | ||
| uint | num_children | |
| the number of subentries belonging to this entry. | ||
| uint | count | |
| sum of counts of all children or amount of cargo for this entry. | ||
| std::unique_ptr< CargoDataSet > | children | |
| the children of this entry. | ||
A cargo data entry representing one possible row in the station view window's top part.
Cargo data entries form a tree where each entry can have several children. Parents keep track of the sums of their children's cargo counts.
Definition at line 893 of file station_gui.cpp.
| CargoDataEntry::CargoDataEntry | ( | ) |
Definition at line 1038 of file station_gui.cpp.
| CargoDataEntry::~CargoDataEntry | ( | ) |
Definition at line 1078 of file station_gui.cpp.
| CargoDataEntry::CargoDataEntry | ( | StationID | station, |
| uint | count, | ||
| CargoDataEntry * | parent | ||
| ) |
Definition at line 1054 of file station_gui.cpp.
| CargoDataEntry::CargoDataEntry | ( | CargoType | cargo, |
| uint | count, | ||
| CargoDataEntry * | parent | ||
| ) |
Definition at line 1046 of file station_gui.cpp.
| CargoDataEntry::CargoDataEntry | ( | StationID | station | ) |
Definition at line 1062 of file station_gui.cpp.
| CargoDataEntry::CargoDataEntry | ( | CargoType | cargo | ) |
Definition at line 1070 of file station_gui.cpp.
|
inline |
Get an iterator pointing to the begin of the set of children.
Definition at line 992 of file station_gui.cpp.
References children.
Referenced by StationViewWindow::BuildCargoList(), StationViewWindow::BuildFlowList(), StationViewWindow::DrawEntries(), StationViewWindow::EstimateDestinations(), and StationViewWindow::SearchNonStop().
| void CargoDataEntry::Clear | ( | ) |
Delete all subentries, reset count and num_children and adapt parent's count.
Definition at line 1086 of file station_gui.cpp.
References children, count, num_children, and parent.
Referenced by StationViewWindow::RecalcDestinations().
|
inline |
Get an iterator pointing to the end of the set of children.
Definition at line 997 of file station_gui.cpp.
References children.
Referenced by StationViewWindow::BuildCargoList(), StationViewWindow::BuildFlowList(), StationViewWindow::DrawEntries(), StationViewWindow::EstimateDestinations(), and StationViewWindow::SearchNonStop().
|
inline |
Get the cargo type for this entry.
Definition at line 972 of file station_gui.cpp.
References cargo.
Referenced by StationViewWindow::DrawEntries(), and StationViewWindow::SetDisplayedRow().
|
inline |
Get the cargo count for this entry.
Definition at line 977 of file station_gui.cpp.
References count.
Referenced by StationViewWindow::BuildCargoList(), StationViewWindow::BuildFlowList(), StationViewWindow::DrawEntries(), and StationViewWindow::EstimateDestinations().
|
inline |
Get the number of children for this entry.
Definition at line 987 of file station_gui.cpp.
References num_children.
Referenced by StationViewWindow::DrawEntries(), and StationViewWindow::OnPaint().
|
inline |
Get the parent entry for this entry.
Definition at line 982 of file station_gui.cpp.
References parent.
Referenced by StationViewWindow::SearchNonStop(), and StationViewWindow::SetDisplayedRow().
|
inline |
Get the station ID for this entry.
Definition at line 967 of file station_gui.cpp.
References station.
Referenced by StationViewWindow::BuildCargoList(), StationViewWindow::BuildFlowList(), StationViewWindow::DrawEntries(), StationViewWindow::EstimateDestinations(), and StationViewWindow::SetDisplayedRow().
|
inline |
Has this entry transfers.
Definition at line 1002 of file station_gui.cpp.
References transfers.
Referenced by StationViewWindow::DrawEntries().
|
private |
Increment.
Definition at line 1140 of file station_gui.cpp.
References IncrementSize(), num_children, and parent.
Referenced by IncrementSize(), and InsertOrRetrieve().
|
inline |
Insert a new child or retrieve an existing child using a cargo type as ID.
| cargo | type of the cargo for which an entry shall be created or retrieved |
Definition at line 913 of file station_gui.cpp.
References cargo.
|
inline |
Insert a new child or retrieve an existing child using a station ID as ID.
| station | ID of the station for which an entry shall be created or retrieved |
Definition at line 903 of file station_gui.cpp.
References station.
Referenced by StationViewWindow::EstimateDestinations(), StationViewWindow::HandleCargoWaitingClick(), StationViewWindow::RecalcDestinations(), and StationViewWindow::ShowCargo().
|
private |
Retrieve a subentry or insert it if it doesn't exist, yet.
| ID | type of ID: either StationID or CargoType |
| child_id | ID of the child to be inserted or retrieved. |
Definition at line 1113 of file station_gui.cpp.
References children, Count, and IncrementSize().
|
private |
Remove a subentry from this one and delete it.
| child | the entry to be removed. This may also be a synthetic entry which only contains the ID of the entry to be removed. In this case child is not deleted. |
Definition at line 1100 of file station_gui.cpp.
References children.
|
inline |
Remove a child associated with the given cargo.
| cargo | type of the cargo for which the child should be removed. |
Definition at line 934 of file station_gui.cpp.
|
inline |
Remove a child associated with the given station.
| station | ID of the station for which the child should be removed. |
Definition at line 924 of file station_gui.cpp.
References Remove(), and station.
Referenced by StationViewWindow::HandleCargoWaitingClick(), StationViewWindow::OnInvalidateData(), Remove(), and Remove().
| void CargoDataEntry::Resort | ( | CargoSortType | type, |
| SortOrder | order | ||
| ) |
Definition at line 1146 of file station_gui.cpp.
|
private |
Definition at line 1153 of file station_gui.cpp.
|
inline |
Retrieve a child for the given cargo.
Return nullptr if it doesn't exist.
| cargo | type of the cargo the child we're looking for is associated with. |
Definition at line 956 of file station_gui.cpp.
References cargo, children, and Retrieve().
|
inline |
Retrieve a child for the given station.
Return nullptr if it doesn't exist.
| station | ID of the station the child we're looking for is associated with. |
Definition at line 945 of file station_gui.cpp.
References children, Retrieve(), and station.
Referenced by StationViewWindow::BuildCargoList(), StationViewWindow::BuildCargoList(), StationViewWindow::BuildFlowList(), StationViewWindow::HandleCargoWaitingClick(), Retrieve(), Retrieve(), StationViewWindow::SetDisplayedRow(), and StationViewWindow::ShowCargo().
|
inline |
Set the transfers state.
Definition at line 1007 of file station_gui.cpp.
References transfers.
Referenced by StationViewWindow::ShowCargo().
| void CargoDataEntry::Update | ( | uint | count | ) |
Update the count for this entry and propagate the change to the parent entry if there is one.
| count | the amount to be added to this entry |
Definition at line 1131 of file station_gui.cpp.
References count, parent, and Update().
Referenced by StationViewWindow::EstimateDestinations(), StationViewWindow::RecalcDestinations(), StationViewWindow::ShowCargo(), and Update().
| CargoType CargoDataEntry::cargo |
ID of the cargo this entry is associated with.
Definition at line 1029 of file station_gui.cpp.
Referenced by GetCargo(), InsertOrRetrieve(), Remove(), and Retrieve().
|
private |
the children of this entry.
Definition at line 1035 of file station_gui.cpp.
Referenced by Begin(), Clear(), End(), InsertOrRetrieve(), Remove(), Retrieve(), and Retrieve().
|
private |
sum of counts of all children or amount of cargo for this entry.
Definition at line 1034 of file station_gui.cpp.
Referenced by Clear(), GetCount(), and Update().
|
private |
the number of subentries belonging to this entry.
Definition at line 1033 of file station_gui.cpp.
Referenced by Clear(), GetNumChildren(), and IncrementSize().
|
private |
the parent of this entry.
Definition at line 1025 of file station_gui.cpp.
Referenced by Clear(), GetParent(), IncrementSize(), and Update().
| StationID CargoDataEntry::station |
ID of the station this entry is associated with.
Definition at line 1027 of file station_gui.cpp.
Referenced by GetStation(), InsertOrRetrieve(), Remove(), and Retrieve().
| bool CargoDataEntry::transfers |
If there are transfers for this cargo.
Definition at line 1030 of file station_gui.cpp.
Referenced by HasTransfers(), and SetTransfers().