Add console commands to dump station flow stats

This commit is contained in:
Jonathan G Rennison
2019-10-01 02:34:37 +01:00
parent 0246d59c8d
commit 170e71787b
2 changed files with 33 additions and 0 deletions

View File

@@ -5007,6 +5007,24 @@ void FlowStatMap::SortStorage()
}
}
void DumpStationFlowStats(char *b, const char *last)
{
btree::btree_map<uint, uint> count_map;
const Station *st;
FOR_ALL_STATIONS(st) {
for (CargoID i = 0; i < NUM_CARGO; i++) {
const GoodsEntry &ge = st->goods[i];
for (FlowStatMap::const_iterator it(ge.flows.begin()); it != ge.flows.end(); ++it) {
count_map[(uint32)it->size()]++;
}
}
}
b += seprintf(b, last, "Flow state shares size distribution:\n");
for (const auto &it : count_map) {
b += seprintf(b, last, "%-5u %-5u\n", it.first, it.second);
}
}
extern const TileTypeProcs _tile_type_station_procs = {
DrawTile_Station, // draw_tile_proc
GetSlopePixelZ_Station, // get_slope_z_proc