www.pudn.com > back.rar > block.h


//_________________________________________________________________________________ 
// 
//	Block.H 
// 
// ºí·° = ŸÀÏ 
// 
//_________________________________________________________________________________ 
// 
 
 
#ifndef _BOLCK_H_ 
	#define _BOLCK_H_ 
 
struct Warp_Info 
{ 
	Warp_Info() { m_My_ID = -1; m_Map_ID = -1; m_Map_Warp = -1; } 
	int		m_My_ID;		// ÇöÀç ¿öÇÁ Á¸ÀÌ ¸î¹øÀΰ¡.. 
	int		m_Map_ID;		// ¿öÇÁÁ¸ÀÌ ¿¬°áµÉ ¸Ê ¹øÈ£ 
	int		m_Map_Warp;		// ¿¬°áµÉ ¸ÊÀÇ ¿öÇÁ ¹øÈ£ 
	int		m_Map_Size;		// ¿¬°áµÉ ¸ÊÀÇ Å©±â..ÁÂÇ¥ °è»ê¿¡ ÇÊ¿ä 
	int		m_X; 
	int		m_Y; 
}; 
 
struct Block 
{ 
	Block() 
	{ 
		static int i; 
		for( i = 0; i < 1; i++ )  
		{ 
			m_is_blocked[i] = false;	 
			m_someone_is_in[i] = false; 
			m_avail_PK[i] = true; 
			m_is_linked[i] = false; 
			 
			m_item_stack[i] = 0;		// item index¿¡¼­ -1Àº ¾ø´Â°Í 
		} 
		//newwarp 20050601  
		m_dwWorparray = -1;				// ºó°Å		 
	} 
	DWORD			m_item_stack[1]; 
 
	bool			m_is_blocked[1];		// À̵¿ °¡´É À¯¹« 
	bool			m_someone_is_in[1];		// ¾î¶² ij¸¯ÅÍÀÇ Á¸Àç À¯¹« 
	bool			m_avail_PK[1];			// PK°¡´É ¿©ºÎ 
	bool			m_is_linked[1]; 
 
	//newwarp 20050601  
	//Warp_Info		m_Warp;					// ¿öÇÁ´Â Ãþ¿¡ »ó°ü¾øÀÌ Çѹø 
	int				m_dwWorparray;			// ¿öÇÁ Á¤º¸ ¹è¿­ -1´Â ºó°Å 
 
	DWORD			m_pos;				// ÇØ´ç ŸÀÏÀÇ ¹øÈ£ 
	int				m_xblock;			// ŸÀÏÀÌ ¼ÓÇÏ´Â xblock ¹øÈ£ 
	int				m_cell;				// ŸÀÏÀÌ ¼ÓÇÏ´Â xblockÀÇ cell¹øÈ£ 
}; 
 
struct block 
{ 
	block() 
	{ 
		m_item_stack = 0;		// item index¿¡¼­ -1Àº ¾ø´Â°Í 
 
		m_is_blocked = false;	 
		m_someone_is_in = false; 
		m_avail_PK = true; 
		m_is_linked = false; 
	} 
 
	DWORD			m_item_stack; 
 
	bool			m_is_blocked;		// À̵¿ °¡´É À¯¹« 
	bool			m_someone_is_in;		// ¾î¶² ij¸¯ÅÍÀÇ Á¸Àç À¯¹« 
	bool			m_avail_PK;			// PK°¡´É ¿©ºÎ 
	bool			m_is_linked; 
 
	Warp_Info		m_Warp;					// ¿öÇÁ´Â Ãþ¿¡ »ó°ü¾øÀÌ Çѹø 
 
}; 
 
//_________________________________________________________________________________ 
// 
//	block class 
//_________________________________________________________________________________ 
// 
class CBlock 
{ 
	public: 
		CBlock( ); 
		~CBlock( ); 
		void	Block_Init( DWORD tile_no, int map_size );		// block no, xblock no, cell noÃʱâÈ­ 
		void	Set_Block( block bl, int floor );					// CBlockÀÇ blockÁ¤º¸ ¼¼ÆÃ 
 
		//newwarp 20060501 
		//int		Return_Warp_My_ID() const { return m_tile.m_Warp.m_My_ID; }				// ¿öÇÁ °ü·Ã 
		//int		Return_Warp_To_Map() const { return m_tile.m_Warp.m_Map_ID; }			// ¿öÇÁ °ü·Ã 
		//int		Return_Warp_To_WarpIndex() const { return m_tile.m_Warp.m_Map_Warp;}	// ¿öÇÁ °ü·Ã 
		int		Return_Warp_My_ID() const;				// ¿öÇÁ °ü·Ã 
		int		Return_Warp_To_Map() const;		// ¿öÇÁ °ü·Ã 
		int		Return_Warp_To_WarpIndex() const;	// ¿öÇÁ °ü·Ã 
 
