Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10062


Ignore:
Timestamp:
May 20, 2014, 9:03:19 AM (10 years ago)
Author:
muemart
Message:

Commit the right file this time

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/turretFS14/src/modules/objects/controllers/TurretController.cc

    r10060 r10062  
    9797        }
    9898
    99         float maxScore = 0;
     99        float minScore = FLT_MAX;
    100100        float tempScore;
    101         Pawn* maxScorePawn = 0;
     101        Pawn* minScorePawn = 0;
    102102
    103103                for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)     
     
    109109            if(tempScore != -1.f)
    110110            {
    111                 if(tempScore > maxScore)
     111                if(tempScore < minScore)
    112112                {
    113                         maxScore = tempScore;
    114                         maxScorePawn = entity;
     113                        minScore = tempScore;
     114                        minScorePawn = entity;
    115115                }
    116116            }
    117117        }
    118         this->setTarget(maxScorePawn);
    119         turret->setTarget(maxScorePawn);
     118        this->setTarget(minScorePawn);
     119        turret->setTarget(minScorePawn);
    120120        }
    121121
     
    138138        Scores a pawn as a target, based on distance and health.
    139139
    140         The more health and distance a pawn has, the higher the score. This means lower equals better target.
     140        The more health and distance a pawn has, the higher the score. This means lower equals better.
    141141
    142142                @param pawn
Note: See TracChangeset for help on using the changeset viewer.