X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=bs%2Ffleet.cpp;h=5f6b0155f01444431167c66f60abe72edbcb4c45;hb=a2ce63f561d091d9c3af49987d74849f9450c16b;hp=cb15df528c6bce726a0f7dd52db026f7d57f5a31;hpb=5940cfda3be2c7b4ecbd64c814948b29139177c0;p=hbs.git diff --git a/bs/fleet.cpp b/bs/fleet.cpp index cb15df5..5f6b015 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,9 +170,104 @@ 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; } +////////////////////////////////////////////////////////////////////////// +// +void Fleet::setFleet(string unittype, int number) +{ + if (m_Fleet[unittype].size() == 0) + { + m_Fleet[unittype].push_back(number); + return; + } + m_Fleet[unittype][0] = number; +} + +////////////////////////////////////////////////////////////////////////// +// +int Fleet::fleet(string unittype, int tick = 0) +{ + if (m_Fleet[unittype].size() == 0) + return 0; + + return m_Fleet[unittype][tick]; +} + +////////////////////////////////////////////////////////////////////////// +// +void Fleet::addToThis(std::vector fleets, int tick = 0) +{ + for (UnitList::iterator i = s_Units.begin(); i != s_Units.end(); ++i) + { + if (m_Fleet[i->first].size() == 0) + m_Fleet[i->first].push_back(0); + + for (vector::iterator j = fleets.begin(); j != fleets.end(); ++j) + { + // FIXTHIS!! m_Fleet[i->first][0] += j->fleet(i->first, tick); + } + } +} + +////////////////////////////////////////////////////////////////////////// +// +void Fleet::distributeLossesGains(std::vector fleets, int tick = 0) +{ +} + +////////////////////////////////////////////////////////////////////////// +// +std::vector Fleet::calculateSide(std::vector fleets, int stays = 0, int tick = 0) +{ +} + +////////////////////////////////////////////////////////////////////////// +// +int Fleet::freeFleet(std:: string unittype, int tick = 0) +{ + if (m_Fleet[unittype].size() == 0) + return 0; + if (m_BlockedFleet[unittype].size() < tick) + return m_Fleet[unittype][tick]; + + return m_Fleet[unittype][tick] - m_BlockedFleet[unittype][tick]; +} + + +////////////////////////////////////////////////////////////////////////// +// +void Fleet::takeShoot(std::string unittype, int number, std::map& hitunits) +{ +} + +////////////////////////////////////////////////////////////////////////// +// +void Fleet::takeEMP(std::string unittype, int number) +{ +} + +////////////////////////////////////////////////////////////////////////// +// +void Fleet::killFleet(std::string unittype, int number, int tick = 0) +{ +} + +////////////////////////////////////////////////////////////////////////// +// +void setResource(std::string type, int number, int tick = 0) +{ +} + +////////////////////////////////////////////////////////////////////////// +// +int resource(std::string type, int tick = 0) +{ +} +