⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pkzoneinfomanager.h

📁 天之炼狱1服务器端源文件游戏服务端不完整
💻 H
字号:
#ifndef __PK_ZONE_INFO_MANAGER_H__#define __PK_ZONE_INFO_MANAGER_H__#include "Types.h"#include "Exception.h"#include <hash_map>#include "Mutex.h"#include "Cpackets/CGSay.h"class PKZoneInfo{public:	PKZoneInfo( ZoneID_t zoneID, ZoneCoord_t enterX, ZoneCoord_t enterY, ZoneCoord_t resX, ZoneCoord_t resY, Race_t race, int pcLimit )	{		m_ZoneID=zoneID;		m_EnterPosition.x=enterX;		m_EnterPosition.y=enterY;		m_ResurrectPosition.x=resX;		m_ResurrectPosition.y=resY;		m_bFree=race>1;		m_Race=race;		m_PCLimit=pcLimit;		m_CurrentPCNum=0;	}	~PKZoneInfo() { }	ZoneID_t	getZoneID() const { return m_ZoneID; }	bool		isFree() const { return m_bFree; }	Race_t		getRace() const { return m_Race; }	ZoneCoord_t	getEnterX() const { return m_EnterPosition.x; }	ZoneCoord_t getEnterY() const { return m_EnterPosition.y; }	ZoneCoord_t	getResurrectX() const { return m_ResurrectPosition.x; }	ZoneCoord_t getResurrectY() const { return m_ResurrectPosition.y; }	int			getPCLimit() const { return m_PCLimit; }	int			getCurrentPCNum() const { return m_CurrentPCNum; }	bool		canEnter() const { return m_CurrentPCNum < m_PCLimit; }	bool		enterZone() { if ( canEnter() ) m_CurrentPCNum++; else return false; return true; }	bool		leaveZone() { if ( m_CurrentPCNum > 0 ) m_CurrentPCNum--; else return false; return true; }	void		lock() throw(Error) { m_Mutex.lock(); }	void		unlock() throw(Error) { m_Mutex.unlock(); }	string		toString() throw(Error);protected:	void		setCurrentPCNum( int num ) { if ( num <= m_PCLimit && num >= 0 ) m_CurrentPCNum = num; }	friend		void CGSayHandler::opcommand(GamePlayer*, string, int);private:	ZoneID_t	m_ZoneID;	bool		m_bFree;	Race_t		m_Race;	TPOINT		m_EnterPosition;	TPOINT		m_ResurrectPosition;	int			m_PCLimit;	int			m_CurrentPCNum;	mutable Mutex		m_Mutex;};class PKZoneInfoManager{public:	typedef hash_map<ZoneID_t,PKZoneInfo*> PKZoneInfoMap;public:	PKZoneInfoManager() { }	~PKZoneInfoManager() { }	void		load() throw(Error);	void		addPKZoneInfo( PKZoneInfo* pPKZoneInfo ) throw(Error);	PKZoneInfo*	getPKZoneInfo( ZoneID_t	zoneID ) const throw(Error);	bool		isPKZone( ZoneID_t zoneID ) const throw(Error);	bool		canEnterPKZone( ZoneID_t zoneID ) throw(Error);	bool		enterPKZone( ZoneID_t zoneID ) throw(Error);	bool		leavePKZone( ZoneID_t zoneID ) throw(Error);	bool		getResurrectPosition( ZoneID_t zoneID, ZONE_COORD& zoneCoord ) const throw(Error);private:	PKZoneInfoMap m_PKZoneInfos;};extern PKZoneInfoManager* g_pPKZoneInfoManager;#endif// __PK_ZONE_INFO_MANAGER_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -