Dungeon Architect  17.0.0
SharpNav.RegionId Struct Reference

A RegionId is an identifier with flags marking borders. More...

Inheritance diagram for SharpNav.RegionId:

Public Member Functions

 RegionId (int id)
 Initializes a new instance of the RegionId struct without any flags. More...
 
 RegionId (int id, RegionFlags flags)
 Initializes a new instance of the RegionId struct. More...
 
bool Equals (RegionId other)
 Compares this instance with another instance of RegionId for equality, including flags. More...
 
bool Equals (int other)
 Compares this instance with another an intenger for equality, including flags. More...
 
override bool Equals (object obj)
 Compares this instance with an object for equality. More...
 
override int GetHashCode ()
 Gets a unique hash code for this instance. More...
 
override string ToString ()
 Gets a human-readable version of this instance. More...
 

Static Public Member Functions

static RegionId FromRawBits (int bits)
 Creates a new RegionId from a value that contains both the region ID and the flags. More...
 
static RegionId WithFlags (RegionId region, RegionFlags flags)
 Creates a new RegionId with extra flags. More...
 
static RegionId WithoutFlags (RegionId region)
 Creates a new instance of the RegionId class without any flags set. More...
 
static RegionId WithoutFlags (RegionId region, RegionFlags flags)
 Creates a new instance of the RegionId class without certain flags set. More...
 
static bool HasFlags (RegionId region, RegionFlags flags)
 Checks if a region has certain flags. More...
 
static bool operator== (RegionId left, int right)
 Compares an instance of RegionId with an integer for equality. More...
 
static bool operator!= (RegionId left, int right)
 Compares an instance of RegionId with an integer for inequality. More...
 
static bool operator== (RegionId left, RegionId right)
 Compares two instances of RegionId for equality. More...
 
static bool operator!= (RegionId left, RegionId right)
 Compares two instances of RegionId for inequality. More...
 
static operator int (RegionId id)
 Converts an instance of RegionId to an integer containing both the ID and the flags. More...
 

Static Public Attributes

static readonly RegionId Null = new RegionId(0, 0)
 A null region is one with an ID of 0. More...
 
const int MaskId = 0x1fffffff
 A bitmask More...
 

Properties

int Id [get]
 Gets the ID of the region without any flags. More...
 
RegionFlags Flags [get]
 Gets the flags set for this region. More...
 
bool IsNull [get]
 Gets a value indicating whether the region is the null region (ID == 0). More...
 

Detailed Description

A RegionId is an identifier with flags marking borders.

Definition at line 35 of file Region.cs.

Constructor & Destructor Documentation

◆ RegionId() [1/2]

SharpNav.RegionId.RegionId ( int  id)

Initializes a new instance of the RegionId struct without any flags.

Parameters
idThe identifier.

Definition at line 57 of file Region.cs.

◆ RegionId() [2/2]

SharpNav.RegionId.RegionId ( int  id,
RegionFlags  flags 
)

Initializes a new instance of the RegionId struct.

Parameters
id
flags

Definition at line 67 of file Region.cs.

Member Function Documentation

◆ Equals() [1/3]

bool SharpNav.RegionId.Equals ( int  other)

Compares this instance with another an intenger for equality, including flags.

Parameters
otherAn integer.
Returns
A value indicating whether the two instances are equal.

Definition at line 301 of file Region.cs.

◆ Equals() [2/3]

override bool SharpNav.RegionId.Equals ( object  obj)

Compares this instance with an object for equality.

Parameters
objAn object
Returns
A value indicating whether the two instances are equal.

Definition at line 314 of file Region.cs.

◆ Equals() [3/3]

bool SharpNav.RegionId.Equals ( RegionId  other)

Compares this instance with another instance of RegionId for equality, including flags.

Parameters
otherAn instance of RegionId.
Returns
A value indicating whether the two instances are equal.

Definition at line 283 of file Region.cs.

◆ FromRawBits()

static RegionId SharpNav.RegionId.FromRawBits ( int  bits)
static

Creates a new RegionId from a value that contains both the region ID and the flags.

Parameters
bitsThe int containing RegionId data.
Returns
A new instance of the RegionId struct with the specified data.

Definition at line 118 of file Region.cs.

◆ GetHashCode()

override int SharpNav.RegionId.GetHashCode ( )

Gets a unique hash code for this instance.

Returns
A hash code.

Definition at line 331 of file Region.cs.

◆ HasFlags()

static bool SharpNav.RegionId.HasFlags ( RegionId  region,
RegionFlags  flags 
)
static

Checks if a region has certain flags.

Parameters
regionThe region to check.
flagsThe flags to check.
Returns
A value indicating whether the region has all of the specified flags.

