Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8761 for code/branches


Ignore:
Timestamp:
Jul 15, 2011, 10:49:17 AM (13 years ago)
Author:
jo
Message:

Error due to block scope (variables didn't reset in the inner while loops).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ai2/src/orxonox/controllers/ArtificialController.cc

    r8758 r8761  
    3333
    3434#include "util/Math.h"
    35 #include "util/Convert.h"
    3635#include "core/CoreIncludes.h"
    3736#include "core/XMLPort.h"
     
    4948#include "weaponsystem/WeaponPack.h"
    5049#include "weaponsystem/Weapon.h"
    51 
     50#include "weaponsystem/WeaponSlot.h"
    5251
    5352namespace orxonox
     
    11371136    void ArtificialController::analyseWeapons(Pawn* pawn)
    11381137    {
    1139         int max=10, i=0, j=0, k=0;
     1138        int max = 10;
    11401139        if(!pawn) return;
    1141         while(i<max)
    1142         {
    1143             WeaponPack* wPack = pawn->getWeaponPack(i); //WeaponSet* wSet = pawn->getWeaponSet(i);
    1144             i++;
    1145             if(wPack==NULL) continue;
    1146             while(j<max)
    1147             {
    1148                 Weapon* wpn = wPack->getWeapon(j);
    1149                 j++;
    1150                 if(wpn==NULL) continue;
    1151                 while(k<max)
    1152                 {
    1153                     WeaponMode* wMode = wpn->getWeaponmode(k);
    1154                     k++;
    1155                     if(wMode==NULL) continue;
    1156                     COUT(0)<<wMode->getIdentifier()->getName()<<": weaponpack "+multi_cast<std::string>(i-1)<<", weapon "<<multi_cast<std::string>(j-1)<<", weaponmode "<<multi_cast<std::string>(k-1)<<std::endl;
    1157                 }
     1140        for(int l=0; l<max ;l++)
     1141        {
     1142            WeaponSlot* wSlot = pawn->getWeaponSlot(l);
     1143            if(wSlot==NULL) continue;//{COUT(0)<<"WEAPONSLOT "<<l<< " failed"<<endl; continue;}
     1144            for(int i=0; i<max; i++)
     1145            {
     1146                 WeaponMode* wMode = wSlot->getWeapon()->getWeaponmode(i);
     1147                 if(wMode==NULL) continue;//{COUT(0)<<"WEAPONMODE "<<i<< " failed"<<endl;}
     1148                 COUT(0)<<wMode->getIdentifier()->getName()<< " using mode:"<<i<<endl;
    11581149            }
    11591150        }
Note: See TracChangeset for help on using the changeset viewer.