		DWORD	Return_Pos() const { return m_tile.m_pos; }								// ÇöÀç ŸÀÏ ¹øÈ£ ¸®ÅÏ 
		int		Return_Xblock_No() const { return m_tile.m_xblock; }					// ÇöÀç ŸÀÏÀÌ ¼ÓÇÏ´Â xblock¹øÈ£ ¸®ÅÏ 
		int		Return_Cell_No() const { return m_tile.m_cell; }						// ÇöÀç ŸÀÏÀÇ cell ¹øÈ£ 
		long	Return_User_Unique( int floor ) const { return m_user_unique[floor]; }	// ÇØ´çÃþÀÇ À¯Àú unique 
 
		bool	Can_Move( int floor );			// ÇØ´ç ÃþÀ¸·Î À̵¿ÇÒ¼ö ÀÖ³ª? 
		void	Block_Free( int floor)			// ÇØ´ç Ãþ free 
		{  
			if( floor < 0 || floor >= 3 ) 
				floor = 0; 
			m_tile.m_someone_is_in[floor] = false; m_user_unique[floor] = -1;		//	ºóºí·°À¸·Î ¼³Á¤ 
		} 
		void	Block_Occupy( long unique, int floor )		// ÇØ´ç Ãþ ´©±º°¡ ÀÖ´Â ºí·°À¸·Î ¼³Á¤ 
		{  
			if( floor < 0 || floor >= 3 ) 
				floor = 0; 
			m_tile.m_someone_is_in[floor] = true;  
			m_user_unique[floor] = unique; 
		} 
 
		bool	Return_is_Blocked( int floor ) { return m_tile.m_is_blocked[floor];	}		// ÇØ´çÃþ blockÀÇ blocking¿©ºÎ 
		bool	Return_Someone_is_in( int floor ) { return m_tile.m_someone_is_in[floor]; }	// ÇØ´çÃþÀÇ ¼±Á¡ 
		bool	Return_Avail_PK( int floor ) { return m_tile.m_avail_PK[floor];	}			// ÇØ´ç ÃþÀÇ pk°¡´É 
		bool	Return_is_Linked( int floor ) { return m_tile.m_is_linked[floor]; }			// ÇØ´çÃþÀÌ warp°¡´É 
 
		void	NPC_Block_Free( int floor)				// npc°¡ ±× ºí·°,Ãþ¿¡¼­ ¹þ¾î³² 
		{ 
			if( floor < 0 || floor >= 3 ) 
				floor = 0; 
			m_tile.m_someone_is_in[floor] = false; m_NPC_index[floor] = -1;		//	ºóºí·°À¸·Î ¼³Á¤ 
		}	 
		void	NPC_Block_Occupy( int npc_index, int floor )		// npc°¡ ±× ºí·°, Ãþ¿¡ ¿È 
		{  
			if( floor < 0 || floor >= 3 ) 
				floor = 0; 
			m_tile.m_someone_is_in[floor] = true;  
			m_NPC_index[floor] = npc_index; 
		}	//	´©±º°¡ ÀÖ´Â ºí·°À¸·Î ¼³Á¤ 
 
		void	Drop_Item( DWORD item, int floor ) 
		{ 
			if( floor < 0 || floor >= 3 ) 
				floor = 0; 
			m_tile.m_item_stack[floor] = item; 
		} 
 
		int		Return_Item_Index( int floor ) 
		{ 
			if( floor < 0 || floor >= 3 ) 
				floor = 0; 
			return m_tile.m_item_stack[floor]; 
		} 
 
		int		Return_NPC( int floor ) 
		{ 
			if( floor < 0 || floor >= 3 ) 
				floor = 0; 
			return m_NPC_index[floor]; 
		} 
	private: 
		long	m_user_unique[3]; 
		int		m_NPC_index[3];		// npc table¿¡¼­ »Ì¾Æ³¾ index ¶Ç´Â ¼­¹öÀÇ npc¹è¿­¿¡ µé¾îÀÖ´Â ¹è¿­ ¹øÈ£ 
	public: 
		Block			m_tile; 
}; 
 
 
 
#endif 
 
 
//_________________________________________________________________________________ 
//	 
//	end of Block.H 
//_________________________________________________________________________________ 
//