Definition at line 171 of file Region.cs.

◆ operator int()

static SharpNav.RegionId.operator int ( RegionId  id)
explicitstatic

Converts an instance of RegionId to an integer containing both the ID and the flags.

Parameters
idAn instance of RegionId.
Returns
An integer.

Definition at line 273 of file Region.cs.

◆ operator!=() [1/2]

static bool SharpNav.RegionId.operator!= ( RegionId  left,
int  right 
)
static

Compares an instance of RegionId with an integer for inequality.

This checks for both the ID and flags set on the region. If you want to only compare the IDs, use the following code:

RegionId left = ...;
int right = ...;
if (left.Id != right)
{
// ...
}
RegionId(int id)
Initializes a new instance of the RegionId struct without any flags.
Definition: Region.cs:57
Parameters
leftAn instance of RegionId.
rightAn integer.
Returns
A value indicating whether the two values are unequal.

Definition at line 217 of file Region.cs.

◆ operator!=() [2/2]

static bool SharpNav.RegionId.operator!= ( RegionId  left,
RegionId  right 
)
static

Compares two instances of RegionId for inequality.

This checks for both the ID and flags set on the regions. If you want to only compare the IDs, use the following code:

RegionId left = ...;
RegionId right = ...;
if (left.Id != right.Id)
{
// ...
}
Parameters
leftAn instance of RegionId.
rightAnother instance of RegionId.
Returns
A value indicating whether the two instances are unequal.

Definition at line 263 of file Region.cs.

◆ operator==() [1/2]

static bool SharpNav.RegionId.operator== ( RegionId  left,
int  right 
)
static

Compares an instance of RegionId with an integer for equality.

This checks for both the ID and flags set on the region. If you want to only compare the IDs, use the following code:

RegionId left = ...;
int right = ...;
if (left.Id == right)
{
// ...
}
Parameters
leftAn instance of RegionId.
rightAn integer.
Returns
A value indicating whether the two values are equal.

Definition at line 194 of file Region.cs.

◆ operator==() [2/2]

static bool SharpNav.RegionId.operator== ( RegionId  left,
RegionId  right 
)
static

Compares two instances of RegionId for equality.

This checks for both the ID and flags set on the regions. If you want to only compare the IDs, use the following code:

RegionId left = ...;
RegionId right = ...;
if (left.Id == right.Id)
{
// ...
}
Parameters
leftAn instance of RegionId.
rightAnother instance of RegionId.
Returns
A value indicating whether the two instances are equal.

Definition at line 240 of file Region.cs.

◆ ToString()

override string SharpNav.RegionId.ToString ( )

Gets a human-readable version of this instance.

Returns
A string representing this instance.

Definition at line 343 of file Region.cs.

◆ WithFlags()

static RegionId SharpNav.RegionId.WithFlags ( RegionId  region,
RegionFlags  flags 
)
static

Creates a new RegionId with extra flags.

Parameters
regionThe region to add flags to.
flagsThe flags to add.
Returns
A new instance of the RegionId struct with extra flags.

Definition at line 131 of file Region.cs.

◆ WithoutFlags() [1/2]

static RegionId SharpNav.RegionId.WithoutFlags ( RegionId  region)
static

Creates a new instance of the RegionId class without any flags set.

Parameters
regionThe region to use.
Returns
A new instance of the RegionId struct without any flags set.

Definition at line 145 of file Region.cs.

◆ WithoutFlags() [2/2]

static RegionId SharpNav.RegionId.WithoutFlags ( RegionId  region,
RegionFlags  flags 
)
static

Creates a new instance of the RegionId class without certain flags set.

Parameters
regionThe region to use.
flagsThe flags to unset.
Returns
A new instnace of the RegionId struct without certain flags set.

Definition at line 156 of file Region.cs.

Member Data Documentation

◆ MaskId

const int SharpNav.RegionId.MaskId = 0x1fffffff
static

A bitmask

Definition at line 45 of file Region.cs.

◆ Null

readonly RegionId SharpNav.RegionId.Null = new RegionId(0, 0)
static

A null region is one with an ID of 0.

Definition at line 40 of file Region.cs.

Property Documentation

◆ Flags

RegionFlags SharpNav.RegionId.Flags
get

Gets the flags set for this region.

Definition at line 94 of file Region.cs.

◆ Id

int SharpNav.RegionId.Id
get

Gets the ID of the region without any flags.

Definition at line 83 of file Region.cs.

◆ IsNull

bool SharpNav.RegionId.IsNull
get

Gets a value indicating whether the region is the null region (ID == 0).

Definition at line 105 of file Region.cs.


The documentation for this struct was generated from the following file: