1
0
mirror of synced 2024-11-05 02:59:16 +00:00

Gear speed exceeded / damage results in warning / error

Combobox tags were off by 1
This commit is contained in:
Mark van Renswoude 2012-01-19 18:42:18 +00:00
parent 789511bd56
commit c2fd94d9cd
2 changed files with 26 additions and 11 deletions

View File

@ -106,7 +106,6 @@ object MainForm: TMainForm
Caption = 'P8'
end
object cmbFSXP1: TComboBoxEx
Tag = 1
Left = 69
Top = 24
Width = 348
@ -125,9 +124,9 @@ object MainForm: TMainForm
DropDownCount = 20
end
object cmbFSXP2: TComboBoxEx
Tag = 2
Tag = 1
Left = 69
Top = 51
Top = 50
Width = 348
Height = 22
ItemsEx = <>
@ -138,7 +137,7 @@ object MainForm: TMainForm
DropDownCount = 20
end
object cmbFSXP3: TComboBoxEx
Tag = 3
Tag = 2
Left = 69
Top = 78
Width = 348
@ -151,7 +150,7 @@ object MainForm: TMainForm
DropDownCount = 20
end
object cmbFSXP4: TComboBoxEx
Tag = 4
Tag = 3
Left = 69
Top = 105
Width = 348
@ -164,9 +163,9 @@ object MainForm: TMainForm
DropDownCount = 20
end
object cmbFSXP5: TComboBoxEx
Tag = 5
Tag = 4
Left = 69
Top = 132
Top = 131
Width = 348
Height = 22
ItemsEx = <>
@ -177,7 +176,7 @@ object MainForm: TMainForm
DropDownCount = 20
end
object cmbFSXP6: TComboBoxEx
Tag = 6
Tag = 5
Left = 69
Top = 159
Width = 348
@ -190,7 +189,7 @@ object MainForm: TMainForm
DropDownCount = 20
end
object cmbFSXP7: TComboBoxEx
Tag = 7
Tag = 6
Left = 69
Top = 186
Width = 348
@ -203,7 +202,7 @@ object MainForm: TMainForm
DropDownCount = 20
end
object cmbFSXP8: TComboBoxEx
Tag = 8
Tag = 7
Left = 69
Top = 213
Width = 348

View File

@ -76,6 +76,9 @@ const
FSX_VARIABLE_ENGCOMBUSTION = 'GENERAL ENG COMBUSTION:%d';
FSX_VARIABLE_ENGFAILED = 'ENG FAILED:%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_MASK = 'mask';
@ -99,6 +102,8 @@ type
TGearData = packed record
IsGearRetractable: Integer;
TotalPctExtended: Double;
DamageBySpeed: Integer;
SpeedExceeded: Integer;
end;
PGearData = ^TGearData;
@ -143,6 +148,8 @@ end;
procedure TFSXLEDStateProvider.Initialize;
begin
inherited;
if not InitSimConnect then
raise EInitializeError.Create('SimConnect.dll could not be loaded');
@ -183,6 +190,7 @@ end;
procedure TFSXLEDStateProvider.UpdateMap;
var
engineIndex: Integer;
begin
ClearDefinitions;
@ -191,6 +199,8 @@ begin
begin
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_GEARDAMAGEBYSPEED, FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
AddVariable(DEFINITION_GEAR, FSX_VARIABLE_GEARSPEEDEXCEEDED, FSX_UNIT_BOOL, SIMCONNECT_DATAType_INT32);
AddDefinition(DEFINITION_GEAR);
end;
@ -248,7 +258,13 @@ begin
begin
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
case Trunc(gearData^.TotalPctExtended * 100) of
0: Consumer.SetStateByFunction(FUNCTION_FSX_GEAR, lsRed);