X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=bs%2Ffleet.cpp;h=ee22ae7a2759f58b97e35a98b8dffc8dfd4e8728;hb=6a5c3106cf6dc30d4624df99473e18df2b1d50ed;hp=11334172decbda3f477e0c93f2db55320876fb7e;hpb=07acf9a898e295587b9034bee6b8682e11a97086;p=hbs.git diff --git a/bs/fleet.cpp b/bs/fleet.cpp index 1133417..ee22ae7 100644 --- a/bs/fleet.cpp +++ b/bs/fleet.cpp @@ -29,6 +29,7 @@ Fleet::Fleet() m_iETA = 0; m_sRace = "Cathaar"; } + Fleet::~Fleet(){ } @@ -81,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; @@ -168,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;