123456789101112131415161718192021222324252627282930313233 |
- #include <hotseatgame/UnitsQueue.h>
- #include <vector>
- #include <string>
- void UnitsQueue::add(Unit* unit){
- queue_.push_back(unit);
- }
- void UnitsQueue::remove(viterator iter){
- if (beginIterator() <= iter && iter < endIterator()){
- queue_.erase(iter);
- return;
- }
- throw std::string("Iterator is not in UnitsQueue");
- }
- void UnitsQueue::remove(Unit* unit){
- for (viterator it = beginIterator(); it != endIterator();++it){
- if( (*it) == unit){
- remove(it);
- return;
- }
- }
- throw std::string("Unit* is not in UnitsQueue");
- }
- UnitsQueue::viterator UnitsQueue::beginIterator() {
- return queue_.begin();
- }
- UnitsQueue::viterator UnitsQueue::endIterator(){
- return queue_.end();
- }
|