src/weapon/weapons_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  * Refresh des armes.
00020  *****************************************************************************/
00021 
00022 #ifndef WEAPONS_LIST_H
00023 #define WEAPONS_LIST_H
00024 //-----------------------------------------------------------------------------
00025 #include <list>
00026 #include <map>
00027 #include "weapon.h"
00028 #include "../include/base.h"
00029 //-----------------------------------------------------------------------------
00030 
00031 // Classe de gestion des armes
00032 class WeaponsList
00033 {
00034 public:
00035   typedef std::list<Weapon*> weapons_list_type;
00036   typedef std::list<Weapon*>::iterator weapons_list_it;
00037 
00038 private:
00039   weapons_list_type m_weapons_list;
00040 
00041   // The int is used to classify weapon by sort
00042   std::multimap<uint, Weapon*> m_weapons_map;
00043   typedef std::multimap<uint, Weapon*>::value_type keybind;
00044   typedef std::multimap<uint, Weapon*>::iterator weapons_map_it;
00045   void AddToList(Weapon* arme, uint num_sort);
00046   Weapon* GetNextWeapon(uint sort, uint index);
00047 
00048 public:
00049   WeaponsList();
00050   ~WeaponsList();
00051   void Init();
00052 
00053   // Refresh des armes
00054   // Retourne true si c'est la fin d'un tour
00055   void Refresh();
00056 
00057   // Return a list of  weapons
00058   weapons_list_type& GetList();
00059   Weapon* GetWeapon(Weapon::Weapon_type type);
00060   bool GetWeaponBySort(uint num_sort, Weapon::Weapon_type &type);
00061 };
00062 
00063 //-----------------------------------------------------------------------------
00064 #endif

Generated on Mon Jan 1 13:11:00 2007 for Wormux by  doxygen 1.4.7