Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 12, 2016, 4:20:50 PM (8 years ago)
Author:
patricwi
Message:

finished version of HUD and PickupSystem. crash bug remaining

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/HUD_HS16/src/modules/pickup/PickupManager.cc

    r11325 r11336  
    266266        assert(pickup);
    267267
    268 
    269268        for (HUDPickupSystem* hud : ObjectList<HUDPickupSystem>())
    270269            pickupSystem = hud;
    271270       
    272         assert(pickupSystem); //pickupSystem HAS to be there!
    273 
    274271        if(!GameMode::isMaster()) // If this is neither standalone nor the server.
    275272            return;
     
    300297            this->pickups_[index] = pickup;
    301298
    302             orxout() << "the pickup is: " << pickup << endl;
    303 
    304299            this->picks.push_back(pickup);
    305300
    306             pickupSystem->updatePickupList(picks);
     301            if(pickupSystem)
     302                pickupSystem->updatePickupList(picks, indexes_);
    307303           
    308304        }
     
    319315            this->picks.erase(std::remove(this->picks.begin(), this->picks.end(), pickup), this->picks.end()); //remove pickup from vector
    320316
    321             pickupSystem->removePickup(pickup);
     317            if(pickupSystem)
     318                pickupSystem->removePickup(pickup);
    322319        }
    323320
     
    349346    //This function is called by the command line or by the key binding
    350347    //it uses or unuses the pickup, depending on its current state
     348    //or drops it (depends what you comment/uncomment)
    351349    void PickupManager::useUnusePickup(uint32_t index)
    352350    {
    353         orxout() << "Hello there I was here " << index << endl;
    354 
    355351        PickupManager& manager = PickupManager::getInstance();
    356352
     
    360356        if(pickup==nullptr)
    361357        {
    362             orxout() << "The pickup does not exist." << endl;
    363358            return;                       //pickup does not exist
    364359        }
    365360
    366         orxout() << "The pickup is being used: " << pickup->isUsed() << endl;
    367 
     361        //if the pickup should be dropped upon key press
    368362        manager.dropPickup(index);
     363
     364        //if the pickup should be used/unused upon key press
    369365
    370366        // if(pickup->isUsed())
     
    563559        }
    564560        //all slots are full and we have to drop sth
    565         orxout() << "everything was full and we have now dropped the first element" << endl;
     561        orxout(internal_info, context::pickups) << "everything was full and we have now dropped the first element" << endl;
    566562        this->dropPickup(0);
    567563        return 0;
Note: See TracChangeset for help on using the changeset viewer.