]> ruin.nu Git - hbs.git/commitdiff
some master origin
authorMichael Andreen <harv@ruin.nu>
Sat, 24 Aug 2002 22:16:39 +0000 (22:16 +0000)
committerMichael Andreen <harv@ruin.nu>
Sat, 24 Aug 2002 22:16:39 +0000 (22:16 +0000)
bs/fleet.cpp

index 0b8598c1c6e916cd262bc2c87771c192efc2b8ce..73923b5c22449e43c8702fdf9b376be5a39c201a 100644 (file)
@@ -380,13 +380,11 @@ void Fleet::takeShoot(std::string unittype, int number, std::map<std::string, in
        if (guns == 0)
                return;
 
-       //cerr << number << " " << unittype << ": with " << guns << " guns\n";
-
        float gunsleft = guns;
-       for (int count = 0; count < 3; ++count)//vector<string>::iterator i = s_Units[unittype].target().begin(); i != s_Units[unittype].target().end(); ++i)
+       for (int count = 0; count < 3; ++count)
        {
                string ta = s_Units[unittype].target(count);
-               //cerr << "Shooting at target class: " << ta << endl;
+
                while (gunsleft > 0)
                {
                        int total = 0;
@@ -398,14 +396,11 @@ void Fleet::takeShoot(std::string unittype, int number, std::map<std::string, in
                        for (map<string, int*>::iterator j = targets.begin(); j != targets.end(); ++j)
                        {
                                float maxguns = float((*j->second))/total * guns;
-                               //cerr << "Now shooting at target: " << j->first << endl;
 
                                if (m_Armor[j->first] <= 0 || m_Armor[j->first] > s_Units[j->first].armor())
                                        m_Armor[j->first] = s_Units[j->first].armor();
                                double k = maxguns;
 
-                               //cerr << "Targets agility: " << s_Units[j->first].agility() << endl;
-                               //cerr << "Weaponspeed: " << s_Units[unittype].weaponSpeed() << endl;
                                while (k > 0)   
                                {
 
@@ -416,8 +411,6 @@ void Fleet::takeShoot(std::string unittype, int number, std::map<std::string, in
                                        int agil = s_Units[j->first].agility();
 
                                        k -= float(100)/(25 + wpsp - agil);
-                                       //cout << "Used " << blaha << " guns to hit with one shot.\n";
-                                       //cout << "WPSP: " << wpsp << "\nAgil: " << agil << endl;
 
                                        m_Armor[j->first] -= s_Units[unittype].power();
                                        if (m_Armor[j->first] <= 0)
@@ -425,27 +418,9 @@ void Fleet::takeShoot(std::string unittype, int number, std::map<std::string, in
                                                m_Armor[j->first] = s_Units[j->first].armor();
                                                (*j->second)--;
                                                hitunits[j->first]++;
-
-                                               //There is a chance that we're hitting a blocked ship.
-                                               /*Not anymore..
-                                               if (m_BlockedFleet[j->first].size() >= 1)
-                                               {
-                                                       int test = rand() % m_BlockedFleet[j->first][0];
-                                                       if (test == 1
-                                                                       && m_BlockedFleet[j->first][0] > 0)
-                                                       {
-                                                               if (m_BlockedFleet[j->first].size() == 1)
-                                                                       m_BlockedFleet[j->first].push_back(m_BlockedFleet[j->first][0] - 1);
-                                                               else if (m_BlockedFleet[j->first][1] > 0)
-                                                                       m_BlockedFleet[j->first][1]--;
-                                                       }
-                                               }
-                                               */
                                        }
 
                                }
-
-                               //cerr << hitunits[j->first] << " units of type: " << j->first << "killed\n";
                                if (k <= 0)
                                        gunsleft -= maxguns;
                                else
@@ -463,13 +438,11 @@ void Fleet::takeEMP(std::string unittype, int number, std::map<std::string, int>
        if (guns == 0)
                return;
 
-       //cerr << unittype << ": with " << guns << " guns\n";
-
        float gunsleft = guns;
-       for (int count = 0; count < 3; ++count)//vector<string>::iterator i = s_Units[unittype].target().begin(); i != s_Units[unittype].target().end(); ++i)
+       for (int count = 0; count < 3; ++count)
        {
                string ta = s_Units[unittype].target(count);
-               //cerr << "Shooting at target class: " << ta << endl;
+
                while (gunsleft > 0)
                {
                        int total = 0;
@@ -481,10 +454,7 @@ void Fleet::takeEMP(std::string unittype, int number, std::map<std::string, int>
                        for (map<string, int*>::iterator j = targets.begin(); j != targets.end(); ++j)
                        {
                                float maxguns = float((*j->second))/total * gunsleft;
-                               //cerr << "Now shooting at target: " << j->first << endl;
-
                                double k = maxguns;
-
                                int hits = 0;
 
                                while (k > 0)   
@@ -500,8 +470,6 @@ void Fleet::takeEMP(std::string unittype, int number, std::map<std::string, int>
                                        hitunits[j->first]++;
                                        blockFleet(j->first, 1);
                                }
-
-                               //cerr << hits << " units of type: " << j->first << " blocked\n";
                                if (k <= 0)
                                        gunsleft -= maxguns;
                                else
@@ -830,21 +798,16 @@ std::map<std::string, int*> Fleet::findTargets(std::string targetClass,int& tota
                if (m_Fleet[i->first].size() == 0)
                        continue;
 
-
                if (m_Fleet[i->first].size() == 1 )
                        m_Fleet[i->first].push_back(m_Fleet[i->first][0]);
 
-               //cerr << "Target is class: " << j->second.type() << endl;
-
                if (m_Fleet[i->first][1] > 0  && ( targetClass == i->second.unitClass() || targetClass == "All"))
                {
                        if (i->second.unitClass() == "PDS" && attackerType == 1)
                                continue;
-                       //      cerr << "Looking at target: " << j->first << endl;
                        targets[i->first] = &m_Fleet[i->first][1];
                        total += m_Fleet[i->first][1];
                }
        }
-
        return targets;
 }