Screenshots with F9.
[sdlbotor.git] / Inventory.cpp
blobaf080363e528e151a1a1bc4decbd2339da510c14
1 //#include <assert.h>
2 #include "Inventory.h"
3 #include "Game.h"
4 #include "Object.h"
6 namespace botor
9 //Inventory::Inventory() {}
11 void Inventory::addObject( Object *o )
13 // assert( o->getLocation() == Object::LOC_FREE );
15 /*if( hasItem( o->getID() ) )
18 }*/
20 invent_t temp;
21 temp.obj = o;
22 temp.count = 1;
24 o->setLocation( Object::LOC_INVENT );
26 invent.push_back( temp );
29 Object* Inventory::removeObject( invElement i )
31 Object *o = (*i).obj;
33 invent.erase( i );
35 return o;
38 Object* Inventory::removeObject( )
40 if( !invent.empty() )
41 return removeObject( invent.begin() );
42 return 0;
45 void Inventory::Draw( Sint16 X, Sint16 Y )
47 if(!invent.empty())
49 unsigned int c = 0;
50 for( invElement i = invent.begin(); i != invent.end(); i++, c++ )
52 Object *o = (*i).obj;
54 o->getGraphic()->Draw( X + (c*20), Y );
59 /*invent_t *Inventory::hasItem( std::string id )
61 if(!invent.empty())
63 for( invElement i = invent.begin(); i != invent.end(); i++ )
65 if( (*i).obj->checkID( id ) )
66 return &(*i);
69 return NULL;
70 }*/