Skip to main content
Namespace: OpenTD
Assembly: OpenTD.dll
Describes a system of units. Can be inconsistent.

Inheritance

object ← UnitsData

Implements

IEquatable<UnitsData>

Inherited Members

object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()

Constructors

UnitsData()

UnitsData(string)

Initializes a new instance of the UnitsData class by parsing the supplied units expression string. Use with basic units (m, hr, Btu, etc.) or compound units expressions (Btu/hr/ft^2/F, kg/m-s, etc.). Recognizes strings in the same format output by TD. Accepted operators : ( ) / - ^ Exponents denoted with optional ^, e.g. m^3 and m3 are both valid W can be substituted for J/s 1 can be used, as in 1/m^3 Revolution can be used, as in Revolution/s Case-insensitive For overlapping model length and orbit length units (m and ft), assumes model length

Parameters

unitsExpression string

UnitsData(long, long)

Initializes a new instance of the UnitsData class, using integers written to save files or CSR’s by SINDA.

Parameters

TdUnits long TdUnits2 long

UnitsData(UnitsData)

Copy constructor.

Parameters

source UnitsData

Properties

FlocadOutputUnits

Property Value

UnitsData.FlocadOutputUnitsType

angle

Property Value

UnitsData.Angle

current

Property Value

UnitsData.Current

def

Use def to create arbitrary combinations of units (advanced).

Property Value

UnitsDefData

energy

Property Value

UnitsData.Energy

force

Property Value

UnitsData.Force

mass

Property Value

UnitsData.Mass

modelLength

Property Value

UnitsData.ModelLength

orbitLength

Property Value

UnitsData.OrbitLength

pressure

Property Value

UnitsData.Pressure

temp

Property Value

UnitsData.Temp

time

Property Value

UnitsData.Time

voltage

Property Value

UnitsData.Voltage

Methods

Equals(UnitsData)

Indicates whether the current object is equal to another object of the same type.

Parameters

x UnitsData

Returns

bool true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Determines whether the specified object is equal to the current object.

Parameters

obj object The object to compare with the current object.

Returns

bool true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

Returns

int A hash code for the current object.

GetName(UnitsType)

Parameters

type UnitsData.UnitsType

Returns

string

GetTitle(UnitsType)

Parameters

type UnitsData.UnitsType

Returns

string

GetUnitsName(UnitsType)

Parameters

type UnitsData.UnitsType

Returns

string

SetFrom(UnitsData)

Parameters

source UnitsData

SetFromDataset(long, long)

Set this units system based on 64-bit integers written to a save file or CSR by Sinda.

Parameters

TdUnits long TdUnits2 long

Exceptions

OpenTDException Problem decoding TdUnits. or Problem decoding TdUnits2.

SetFromUnitsExpression(string)

Sets this UnitsData using the supplied string. Use with basic units (m, hr, Btu, etc.) or compound units expressions (Btu/hr/ft^2/F, kg/m-s, etc.). For basic units, SetFromBasicUnit(string str) will be more efficient. Recognizes strings in the same format output by TD. Accepted operators : ( ) / - ^ Exponents denoted with optional ^, e.g. m^3 and m3 are both valid W can be substituted for J/s 1 can be used, as in 1/m^3 Revolution can be used, as in Revolution/s Case-insensitive For overlapping model length and orbit length units (m and ft), assumes model length

Parameters

str string

Returns

bool

SetToEng()

SetToSI()

Text(OrbitLength)

Parameters

units UnitsData.OrbitLength

Returns

string

Text(ModelLength)

Parameters

units UnitsData.ModelLength

Returns

string

Text(Time)

Parameters

units UnitsData.Time

Returns

string

Text(Energy)

Parameters

units UnitsData.Energy

Returns

string

Text(Temp)

Parameters

units UnitsData.Temp

Returns

string

Text(Mass)

Parameters

units UnitsData.Mass

Returns

string

Text(Pressure)

Parameters

units UnitsData.Pressure

Returns

string

Text(Angle)

Parameters

units UnitsData.Angle

Returns

string

Text(Force)

Parameters

units UnitsData.Force

Returns

string

Text(Current)

Parameters

units UnitsData.Current

Returns

string

Text(Voltage)

Parameters

units UnitsData.Voltage

Returns

string

Text(Resistance)

Parameters

units UnitsData.Resistance

Returns

string

ToString()

Returns a string that represents the current object.

Returns

string A string that represents the current object.

Operators

operator ==(UnitsData, UnitsData)

Parameters

x1 UnitsData x2 UnitsData

Returns

bool

operator !=(UnitsData, UnitsData)

Parameters

x1 UnitsData x2 UnitsData

Returns

bool