helpers.h

Go to the documentation of this file.
00001 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 5 -*- */
00002 
00008 /*
00009  * helpers.h
00010  * MetalWarriors
00011  * $Revision: 1.5 $
00012  *
00013  * Created by Daniel Aarno on Mon Oct 20 2003.
00014  * Copyright (c) 2003 Daniel Aarno and Erik Ytterberg - All rights reserved.
00015  *
00016  *     This program is free software; you can redistribute it and/or modify
00017  *     it under the terms of the GNU General Public License as published by
00018  *     the Free Software Foundation; either version 2 of the License, or
00019  *     (at your option) any later version.
00020  *
00021  *     This program is distributed in the hope that it will be useful,
00022  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024  *     GNU General Public License for more details.
00025  *
00026  *     You should have received a copy of the GNU General Public License
00027  *     along with this program; if not, write to the Free Software
00028  *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00029  */ 
00030 
00031 #ifndef _HELPERS_
00032 #define _HELPERS_
00033 
00034 #include <string>
00035 #include <cerrno>
00036 
00037 class Sprite;
00038 
00039 //template<typename Object, typename Collection, typename Iterator> int
00040 template<typename Object, typename Collection> int
00041 RemoveObjectFromCollection(const Object &o, Collection &c)
00042 {
00043      typename Collection::iterator it = find(c.begin(), c.end(), o);
00044      if(it == c.end())
00045           return -1;
00046      
00047      c.erase(it);
00048 
00049      return 0;
00050 }
00051 
00052 void AddSpriteToLists(Sprite* s);
00053 void AddSpriteToTransLists(Sprite* s);
00054 int RemoveSpriteFromLists(Sprite *s);
00055 int RemoveSpriteFromTransLists(Sprite *s);
00056 
00057 #endif

Generated on Sun Mar 11 15:33:23 2007 for MetalWarriors by  doxygen 1.4.7