Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 13, 2017, 4:14:47 PM (7 years ago)
Author:
patricwi
Message:

no more segfaults but still not exiting properly - maybe never ending loop?

Location:
code/branches/HUD_HS16/src/modules
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.cc

    r11540 r11558  
    6868    }
    6969   
    70     void HUDPickupSystem::sync(std::vector<Pickupable*> p)
     70    void HUDPickupSystem::sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_)
    7171    {
    7272        //hide all pickup symbols in HUD and delete from local map
     73       
     74        orxout() << "picks size before: " << picks.size() << endl;
     75        orxout() << "p size before: " << p.size() << endl;
    7376
    7477        for(const auto& sm_pair : picks)
    7578        {
    7679            sm_pair.second->hideMe(sm_pair.first, repaint);
    77             picks.erase(sm_pair.first);
     80            orxout() << "deleting local list picks: " << picks.size() << " pickup ptr" << sm_pair.first << endl;
    7881        }
     82
     83        picks.clear();
     84        assert(picks.empty()); //picks must be empty now
    7985
    8086        //add to local map and place on screen
     
    8389        float offsetY = 0.82f;
    8490        const float x = 0.102f;
     91        orxout() << "picks size after: " << picks.size() << endl;
     92        orxout() << "p size after: " << p.size() << endl;
     93
    8594        for(Pickupable* pickup:p)
    8695        {
     96            i=indexes_.find(pickup)->second;
    8797            //second row has offset
    88             if(i==4)
     98            if(i==5)
    8999            {   
    90100                i=0;
     
    97107            item->setOverlayGroup(this->getOverlayGroup());
    98108            picks[pickup] = item;
    99             i++;
    100         }
    101 
    102     }
    103 
    104     void HUDPickupSystem::updatePickupList(std::vector<Pickupable*> picks, std::map<Pickupable*, uint32_t> indexes_)
    105     {
    106         int i =0;
    107         const float offsetX = 0.345f;
    108         float offsetY = 0.82f;
    109         const float x = 0.102f;
    110 
    111         if(picks.size()>0)
    112         {
    113             for(Pickupable* p : picks)
    114             {
    115                 i = indexes_.find(p)->second;
    116                 offsetY = 0.82f;
    117 
    118                 if(i>=5)
    119                 {
    120                     offsetY+=0.075f;
    121                     i-=5;
    122                 }   
    123                 if(this->picks.count(p)==0)
    124                 {
    125                     HUDPickupItem* item = new HUDPickupItem(this->getContext());
    126                     item->initializeMaterial(this->getIcon(((Pickup*)p)->getRepresentationName()), offsetX+i*x, offsetY);
    127                     orxout() << "created new pickupHUDItem"<<endl;
    128                     item->setOverlayGroup(this->getOverlayGroup());
    129                     this->picks[p] = item;
    130                 }
    131             }
    132109        }
    133110    }
    134111
    135     void HUDPickupSystem::createPickupList()
    136     {
    137     }     
    138 
    139     void HUDPickupSystem::removePickup(Pickupable* pickup)
    140     {
    141         assert(pickup);
    142         orxout()<< "removePickup called with " << pickup << endl;
    143         HUDPickupItem* item = this->picks.find(pickup)->second;
    144         orxout() << "removePickup: pickup= " << pickup << " item= " << item << endl;
    145         this->picks.erase(pickup);
    146         //assert(item);
    147         item->hideMe(pickup, repaint);
    148         orxout() << "i am hidden now" << endl;
    149         //assert(overlayElement_);
    150         //assert(this->background_);
    151         orxout()<< "end removePickup method" << endl;
    152     }
    153 
     112   
    154113    void HUDPickupSystem::destroyAll()
    155114    {
  • code/branches/HUD_HS16/src/modules/overlays/hud/HUDPickupSystem.h

    r11540 r11558  
    5757
    5858        void sizeChanged();
    59         void sync(std::vector<Pickupable*> p);
    60         void updatePickupList(std::vector<Pickupable*> picks, std::map<Pickupable*, uint32_t> indexes_); 
    61         void createPickupList(); 
    62         void removePickup(Pickupable* pickup);
     59        void sync(std::vector<Pickupable*> p, std::map<Pickupable*, uint32_t> indexes_);
    6360
    6461        bool repaint=true; //if we shouldnt repaint, set this to false
  • code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc

    r11540 r11558  
    300300
    301301            if(pickupSystem)
    302                 pickupSystem->sync(picks);
     302                pickupSystem->sync(picks, indexes_);
    303303           
    304304        }
     
    316316
    317317            if(pickupSystem)
    318                 pickupSystem->sync(picks);
     318                pickupSystem->sync(picks, indexes_);
    319319            orxout() << "end of pickupChangedPickedUp" << endl;
    320320        }
Note: See TracChangeset for help on using the changeset viewer.