* Show a certain cargo entry characterized by source/next/dest station, cargo type and amount of cargo at the * right place in the cargo view. I.e. update as many rows as are expanded following that characterization. * @param data Root entry of the tree. * @param cargo Cargo type of the entry to be shown. * @param source Source station of the entry to be shown. * @param next Next station
| 1366 | * @param count Amount of cargo to be shown. |
| 1367 | */ |
| 1368 | void ShowCargo(CargoDataEntry *data, CargoType cargo, StationID source, StationID next, StationID dest, uint count) |
| 1369 | { |
| 1370 | if (count == 0) return; |
| 1371 | bool auto_distributed = _settings_game.linkgraph.GetDistributionType(cargo) != DT_MANUAL; |
| 1372 | const CargoDataEntry *expand = &this->expanded_rows; |
| 1373 | for (int i = 0; i < NUM_COLUMNS && expand != nullptr; ++i) { |
| 1374 | switch (groupings[i]) { |
| 1375 | case GR_CARGO: |
| 1376 | assert(i == 0); |
| 1377 | data = &data->InsertOrRetrieve(cargo); |
| 1378 | data->SetTransfers(source != this->window_number); |
| 1379 | expand = expand->Retrieve(cargo); |
| 1380 | break; |
| 1381 | case GR_SOURCE: |
| 1382 | if (auto_distributed || source != this->window_number) { |
| 1383 | data = &data->InsertOrRetrieve(source); |
| 1384 | expand = expand->Retrieve(source); |
| 1385 | } |
| 1386 | break; |
| 1387 | case GR_NEXT: |
| 1388 | if (auto_distributed) { |
| 1389 | data = &data->InsertOrRetrieve(next); |
| 1390 | expand = expand->Retrieve(next); |
| 1391 | } |
| 1392 | break; |
| 1393 | case GR_DESTINATION: |
| 1394 | if (auto_distributed) { |
| 1395 | data = &data->InsertOrRetrieve(dest); |
| 1396 | expand = expand->Retrieve(dest); |
| 1397 | } |
| 1398 | break; |
| 1399 | } |
| 1400 | } |
| 1401 | data->Update(count); |
| 1402 | } |
| 1403 | |
| 1404 | void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override |
| 1405 | { |
no test coverage detected