本文整理汇总了C++中SmallSet::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ SmallSet::IsEmpty方法的具体用法?C++ SmallSet::IsEmpty怎么用?C++ SmallSet::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmallSet
的用法示例。
在下文中一共展示了SmallSet::IsEmpty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetSignalsOnBothDir
/**
* Update signals at segments that are at both ends of
* given (existent or non-existent) track
*
* @see UpdateSignalsInBuffer()
* @param tile tile where we start
* @param track track at which ends we will update signals
* @param owner owner whose signals we will update
*/
void SetSignalsOnBothDir(TileIndex tile, Track track, Owner owner)
{
assert(_globset.IsEmpty());
AddTrackToSignalBuffer(tile, track, owner);
UpdateSignalsInBuffer(owner);
}
示例2: UpdateSignalsOnSegment
/**
* Update signals, starting at one side of a tile
* Will check tile next to this at opposite side too
*
* @see UpdateSignalsInBuffer()
* @param tile tile where we start
* @param side side of tile
* @param owner owner whose signals we will update
* @return the state of the signal segment
*/
SigSegState UpdateSignalsOnSegment(TileIndex tile, DiagDirection side, Owner owner)
{
assert(_globset.IsEmpty());
_globset.Add(tile, side);
return UpdateSignalsInBuffer(owner);
}
示例3: UpdateSignalsInBuffer
/**
* Update signals in buffer
* Called from 'outside'
*/
void UpdateSignalsInBuffer()
{
if (!_globset.IsEmpty()) {
UpdateSignalsInBuffer(_last_owner);
_last_owner = INVALID_OWNER; // invalidate
}
}
示例4: AddSideToSignalBuffer
/**
* Add side of tile to signal update buffer
*
* @param tile tile where we start
* @param side side of tile
* @param owner owner whose signals we will update
*/
void AddSideToSignalBuffer(TileIndex tile, DiagDirection side, Owner owner)
{
/* do not allow signal updates for two companies in one run */
assert(_globset.IsEmpty() || owner == _last_owner);
_last_owner = owner;
_globset.Add(tile, side);
if (_globset.Items() >= SIG_GLOB_UPDATE) {
/* too many items, force update */
UpdateSignalsInBuffer(_last_owner);
_last_owner = INVALID_OWNER;
}
}
示例5: AddTrackToSignalBuffer
/**
* Add track to signal update buffer
*
* @param tile tile where we start
* @param track track at which ends we will update signals
* @param owner owner whose signals we will update
*/
void AddTrackToSignalBuffer(TileIndex tile, Track track, Owner owner)
{
static const DiagDirection _search_dir_1[] = {
DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE
};
static const DiagDirection _search_dir_2[] = {
DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE
};
/* do not allow signal updates for two companies in one run */
assert(_globset.IsEmpty() || owner == _last_owner);
_last_owner = owner;
_globset.Add(tile, _search_dir_1[track]);
_globset.Add(tile, _search_dir_2[track]);
if (_globset.Items() >= SIG_GLOB_UPDATE) {
/* too many items, force update */
UpdateSignalsInBuffer(_last_owner);
_last_owner = INVALID_OWNER;
}
}