1 | /* |
---|
2 | * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> |
---|
3 | * |
---|
4 | * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> |
---|
5 | * |
---|
6 | * This program is free software; you can redistribute it and/or modify |
---|
7 | * it under the terms of the GNU General Public License as published by |
---|
8 | * the Free Software Foundation; either version 2 of the License, or |
---|
9 | * (at your option) any later version. |
---|
10 | * |
---|
11 | * This program is distributed in the hope that it will be useful, |
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | * GNU General Public License for more details. |
---|
15 | * |
---|
16 | * You should have received a copy of the GNU General Public License |
---|
17 | * along with this program; if not, write to the Free Software |
---|
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
19 | */ |
---|
20 | |
---|
21 | /// \addtogroup realmd |
---|
22 | /// @{ |
---|
23 | /// \file |
---|
24 | |
---|
25 | #ifndef _REALMLIST_H |
---|
26 | #define _REALMLIST_H |
---|
27 | |
---|
28 | #include "Common.h" |
---|
29 | |
---|
30 | /// Storage object for a realm |
---|
31 | struct Realm |
---|
32 | { |
---|
33 | std::string name; |
---|
34 | std::string address; |
---|
35 | uint8 icon; |
---|
36 | uint8 color; |
---|
37 | uint8 timezone; |
---|
38 | uint32 m_ID; |
---|
39 | AccountTypes allowedSecurityLevel; |
---|
40 | float populationLevel; |
---|
41 | }; |
---|
42 | |
---|
43 | /// Storage object for the list of realms on the server |
---|
44 | class RealmList |
---|
45 | { |
---|
46 | public: |
---|
47 | typedef std::map<std::string, Realm> RealmMap; |
---|
48 | |
---|
49 | RealmList(); |
---|
50 | ~RealmList() {} |
---|
51 | |
---|
52 | void Initialize(uint32 updateInterval); |
---|
53 | |
---|
54 | void UpdateIfNeed(); |
---|
55 | |
---|
56 | RealmMap::const_iterator begin() const { return m_realms.begin(); } |
---|
57 | RealmMap::const_iterator end() const { return m_realms.end(); } |
---|
58 | uint32 size() const { return m_realms.size(); } |
---|
59 | private: |
---|
60 | void UpdateRealms(bool init); |
---|
61 | void UpdateRealm( uint32 ID, std::string name, std::string address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu); |
---|
62 | private: |
---|
63 | RealmMap m_realms; ///< Internal map of realms |
---|
64 | uint32 m_UpdateInterval; |
---|
65 | time_t m_NextUpdateTime; |
---|
66 | }; |
---|
67 | #endif |
---|
68 | /// @} |
---|