本文整理汇总了C++中Coord::effect方法的典型用法代码示例。如果您正苦于以下问题:C++ Coord::effect方法的具体用法?C++ Coord::effect怎么用?C++ Coord::effect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Coord
的用法示例。
在下文中一共展示了Coord::effect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lineOfSight
// Check the line of sight from a source to a target coordinate.
bool Coord::lineOfSight( const Coord& target, bool debug ) const
{
// If the target is out of range, save cpu time by not calculating the
// line of sight
if ( map != target.map || distance( target ) > 25 )
{
return false;
}
// LoS always succeeds for the same points
if ( *this == target )
{
return true;
}
QList<Coord> pointList = getPointList( *this, target );
int lastX = -1, lastY = -1;
QList<stBlockingItem> blockingItems;
QList<Coord>::const_iterator it;
for ( it = pointList.begin(); it != pointList.end(); ++it )
{
Coord point = *it;
// Get a fresh tile-list
if ( point.x != lastX || point.y != lastY )
{
blockingItems.clear();
getBlockingTiles( point, blockingItems );
lastX = point.x;
lastY = point.y;
}
// Check if there are blocking map, static or dynamic items.
bool blocked = checkBlockingTiles( blockingItems, point, target );
// Play an effect for the tile
if ( blocked )
{
if ( debug )
{
point.effect( 0x181D, 10, 50, 0x21 );
}
return false;
}
else if ( debug )
{
point.effect( 0x181D, 10, 50, 0x44 );
}
}
return true;
}