TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GroupMgr.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef _GROUPMGR_H
19 #define _GROUPMGR_H
20 
21 #include "Group.h"
22 
24 {
25 private:
26  GroupMgr();
27  ~GroupMgr();
28 
29 public:
30  static GroupMgr* instance();
31 
32  typedef std::map<ObjectGuid::LowType, Group*> GroupContainer;
33  typedef std::vector<Group*> GroupDbContainer;
34 
35  Group* GetGroupByGUID(ObjectGuid const& guid) const;
36 
37  uint32 GenerateNewGroupDbStoreId();
38  void RegisterGroupDbStoreId(uint32 storageId, Group* group);
39  void FreeGroupDbStoreId(Group* group);
40  void SetNextGroupDbStoreId(uint32 storageId) { NextGroupDbStoreId = storageId; };
41  Group* GetGroupByDbStoreId(uint32 storageId) const;
42  void SetGroupDbStoreSize(uint32 newSize) { GroupDbStore.resize(newSize); }
43 
44  void LoadGroups();
45  ObjectGuid::LowType GenerateGroupId();
46  void AddGroup(Group* group);
47  void RemoveGroup(Group* group);
48 
49  void Update(uint32 diff);
50 
51 
52 protected:
55  GroupContainer GroupStore;
56  GroupDbContainer GroupDbStore;
57 };
58 
59 #define sGroupMgr GroupMgr::instance()
60 
61 #endif
uint64 LowType
Definition: ObjectGuid.h:199
GroupDbContainer GroupDbStore
Definition: GroupMgr.h:56
void SetNextGroupDbStoreId(uint32 storageId)
Definition: GroupMgr.h:40
Definition: GroupMgr.h:23
uint32 NextGroupDbStoreId
Definition: GroupMgr.h:54
ObjectGuid::LowType NextGroupId
Definition: GroupMgr.h:53
GroupContainer GroupStore
Definition: GroupMgr.h:55
uint32_t uint32
Definition: Define.h:150
std::vector< Group * > GroupDbContainer
Definition: GroupMgr.h:33
std::map< ObjectGuid::LowType, Group * > GroupContainer
Definition: GroupMgr.h:32
void SetGroupDbStoreSize(uint32 newSize)
Definition: GroupMgr.h:42
#define TC_GAME_API
Definition: Define.h:134
Definition: ObjectGuid.h:189
void Update(uint32 diff)
Definition: WeatherMgr.cpp:150
Definition: Group.h:191