* Mark a specific row, characterized by its CargoDataEntry, as expanded. * @param entry The row to be marked as expanded. */
| 1674 | * @param entry The row to be marked as expanded. |
| 1675 | */ |
| 1676 | void SetDisplayedRow(const CargoDataEntry &entry) |
| 1677 | { |
| 1678 | std::list<StationID> stations; |
| 1679 | const CargoDataEntry *parent = entry.GetParent(); |
| 1680 | if (parent->GetParent() == nullptr) { |
| 1681 | this->displayed_rows.push_back(RowDisplay(&this->expanded_rows, entry.GetCargo())); |
| 1682 | return; |
| 1683 | } |
| 1684 | |
| 1685 | StationID next = entry.GetStation(); |
| 1686 | while (parent->GetParent()->GetParent() != nullptr) { |
| 1687 | stations.push_back(parent->GetStation()); |
| 1688 | parent = parent->GetParent(); |
| 1689 | } |
| 1690 | |
| 1691 | CargoType cargo = parent->GetCargo(); |
| 1692 | CargoDataEntry *filter = this->expanded_rows.Retrieve(cargo); |
| 1693 | while (!stations.empty()) { |
| 1694 | filter = filter->Retrieve(stations.back()); |
| 1695 | stations.pop_back(); |
| 1696 | } |
| 1697 | |
| 1698 | this->displayed_rows.push_back(RowDisplay(filter, next)); |
| 1699 | } |
| 1700 | |
| 1701 | /** |
| 1702 | * Select the correct string for an entry referring to the specified station. |
no test coverage detected