Code: Select all
// select icon(s) for fleet(s), and get a fleet for use later
TemporaryPtr<const Fleet> first_fleet;
if (m_fleets.size() != 1) {
first_fleet = *(fleets.begin());
// if there are multiple fleets, default to generic fleet icon by
// passing null pointer (0) to FleetHeadIcon. TODO: instead, check if
// all fleets would use the same icon, and if so, use that icon, and
// only default to generic icon in cases where there are multiple
// different icons for the various fleets being represented
m_head_icon = FleetHeadIcon(TemporaryPtr<Fleet>(), size_type);
int num_ships = 0;
for (std::vector<TemporaryPtr<const Fleet> >::const_iterator it = fleets.begin(); it != fleets.end(); ++it)
num_ships += (*it)->NumShips();
m_size_icon = FleetSizeIcon(num_ships, size_type);
} else if (!m_fleets.empty()) {
first_fleet = *fleets.begin();
m_head_icon = FleetHeadIcon(first_fleet, size_type);
m_size_icon = FleetSizeIcon(first_fleet, size_type);
}
Edit: made a slightly modified version that always displays the scout icon when there are monster and non-monster fleets. I couldn't find a situation where this would actually occur (fleets of different empires are displayed separately in all cases I could produce), but if there are, that version might be preferable.