Skip to content

Commit

Permalink
Show driver name in JC barrier.
Browse files Browse the repository at this point in the history
  • Loading branch information
horacekj committed Jan 21, 2023
1 parent e8110f8 commit abf9148
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
34 changes: 21 additions & 13 deletions src/hv/THnaciVozidlo.pas
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ THV = class

procedure RegulatorAdd(reg: THVRegulator);
procedure RegulatorRemove(reg: THVRegulator);
function DriverFullNames(): string;

class function CharToHVFuncType(c: char): THVFuncType;
class function HVFuncTypeToChar(t: THVFuncType): char;
Expand Down Expand Up @@ -797,19 +798,11 @@ procedure THV.UpdatePanelRuc(send_remove: Boolean = true);
if (Self.ruc) then
begin
var msg := 'RUC;' + IntToStr(Self.addr) + ';RUČ. ' + IntToStr(Self.addr) + ' (' + train + ')';
var userfullnames := TList<string>.Create();
try
for var reg in Self.state.regulators do
if (TPanelConnData(reg.conn.Data).regulator_user <> nil) then
userfullnames.Add(TPanelConnData(reg.conn.Data).regulator_user.fullName);
var userstring: string := SerializeStrList(userfullnames, true);
if (userstring <> '') then
msg := msg + ' - ' + userstring;

Self.state.Area.BroadcastData(msg);
finally
userfullnames.Free();
end;
var drivers: string := Self.DriverFullNames();
if (drivers <> '') then
msg := msg + ' - ' + drivers;

Self.state.Area.BroadcastData(msg);
end else begin
// loko neni v rucnim rizeni -> oznamit klientovi
if (send_remove) then
Expand Down Expand Up @@ -1839,4 +1832,19 @@ procedure THV.RegulatorRemove(reg: THVRegulator);

/// /////////////////////////////////////////////////////////////////////////////

function THV.DriverFullNames(): string;
begin
var userfullnames := TList<string>.Create();
try
for var reg in Self.state.regulators do
if (TPanelConnData(reg.conn.Data).regulator_user <> nil) then
userfullnames.Add(TPanelConnData(reg.conn.Data).regulator_user.fullName);
Result := SerializeStrList(userfullnames, true);
finally
userfullnames.Free();
end;
end;

/// /////////////////////////////////////////////////////////////////////////////

end.// unit
6 changes: 3 additions & 3 deletions src/jc/JCBarriers.pas
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@ function JCBarrierToMessage(barrier: TJCBarrier): TUPOItem;

barHVManual:
begin
result[0] := GetUPOLine('POZOR !', taCenter, clBlack, clYellow);
result[1] := GetUPOLine('Hnací vozidlo v ručním řízení');
result[2] := GetUPOLine(IntToStr(barrier.param) + ' : ' + HVDb[barrier.param].name);
result[0] := GetUPOLine('Hnací vozidlo v ručním řízení', taCenter, clBlack, clYellow);
result[1] := GetUPOLine(IntToStr(barrier.param) + ' : ' + HVDb[barrier.param].name);
result[2] := GetUPOLine('Řídí: '+HVDb[barrier.param].DriverFullNames());
end;

barHVNotAllManual:
Expand Down

0 comments on commit abf9148

Please sign in to comment.