initial commit, lordsawar source, slightly modified
[lordsawar] / src / OwnerId.h
1 //  Copyright (C) 2009 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 #ifndef OWNER_ID_H
19 #define OWNER_ID_H
20
21
22 #include <gtkmm.h>
23 class XML_Helper;
24 class Player;
25
26 //! A game object that refers to an owner
27 /** 
28  * An OwnerID is an object that refers to a particular player.
29  */
30
31 class OwnerId
32 {
33  public:
34
35      //! Default constructor.
36      OwnerId(guint32 owner);
37
38      //! Copy constructor.
39      OwnerId(const OwnerId&);
40
41      //! Loading constructor.
42      OwnerId(XML_Helper* helper);
43
44      //! Destructor.
45     virtual ~OwnerId();
46     
47     // Get Methods
48
49     guint32 getOwnerId() const {return d_owner_id;}
50
51     //! Return the Player who this id refers to
52     Player *getOwner() const ;
53
54     // Set Methods
55
56     void setOwnerId(guint32 owner){d_owner_id = owner; owner_id_set = true;};
57
58     bool save(XML_Helper *helper) const;
59
60     // Static Methods
61
62     //! Callback for loading an Ownable object from an opened saved-game file.
63     static OwnerId load(XML_Helper *helper);
64
65  protected:
66
67     OwnerId();
68
69     guint32 d_owner_id;
70     bool owner_id_set;
71 };
72
73 #endif