src/team/macro.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  * Macros pour la gestion des différentes équipes.
00020  *****************************************************************************/
00021 
00022 #ifndef TEAM_MACRO_H
00023 #define TEAM_MACRO_H
00024 //-----------------------------------------------------------------------------
00025 #include "teams_list.h"
00026 //-----------------------------------------------------------------------------
00027 
00028 // Boucle pour chaque equipe
00029 #define FOR_EACH_TEAM(equipe) \
00030   for (TeamsList::iterator equipe=teams_list.playing_list.begin(), \
00031        fin_pour_chaque_equipe=teams_list.playing_list.end(); \
00032        equipe != fin_pour_chaque_equipe; \
00033        ++equipe)
00034 
00035 // Boucle pour chaque ver d'une equipe (sauf les fantomes)
00036 #define FOR_EACH_CHARACTER(equipe,ver) \
00037   for (Team::iterator ver = (*(equipe)).begin(), \
00038        fin_pour_chaque_ver = (*(equipe)).end(); \
00039        ver != fin_pour_chaque_ver; \
00040        ++ver) \
00041   if (!ver -> IsGhost())
00042 
00043 // Boucle pour chaque ver vivant d'une equipe
00044 #define FOR_EACH_LIVING_CHARACTER(equipe,ver) \
00045   for (Team::iterator ver = (*(equipe)).begin(), \
00046        fin_pour_chaque_ver_vivant = (*(equipe)).end(); \
00047        ver != fin_pour_chaque_ver_vivant; \
00048        ++ver) \
00049   if (!ver -> IsDead())
00050 
00051 // Boucle pour tous les vers (or fantomes)
00052 #define FOR_ALL_CHARACTERS(equipe,ver) \
00053   FOR_EACH_TEAM(equipe) \
00054   FOR_EACH_CHARACTER(*equipe,ver) 
00055 
00056 // Boucle pour tous les vers vivants
00057 #define FOR_ALL_LIVING_CHARACTERS(equipe,ver) \
00058   FOR_EACH_TEAM(equipe) \
00059   FOR_EACH_LIVING_CHARACTER(*equipe,ver) 
00060 
00061 #define FOR_ALL_LIVING_ENEMIES(equipe,ver) \
00062   FOR_EACH_TEAM(equipe) \
00063   if (!(*equipe)->IsSameAs(ActiveTeam())) \
00064   FOR_EACH_LIVING_CHARACTER(*equipe,ver) 
00065 
00066 //-----------------------------------------------------------------------------
00067 #endif

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