Made lua run under MSWin with Dev-Cpp 4.9.9.2
[sdlbotor.git] / Inventory.cpp
blobc3b7a8498a8c93d3691c0987aab998e0d8dab3f2
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 invent_t temp;
16 temp.obj = o;
17 temp.count = 1;
19 o->setLocation( Object::LOC_INVENT );
21 invent.push_back( temp );
24 Object* Inventory::removeObject( invElement i )
26 Object *o = (*i).obj;
28 invent.erase( i );
30 return o;
33 Object* Inventory::removeObject( )
35 if( !invent.empty() )
36 return removeObject( invent.begin() );
37 return 0;
40 void Inventory::Draw( Sint16 X, Sint16 Y )
42 if(!invent.empty())
44 unsigned int c = 0;
45 for( invElement i = invent.begin(); i != invent.end(); i++, c++ )
47 Object *o = (*i).obj;
49 o->getGraphic()->Draw( X + (c*20), Y );