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

📄 visioninfo.h

📁 天之炼狱1服务器端源文件游戏服务端不完整
💻 H
字号:
////////////////////////////////////////////////////////////////////////////////// Filename    : VisionInfo.h// Written By  : Reiot// Description :////////////////////////////////////////////////////////////////////////////////#ifndef __VISIONINFO_H__#define __VISIONINFO_H__#include "Types.h"#include "Exception.h"const Coord_t maxViewportWidth  = 10;const Coord_t maxViewportUpperHeight = 14;const Coord_t maxViewportLowerHeight = 14;const Coord_t maxVisionWidth = maxViewportWidth * 2 + 1;const Coord_t maxVisionHeight = maxViewportUpperHeight + maxViewportLowerHeight + 1;////////////////////////////////////////////////////////////////////////////////// class VisionInfo;// P(x,y) 啊 矫具 饭骇捞 Sight 捞哥, 漂沥 规氢(dir)阑 官扼焊绰 O(cx,cy) 困摹狼 // 农府贸啊 杭 荐 乐绰瘤狼 咯何甫 繁鸥烙俊 拌魂窍瘤 臼绊, 捞固 拌魂等 蔼阑 矫具 // 饭骇苞 规氢喊 矫具 荤阿屈俊 历厘秦滴搁 矫具 眉农甫 焊促 弧府 且 荐 乐霸 等促.// 捞 努贰胶绰, 捞 锭 荤侩登绰 矫具 荤阿屈阑 唱鸥辰促./////////////////////////////////////////////////////////////////////////////////*class VisionInfo {public:	VisionState getVisionState(ZoneCoord_t cx, ZoneCoord_t cy, ZoneCoord_t x, ZoneCoord_t y) const throw()	{		// inline for speed. by sigi. 2002.11.8//		int px = x + (maxViewportWidth + 1) - cx;//		int py = y + (maxViewportUpperHeight + 1) - cy;		int px = x + (maxViewportWidth) - cx;		int py = y + (maxViewportUpperHeight) - cy;		// 乞青捞悼茄 谅钎狼 裹困甫 眉农茄促.		if (px >= 0 && px < maxVisionWidth && py >= 0 && py < maxVisionHeight)			return m_Rect[px][py];		return OUT_OF_SIGHT;	}	string toString() const throw();		private:	// 矫具 饭骇(0 - 13)	Sight_t m_Sight;	// 官扼焊绰 规氢	Dir_t m_Dir;	// viewport rectangle	VisionState m_Rect[maxVisionWidth][maxVisionHeight];	// deprecated. 捞 努贰胶绰 歹捞惑 救 敬促.	VisionInfo(Sight_t sight, Dir_t dir) throw();	~VisionInfo();};*/////////////////////////////////////////////////////////////////////////////////// class VisionInfoManager;// 矫具 沥焊甫 包府窍哥, 矫具 饭骇苞 规氢阑 林搁 弊俊 秦寸窍绰 矫具 沥焊甫 府畔茄促.////////////////////////////////////////////////////////////////////////////////class VisionInfoManager {public:	VisionInfoManager() throw() {}	~VisionInfoManager() throw();public:	// init vision info	void init() throw();	// get vision info/*	VisionInfo* getVisionInfo(Sight_t sight, Dir_t dir) //throw(OutOfBoundException)	{		// for speed. by sigi. 2002.11.8		//__BEGIN_TRY		//if (sight > maxSight) throw OutOfBoundException("sight overflow");		//if (dir >= DIR_MAX) throw OutOfBoundException("dir overflow");		return m_pVisionInfos[sight][dir];		//__END_CATCH	}*/	static VisionState getVisionState( ZoneCoord_t SourceX, ZoneCoord_t SourceY, ZoneCoord_t TargetX, ZoneCoord_t TargetY )	{		int diffX = abs( TargetX-SourceX );		int diffY = (int)TargetY-(int)SourceY;		bool isInX = diffX <= maxViewportWidth;		bool isInY = (diffY<0)?			((-diffY)<=maxViewportUpperHeight):			(diffY<=maxViewportLowerHeight);		return (isInX&&isInY)?IN_SIGHT:OUT_OF_SIGHT;	}	// get debug string	string toString() const throw();private:	// VisionInfo狼 捞瞒盔 硅凯//	VisionInfo *** m_pVisionInfos;};// global variable declarationextern VisionInfoManager* g_pVisionInfoManager;#endif

⌨️ 快捷键说明

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