src/team/teams_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  * Handle team list
00020  *****************************************************************************/
00021 
00022 #ifndef TEAMS_LIST_H
00023 #define TEAMS_LIST_H
00024 //-----------------------------------------------------------------------------
00025 #include "team.h"
00026 #include "team_config.h"
00027 #include <list>
00028 //-----------------------------------------------------------------------------
00029 
00030 class TeamsList
00031 {
00032 public:
00033   typedef std::list<Team>::iterator full_iterator;
00034   typedef std::vector<Team*>::iterator iterator;
00035   std::list<Team> full_list;
00036   std::vector<Team*> playing_list;
00037 
00038 private:
00039   typedef std::list<uint>::iterator selection_iterator;
00040   std::list<uint> selection;
00041   std::vector<Team*>::iterator active_team;
00042   void LoadOneTeam (const std::string &dir, const std::string &file);
00043 
00044 public:
00045   TeamsList();
00046   ~TeamsList();
00047   void LoadList ();
00048   void NextTeam (bool begin_game);
00049   Team& ActiveTeam();
00050   void LoadGamingData(uint how_many_characters);
00051   void UnloadGamingData();
00052   void Clear();
00053 
00054 
00055   // Add a new team to playing, and change active team
00056   void AddTeam (const ConfigTeam& the_team_cfg, bool generate_error=true);
00057   void UpdateTeam (const ConfigTeam& the_team_cfg, bool generate_error=true);
00058   void DelTeam (const std::string &id);
00059   void SetActive(const std::string &id);
00060   void InitList (const std::list<ConfigTeam> &lst);
00061   void InitEnergy ();
00062   void RefreshEnergy (); //Refresh energy bar
00063   void RefreshSort (); //Refresh energy bar position
00064   void ChangeSelection (const std::list<uint>& liste);
00065   bool IsSelected (uint index);
00066 
00067   // Find a team by its id or index (in full_list)
00068   Team* FindById (const std::string &id, int &pos);
00069   Team* FindByIndex (uint index);
00070   // Find a team by its id or index (in playing full_list)
00071   Team* FindPlayingById(const std::string &id, uint &index);
00072   Team* FindPlayingByIndex(uint index);
00073 };
00074 
00075 extern TeamsList teams_list;
00076 //-----------------------------------------------------------------------------
00077 
00078 // current active team
00079 Team& ActiveTeam();
00080 
00081 // current active character
00082 Character& ActiveCharacter();
00083 
00084 //-----------------------------------------------------------------------------
00085 
00086 bool compareTeams(const Team& a, const Team& b);
00087 
00088 //-----------------------------------------------------------------------------
00089 #endif

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