src/object/objects_list.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  *  Wormux is a convivial mass murder game.
00003  *  Copyright (C) 2001-2004 Lawrence Azzoug.
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
00018  ******************************************************************************
00019  * Stores most of the object playing in the game
00020  *****************************************************************************/
00021 
00022 #ifndef OBJECTS_LIST_H
00023 #define OBJECTS_LIST_H
00024 //-----------------------------------------------------------------------------
00025 #include "../include/base.h"
00026 #include "../object/physical_obj.h"
00027 #include <list>
00028 //-----------------------------------------------------------------------------
00029 
00030 // Loop for all objects
00031 #define FOR_ALL_OBJECTS(object) \
00032   for (ObjectsList::iterator object=lst_objects.begin(), \
00033        end=lst_objects.end(); \
00034        object != end; \
00035        ++object)
00036 
00037 //-----------------------------------------------------------------------------
00038 
00039 // Loop for all objects that aren't out of the screen
00040 #define FOR_EACH_OBJECT(object) \
00041   FOR_ALL_OBJECTS(object) \
00042   if (!(*object)->IsGhost())
00043 
00044 //-----------------------------------------------------------------------------
00045 
00046 class ObjectsList : public std::list<PhysicalObj*>
00047 {
00048   public:
00049     inline void RemoveObject(PhysicalObj * obj) { remove(obj);};
00050     typedef std::list<PhysicalObj*>::iterator iterator;
00051 
00052   public:
00053     ~ObjectsList();
00054     inline void AddObject(PhysicalObj * obj) { push_back(obj);};
00055 
00056   // Call the Refresh method of all the objects
00057     void Refresh();
00058   // Call the Draw method of all the objects
00059     void Draw();
00060 
00061     bool AllReady();
00062 
00063   // Place mines randomly on the map
00064     void PlaceMines();
00065   // Place barrels randomly on the map
00066     void PlaceBarrels();
00067 
00068     void FreeMem();
00069 };
00070 
00071 extern ObjectsList lst_objects;
00072 //-----------------------------------------------------------------------------
00073 #endif

Generated on Mon Jan 1 13:10:59 2007 for Wormux by  doxygen 1.4.7