Pol  Revision:cb584c9
guilds.h
Go to the documentation of this file.
1 #ifndef GUILDS_H
2 #define GUILDS_H
3 
4 #include "../clib/refptr.h"
5 #include "proplist.h"
6 
7 namespace Pol
8 {
9 namespace Clib
10 {
11 class ConfigElem;
12 class StreamWriter;
13 }
14 namespace Mobile
15 {
16 class Character;
17 }
18 namespace Module
19 {
20 class EGuildRefObjImp;
21 }
22 namespace Core
23 {
24 class SerialSet : public std::set<unsigned int>
25 {
26 public:
27  SerialSet( Clib::ConfigElem& elem, const char* tag );
28  SerialSet() {}
29  void writeOn( Clib::StreamWriter& sw, const char* tag ) const;
30 };
31 
32 class Guild : public ref_counted
33 {
34 public:
35  explicit Guild( Clib::ConfigElem& elem );
36  explicit Guild( unsigned int guildid );
37 
38  unsigned int guildid() const;
39  bool disbanded() const;
40  bool hasMembers() const;
41  bool hasAllies() const;
42  bool hasEnemies() const;
43 
44  bool hasAlly( const Guild* g2 ) const;
45  bool hasEnemy( const Guild* g2 ) const;
46 
47  void disband();
48 
49  void update_online_members();
50  static void update_online_members_remove( Mobile::Character* chr );
51 
52  void printOn( Clib::StreamWriter& sw ) const;
53  void addMember( unsigned int serial );
54 
55  void registerWithMembers();
56  size_t estimateSize() const;
57 
58  static bool AreAllies( Guild* g1, Guild* g2 );
59  static bool AreEnemies( Guild* g1, Guild* g2 );
60  static Guild* FindGuild( unsigned int guildid );
61  static Guild* FindOrCreateGuild( unsigned int guildid, unsigned int memberserial );
62 
64 
65 private:
66  unsigned int _guildid;
71  bool _disbanded;
72 };
73 }
74 }
75 #endif
bool _disbanded
Definition: guilds.h:71
unsigned int _guildid
Definition: guilds.h:66
SerialSet _member_serials
Definition: guilds.h:67
Guild Object Properties: guild.guildid : integer guild.members : array of offline mobilerefs guild...
Definition: guildmod.cpp:71
PropertyList _proplist
Definition: guilds.h:70
SerialSet _allyguild_serials
Definition: guilds.h:68
SerialSet _enemyguild_serials
Definition: guilds.h:69
Definition: berror.cpp:12