Skip to content

Commit

Permalink
Merge pull request #440 from rpeacoc/master
Browse files Browse the repository at this point in the history
CEdit: Correct errors in default position for vents and fires
  • Loading branch information
Richard Peacock committed Apr 21, 2016
2 parents 5320cd6 + 0237258 commit 8f0c672
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Source/Cedit/CEdit.vb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Public Class CeditMain
CurrentMVent As Integer = 0, CurrentTarget As Integer = 0, CurrentDetector As Integer = 0, CurrentHHeat As Integer = 0, _
CurrentVHeat As Integer = 0, CurrentFire As Integer = 0, CurrentVisual As Integer = 0
Private Const OK As Integer = 1, Cancel As Integer = 2
Friend WithEvents DetectorActivationObscuration As System.Windows.Forms.TextBox
Friend WithEvents Label17 As System.Windows.Forms.Label

#Region " Windows Form Designer generated code "

Expand Down Expand Up @@ -41,6 +39,8 @@ Public Class CeditMain
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents DetectorActivationObscuration As System.Windows.Forms.TextBox
Friend WithEvents Label17 As System.Windows.Forms.Label
Friend WithEvents FireTSYield As System.Windows.Forms.TextBox
Friend WithEvents Label115 As System.Windows.Forms.Label
Friend WithEvents TargetName As System.Windows.Forms.TextBox
Expand Down
41 changes: 31 additions & 10 deletions Source/Cedit/Fire.vb
Original file line number Diff line number Diff line change
Expand Up @@ -190,68 +190,89 @@ Public Class Fire
End Property
Property XPosition() As Single
Get
Return myUnits.Convert(UnitsNum.Length).FromSI(aXPosition)
If aXPosition = -1 Then
Return -1
Else
Return myUnits.Convert(UnitsNum.Length).FromSI(aXPosition)
End If
End Get
Set(ByVal Value As Single)
If Value >= 0 Then
If aXPosition <> myUnits.Convert(UnitsNum.Length).ToSI(Value) Then
aXPosition = myUnits.Convert(UnitsNum.Length).ToSI(Value)
aChanged = True
End If
Else
ElseIf Value = -1 Then
If aCompartment > -1 And aCompartment <= myCompartments.Count - 1 Then
Dim tmpCompartment As New Compartment
tmpCompartment = myCompartments.Item(aCompartment)
aXPosition = myUnits.Convert(UnitsNum.Length).ToSI(tmpCompartment.RoomWidth / 2)
aXPosition = myUnits.Convert(UnitsNum.Length).ToSI(tmpCompartment.RoomWidth) / 2
aChanged = True
Else
aXPosition = Value
aXPosition = -1
aChanged = True
End If
Else
aXPosition = -1
aChanged = True
End If
End Set
End Property
Property YPosition() As Single
Get
Return myUnits.Convert(UnitsNum.Length).FromSI(aYPosition)
If aYPosition = -1 Then
Return -1
Else
Return myUnits.Convert(UnitsNum.Length).FromSI(aYPosition)
End If
End Get
Set(ByVal Value As Single)
If Value >= 0 Then
If aYPosition <> myUnits.Convert(UnitsNum.Length).ToSI(Value) Then
aYPosition = myUnits.Convert(UnitsNum.Length).ToSI(Value)
aChanged = True
End If
Else
ElseIf Value = -1 Then
If aCompartment > -1 And aCompartment <= myCompartments.Count - 1 Then
Dim tmpCompartment As New Compartment
tmpCompartment = myCompartments.Item(aCompartment)
aYPosition = myUnits.Convert(UnitsNum.Length).ToSI(tmpCompartment.RoomDepth / 2)
aChanged = True
Else
aYPosition = Value
aYPosition = -1
aChanged = True
End If
Else
aYPosition = -1
aChanged = True
End If
End Set
End Property
Property ZPosition() As Single
Get
Return myUnits.Convert(UnitsNum.Length).FromSI(aZPosition)
If aZPosition = -1 Then
Return -1
Else
Return myUnits.Convert(UnitsNum.Length).FromSI(aZPosition)
End If
End Get
Set(ByVal Value As Single)
If Value >= 0 Then
If aZPosition <> myUnits.Convert(UnitsNum.Length).ToSI(Value) Then
aZPosition = myUnits.Convert(UnitsNum.Length).ToSI(Value)
aChanged = True
End If
Else
ElseIf Value = -1 Then
If aCompartment > -1 And aCompartment <= myCompartments.Count - 1 Then
aZPosition = 0.0
aChanged = True
Else
aZPosition = Value
aZPosition = -1
aChanged = True
End If
Else
aZPosition = -1
aChanged = True
End If
End Set
End Property
Expand Down
4 changes: 2 additions & 2 deletions Source/Cedit/Vent.vb
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ Public Class Vent
Dim aCompartment As New Compartment
aCompartment = myCompartments.Item(aFirstCompartment)
If aFace = 1 Or aFace = 3 Then
aOffset = aCompartment.RoomWidth / 2 - aWidth / 2
aOffset = myUnits.Convert(UnitsNum.Length).ToSI(aCompartment.RoomWidth) / 2 - aWidth / 2
Else
aOffset = aCompartment.RoomDepth / 2 - aWidth / 2
aOffset = myUnits.Convert(UnitsNum.Length).ToSI(aCompartment.RoomDepth) / 2 - aWidth / 2
End If
End If

Expand Down

0 comments on commit 8f0c672

Please sign in to comment.