Gear speed exceeded / damage results in warning / error
Combobox tags were off by 1
This commit is contained in:
parent
789511bd56
commit
c2fd94d9cd
@ -106,7 +106,6 @@ object MainForm: TMainForm
|
|||||||
Caption = 'P8'
|
Caption = 'P8'
|
||||||
end
|
end
|
||||||
object cmbFSXP1: TComboBoxEx
|
object cmbFSXP1: TComboBoxEx
|
||||||
Tag = 1
|
|
||||||
Left = 69
|
Left = 69
|
||||||
Top = 24
|
Top = 24
|
||||||
Width = 348
|
Width = 348
|
||||||
@ -125,9 +124,9 @@ object MainForm: TMainForm
|
|||||||
DropDownCount = 20
|
DropDownCount = 20
|
||||||
end
|
end
|
||||||
object cmbFSXP2: TComboBoxEx
|
object cmbFSXP2: TComboBoxEx
|
||||||
Tag = 2
|
Tag = 1
|
||||||
Left = 69
|
Left = 69
|
||||||
Top = 51
|
Top = 50
|
||||||
Width = 348
|
Width = 348
|
||||||
Height = 22
|
Height = 22
|
||||||
ItemsEx = <>
|
ItemsEx = <>
|
||||||
@ -138,7 +137,7 @@ object MainForm: TMainForm
|
|||||||
DropDownCount = 20
|
DropDownCount = 20
|
||||||
end
|
end
|
||||||
object cmbFSXP3: TComboBoxEx
|
object cmbFSXP3: TComboBoxEx
|
||||||
Tag = 3
|
Tag = 2
|
||||||
Left = 69
|
Left = 69
|
||||||
Top = 78
|
Top = 78
|
||||||
Width = 348
|
Width = 348
|
||||||
@ -151,7 +150,7 @@ object MainForm: TMainForm
|
|||||||
DropDownCount = 20
|
DropDownCount = 20
|
||||||
end
|
end
|
||||||
object cmbFSXP4: TComboBoxEx
|
object cmbFSXP4: TComboBoxEx
|
||||||
Tag = 4
|
Tag = 3
|
||||||
Left = 69
|
Left = 69
|
||||||
Top = 105
|
Top = 105
|
||||||
Width = 348
|
Width = 348
|
||||||
@ -164,9 +163,9 @@ object MainForm: TMainForm
|
|||||||
DropDownCount = 20
|
DropDownCount = 20
|
||||||
end
|
end
|
||||||
object cmbFSXP5: TComboBoxEx
|
object cmbFSXP5: TComboBoxEx
|
||||||
Tag = 5
|
Tag = 4
|
||||||
Left = 69
|
Left = 69
|
||||||
Top = 132
|
Top = 131
|
||||||
Width = 348
|
Width = 348
|
||||||
Height = 22
|
Height = 22
|
||||||
ItemsEx = <>
|
ItemsEx = <>
|
||||||
@ -177,7 +176,7 @@ object MainForm: TMainForm
|
|||||||
DropDownCount = 20
|
DropDownCount = 20
|
||||||
end
|
end
|
||||||
object cmbFSXP6: TComboBoxEx
|
object cmbFSXP6: TComboBoxEx
|
||||||
Tag = 6
|
Tag = 5
|
||||||
Left = 69
|
Left = 69
|
||||||
Top = 159
|
Top = 159
|
||||||
Width = 348
|
Width = 348
|
||||||
@ -190,7 +189,7 @@ object MainForm: TMainForm
|
|||||||
DropDownCount = 20
|
DropDownCount = 20
|
||||||
end
|
end
|
||||||
object cmbFSXP7: TComboBoxEx
|
object cmbFSXP7: TComboBoxEx
|
||||||
Tag = 7
|
Tag = 6
|
||||||
Left = 69
|
Left = 69
|
||||||
Top = 186
|
Top = 186
|
||||||
Width = 348
|
Width = 348
|
||||||
@ -203,7 +202,7 @@ object MainForm: TMainForm
|
|||||||
DropDownCount = 20
|
DropDownCount = 20
|
||||||
end
|
end
|
||||||
object cmbFSXP8: TComboBoxEx
|
object cmbFSXP8: TComboBoxEx
|
||||||
Tag = 8
|
Tag = 7
|
||||||
Left = 69
|
Left = 69
|
||||||
Top = 213
|
Top = 213
|
||||||
Width = 348
|
Width = 348
|
||||||
|
@ -76,6 +76,9 @@ const
|
|||||||
FSX_VARIABLE_ENGCOMBUSTION = 'GENERAL ENG COMBUSTION:%d';
|
FSX_VARIABLE_ENGCOMBUSTION = 'GENERAL ENG COMBUSTION:%d';
|
||||||
FSX_VARIABLE_ENGFAILED = 'ENG FAILED:%d';
|
FSX_VARIABLE_ENGFAILED = 'ENG FAILED:%d';
|
||||||
FSX_VARIABLE_ENGONFIRE = 'ENG ON FIRE:%d';
|
FSX_VARIABLE_ENGONFIRE = 'ENG ON FIRE:%d';
|
||||||
|
FSX_VARIABLE_GEARDAMAGEBYSPEED = 'GEAR DAMAGE BY SPEED';
|
||||||
|
FSX_VARIABLE_GEARSPEEDEXCEEDED = 'GEAR SPEED EXCEEDED';
|
||||||
|
|
||||||
|
|
||||||
FSX_UNIT_PERCENT = 'percent';
|
FSX_UNIT_PERCENT = 'percent';
|
||||||
FSX_UNIT_MASK = 'mask';
|
FSX_UNIT_MASK = 'mask';
|
||||||
@ -99,6 +102,8 @@ type
|
|||||||
TGearData = packed record
|
TGearData = packed record
|
||||||
IsGearRetractable: Integer;
|
IsGearRetractable: Integer;
|
||||||
TotalPctExtended: Double;
|
TotalPctExtended: Double;
|
||||||
|
DamageBySpeed: Integer;
|
||||||
|
SpeedExceeded: Integer;
|
||||||
end;
|
end;
|
||||||
PGearData = ^TGearData;
|
PGearData = ^TGearData;
|
||||||
|
|
||||||
@ -143,6 +148,8 @@ end;
|
|||||||
|
|
||||||
procedure TFSXLEDStateProvider.Initialize;
|
procedure TFSXLEDStateProvider.Initialize;
|
||||||
begin
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
if not InitSimConnect then
|
if not InitSimConnect then
|
||||||
raise EInitializeError.Create('SimConnect.dll could not be loaded');
|
raise EInitializeError.Create('SimConnect.dll could not be loaded');
|
||||||
|
|
||||||
@ -183,6 +190,7 @@ end;
|
|||||||
procedure TFSXLEDStateProvider.UpdateMap;
|
procedure TFSXLEDStateProvider.UpdateMap;
|
||||||
var
|
var
|
||||||
engineIndex: Integer;
|
engineIndex: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
ClearDefinitions;
|
ClearDefinitions;
|
||||||
|
|
||||||
@ -191,6 +199,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
AddVariable(DEFINITION_GEAR, FSX_VARIABLE_ISGEARRETRACTABLE, FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
|
AddVariable(DEFINITION_GEAR, FSX_VARIABLE_ISGEARRETRACTABLE, FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
|
||||||
AddVariable(DEFINITION_GEAR, FSX_VARIABLE_GEARTOTALPCTEXTENDED, FSX_UNIT_PERCENT);
|
AddVariable(DEFINITION_GEAR, FSX_VARIABLE_GEARTOTALPCTEXTENDED, FSX_UNIT_PERCENT);
|
||||||
|
AddVariable(DEFINITION_GEAR, FSX_VARIABLE_GEARDAMAGEBYSPEED, FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
|
||||||
|
AddVariable(DEFINITION_GEAR, FSX_VARIABLE_GEARSPEEDEXCEEDED, FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
|
||||||
AddDefinition(DEFINITION_GEAR);
|
AddDefinition(DEFINITION_GEAR);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -248,7 +258,13 @@ begin
|
|||||||
begin
|
begin
|
||||||
gearData := @simObjectData^.dwData;
|
gearData := @simObjectData^.dwData;
|
||||||
|
|
||||||
if gearData^.IsGearRetractable <> 0 then
|
if gearData^.DamageBySpeed <> 0 then
|
||||||
|
Consumer.SetStateByFunction(FUNCTION_FSX_GEAR, lsError)
|
||||||
|
|
||||||
|
else if gearData^.SpeedExceeded <> 0 then
|
||||||
|
Consumer.SetStateByFunction(FUNCTION_FSX_GEAR, lsWarning)
|
||||||
|
|
||||||
|
else if gearData^.IsGearRetractable <> 0 then
|
||||||
begin
|
begin
|
||||||
case Trunc(gearData^.TotalPctExtended * 100) of
|
case Trunc(gearData^.TotalPctExtended * 100) of
|
||||||
0: Consumer.SetStateByFunction(FUNCTION_FSX_GEAR, lsRed);
|
0: Consumer.SetStateByFunction(FUNCTION_FSX_GEAR, lsRed);
|
||||||
|
Loading…
Reference in New Issue
Block a user