Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 3, 2008, 4:07:49 PM (15 years ago)
Author:
dsommer
Message:

Aufnehmen von festen Item und wieder ablegen

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickups2/src/orxonox/objects/pickup/ShipEquipment.cc

    r2294 r2324  
    11#include "Item.h"
    22#include "ShipEquipment.h"
     3#include "objects/worldentities/pawns/Pawn.h"
    34
    45
    56namespace orxonox
    67{
     8
    79        bool ShipEquipment::insert(Item* item)
    810        {
    9         if(checkSlot(player)==true)
     11        if(checkSlot(item)==true)
     12        {
    1013                Equipment.insert ( std::pair<std::string, Item*>(item->getName(),item) );
    11         else
     14                return true;
     15        }
    1216                COUT(3) << "swap?" << std::endl;
     17                return false;
    1318       
     19        return false;
    1420        };
    1521        bool ShipEquipment::erase (Item* item)
    1622        {
    17         if(Equipment.find(item->getName())!= Equipment.end())
     23        std::multimap<std::string,Item*>::iterator it = Equipment.find(item->getName());
     24        if(it != Equipment.end())
    1825        {
    19                 std::multimap<std::string,Item*>::iterator it;
    20                 it=Equipment.find(item->getName());
     26                //it->second->dropped(this->getPlayer());
    2127                Equipment.erase (it);
    2228                return true;
     
    2531                return false;
    2632        };
    27         bool ShipEquipment::checkSlot(Item* item) const
     33
     34        void ShipEquipment::eraseAll()
     35        {
     36               
     37                for (std::multimap<std::string,Item*>::iterator it = Equipment.begin(); it != Equipment.end(); )
     38                {
     39               
     40                        (it++)->second->dropped(this->getPlayer());
     41                }
     42        }
     43
     44        bool ShipEquipment::checkSlot(Item* item)
    2845        {
    2946        std::multimap<std::string,Item*>::iterator it;
    30         for ( it=Equipment.begin() ; it != Equipment.end(); it++ )
     47        for ( it= getPlayer()->getPickUp().getEquipment().begin() ; it != getPlayer()->getPickUp().getEquipment().end(); it++ )
    3148        {
    32                 if((*it).second->playerBaseClass_==item->playerBaseClass_)
     49                if((*it).second->getPlayerBaseClass()==item->getPlayerBaseClass())
    3350                return false;
    3451        }
Note: See TracChangeset for help on using the changeset viewer.