X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=bs%2Ffleet.cpp;h=ee22ae7a2759f58b97e35a98b8dffc8dfd4e8728;hb=6a5c3106cf6dc30d4624df99473e18df2b1d50ed;hp=7361fe2122b486a4b32b11f7d69e44a3d27a857e;hpb=33b6dc7ca95a05c26a78879413395c1588066b77;p=hbs.git diff --git a/bs/fleet.cpp b/bs/fleet.cpp index 7361fe2..ee22ae7 100644 --- a/bs/fleet.cpp +++ b/bs/fleet.cpp @@ -82,7 +82,8 @@ int Fleet::numberOfShips() const for (map >::const_iterator i = m_Fleet.begin(); i != m_Fleet.end(); ++i) { - total += i->second[0]; + if (i->second.size() != 0) + total += i->second[0]; } return total; @@ -169,7 +170,9 @@ unsigned Fleet::score(int tick = 0) const for (FleetList::const_iterator i = m_Fleet.begin(); i != m_Fleet.end(); ++i) { - tot_score += i->second[tick] * s_Units[i->first].totRes() / 10; + if (i->second.size() >= tick) + break; + tot_score += i->second[tick] * s_Units[i->first].totRes() / 10; } return tot_score;