File indexing completed on 2024-05-05 08:08:35

0001 /* This file is part of KsirK.
0002    Copyright (C) 2002-2007 Gael de Chalendar <kleag@free.fr>
0003 
0004    KsirK is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU General Public
0006    License as published by the Free Software Foundation, either version 2
0007    of the License, or (at your option) any later version.
0008 
0009    This program is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    General Public License for more details.
0013 
0014    You should have received a copy of the GNU General Public License
0015    along with this program; if not, write to the Free Software
0016    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0017    02110-1301, USA
0018 */
0019 
0020 #ifndef KSIRKSKINEDITORCONTINENT_H
0021 #define KSIRKSKINEDITORCONTINENT_H
0022 
0023 #include "country.h"
0024 
0025 namespace KsirkSkinEditor
0026 {
0027 
0028 /**
0029   * This class represents a continent of the world. Each country belongs to 
0030   * a continent. When a player owns all the countries of a continent, he wins 
0031   * more armies. It is the basic object on which the strategies are based.
0032   * @author Gael de Chalendar (aka Kleag)
0033   */
0034 class Continent
0035 {
0036 public:
0037   /** 
0038     * The constructor-initializer.
0039     * @param myName The name of this continent.
0040     * @param myCountries The countries that will be member of this continent.
0041     * @param myBonus The bonus of armies at end of turn for the player owning 
0042     * all this continent.
0043     * @param id The unique integer id of this continent.
0044     */
0045   Continent (const QString &myName, const QList<Country*>& myCountries,
0046     const int myBonus);
0047 
0048   /** Default destructor. */
0049   virtual ~Continent();
0050 
0051   /**
0052     * Read property of m_members, the countries of this continent.
0053     */
0054   inline QList<Country*>& members() {return m_members;}
0055 
0056   /** Return the name of this continent. */
0057   inline const QString& name() const {return m_name;}
0058 
0059   /** 
0060     * Return the bonus of armies at end of turn for the player owning all this 
0061     * continent.
0062     */
0063   inline int bonus() const {return m_bonus;}
0064   inline void setBonus(int b) {m_bonus = b;}
0065   
0066   /**
0067     * Saves a XML representation of this continent for game saving purpose
0068     * @param xmlStream The stream to write on
0069     */
0070 //   void saveXml(std::ostream& xmlStream);
0071 
0072   //@{
0073   /** Accessors to the unique integer identifier of this continent. */
0074 /*  inline unsigned int id() const {return m_id;}
0075   inline unsigned int id() {return m_id;}
0076   inline void setId(unsigned int id) {m_id = id;}*/
0077   //@}
0078 
0079 private: // Private attributes
0080 
0081   /** This is the list of the countries that forms this continent. This member
0082     * is constant as it will not change during the game.
0083     */
0084   QList<Country*> m_members;
0085 
0086   /** The name of the continent */
0087   const QString m_name;
0088 
0089   /** The bonus armies got by a user that owns all this continent */
0090   unsigned int m_bonus;
0091 
0092   /** The unique integer identifier of this continent. */
0093 //   unsigned int m_id;
0094 };
0095 
0096 }
0097 #endif