1 // Copyright (C) 2009, 2014 Ben Asselstine 2 // 3 // This program is free software; you can redistribute it and/or modify 4 // it under the terms of the GNU General Public License as published by 5 // the Free Software Foundation; either version 3 of the License, or 6 // (at your option) any later version. 7 // 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU Library General Public License for more details. 12 // 13 // You should have received a copy of the GNU General Public License 14 // along with this program; if not, write to the Free Software 15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 16 // 02110-1301, USA. 17 18 #pragma once 19 #ifndef OWNER_ID_H 20 #define OWNER_ID_H 21 22 23 #include <gtkmm.h> 24 class XML_Helper; 25 class Player; 26 27 //! A game object that refers to an owner 28 /** 29 * An OwnerID is an object that refers to a particular player. 30 */ 31 32 class OwnerId 33 { 34 public: 35 36 //! Default constructor. 37 OwnerId(guint32 owner); 38 39 //! Copy constructor. 40 OwnerId(const OwnerId&); 41 42 //! Loading constructor. 43 OwnerId(XML_Helper* helper); 44 45 //! Destructor. ~OwnerId()46 virtual ~OwnerId() {}; 47 48 // Get Methods 49 getOwnerId()50 guint32 getOwnerId() const {return d_owner_id;} 51 52 //! Return the Player who this id refers to 53 Player *getOwner() const ; 54 55 // Set Methods 56 setOwnerId(guint32 owner)57 void setOwnerId(guint32 owner){d_owner_id = owner; owner_id_set = true;}; 58 59 bool save(XML_Helper *helper) const; 60 61 // Static Methods 62 63 //! Callback for loading an Ownable object from an opened saved-game file. 64 static OwnerId load(XML_Helper *helper); 65 66 protected: 67 68 OwnerId(); 69 70 guint32 d_owner_id; 71 bool owner_id_set; 72 }; 73 74 #endif 75