Fixed SimConnect reference not being held causing immediate disconnects
Fixed allRunning / partiallyRunning being swapped in engines.lua
This commit is contained in:
parent
e279ed30d0
commit
ed7f2f38b0
@ -112,9 +112,9 @@ RegisterFunction(
|
||||
elseif runningCount == 0 then
|
||||
SetState(context, 'allOff')
|
||||
elseif runningCount == data.engineCount then
|
||||
SetState(context, 'partiallyRunning')
|
||||
else
|
||||
SetState(context, 'allRunning')
|
||||
else
|
||||
SetState(context, 'partiallyRunning')
|
||||
end
|
||||
else
|
||||
SetState(context, 'noEngines')
|
||||
|
@ -71,9 +71,11 @@ type
|
||||
TFSXLEDFunctionWorker = class(TCustomLuaLEDFunctionWorker)
|
||||
private
|
||||
FDefinitions: TList<TFSXDefinition>;
|
||||
FSimConnect: IFSXSimConnect;
|
||||
protected
|
||||
property Definitions: TList<TFSXDefinition> read FDefinitions;
|
||||
protected
|
||||
function GetSimConnect: IFSXSimConnect;
|
||||
procedure AddDefinition(ADefinition: IFSXSimConnectDefinition; ADataHandler: IFSXSimConnectDataHandler);
|
||||
|
||||
procedure HandleData(AData: Pointer); virtual; abstract;
|
||||
@ -434,13 +436,22 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function TFSXLEDFunctionWorker.GetSimConnect: IFSXSimConnect;
|
||||
begin
|
||||
if not Assigned(FSimConnect) then
|
||||
FSimConnect := (Provider as TFSXLEDFunctionProvider).GetSimConnect;
|
||||
|
||||
Result := FSimConnect;
|
||||
end;
|
||||
|
||||
|
||||
procedure TFSXLEDFunctionWorker.AddDefinition(ADefinition: IFSXSimConnectDefinition; ADataHandler: IFSXSimConnectDataHandler);
|
||||
var
|
||||
definition: TFSXDefinition;
|
||||
|
||||
begin
|
||||
definition.DataHandler := ADataHandler;
|
||||
definition.ID := (Provider as TFSXLEDFunctionProvider).GetSimConnect.AddDefinition(ADefinition, ADataHandler);
|
||||
definition.ID := GetSimConnect.AddDefinition(ADefinition, ADataHandler);
|
||||
|
||||
Definitions.Add(definition);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user