[2771] Applied MaNGOS coding style (see trunk/bcpp.cfg).
[mangos-git.git] / src / game / BattleGroundMgr.h
blobf65806d8397808302acd0943330c7ad29dabfb59
1 /*
2 * Copyright (C) 2005,2006 MaNGOS <http://www.mangosproject.org/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef __BATTLEGROUNDMGR_H
20 #define __BATTLEGROUNDMGR_H
22 #include "BattleGround.h"
23 #include "Policies/Singleton.h"
25 class BattleGround;
27 class BattleGroundMgr
29 public:
30 /* Construction */
31 BattleGroundMgr();
32 ~BattleGroundMgr();
34 /* Packet Building */
35 void BuildPlayerLeftBattleGroundPacket(WorldPacket* data, Player* plr);
36 void BuildPlayerJoinedBattleGroundPacket(WorldPacket* data, Player* plr);
38 void BuildBattleGroundListPacket(WorldPacket* data, uint64 guid, Player* plr);
40 /* Battlegrounds */
41 inline std::map<uint32, BattleGround*>::iterator GetBattleGroundsBegin() { return m_BattleGrounds.begin(); };
43 inline std::map<uint32, BattleGround*>::iterator GetBattleGroundsEnd() { return m_BattleGrounds.end(); };
45 inline BattleGround* GetBattleGround(uint8 ID)
47 std::map<uint32, BattleGround*>::iterator i = m_BattleGrounds.find(ID);
48 if(i != m_BattleGrounds.end())
49 return i->second;
50 else
51 return NULL;
53 uint32 CreateBattleGround(uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, std::string BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO);
55 inline void AddBattleGround(uint32 ID, BattleGround* BG) { m_BattleGrounds[ID] = BG; };
57 void CreateInitialBattleGrounds();
59 uint32 GenerateTeamByRace(uint8 Race);
61 void AddPlayerToBattleGround(Player *pl, uint32 bgId);
62 void SendToBattleGround(Player *pl, uint32 teamId, uint32 bgId);
64 void SendBattleGroundStatusPacket(Player *pl, uint32 MapID, uint8 InstanceID, uint8 StatusID, uint32 Time = 0x00FFFF00);
66 private:
68 /* Battlegrounds */
69 typedef std::map<uint32, BattleGround*> BattleGroundSet;
70 BattleGroundSet m_BattleGrounds;
73 #define sBattleGroundMgr MaNGOS::Singleton<BattleGroundMgr>::Instance()
74 #endif