procedure TBattleForm.OnStartGameMessage(var Msg: TMessage); // responds to WM_STARTGAME message var i,j: Integer; v,springexe: string; script:string; scriptGenerationResult: boolean; begin if not IsBattleActive then Exit; // this should not happen if Status.AmIInGame then Exit; if (BattleState.Status = Hosting) then case BattleState.Battle.NATType of 0: ; 1: PunchThroughNAT; 2: for i := 1 {skip the host} to BattleState.Battle.Clients.Count-1 do try if TClient(BattleState.Battle.Clients[i]).IP = '' then MainForm.AddMainLog('Error punching through NAT: player''s IP is unknown!', Colors.Error) else Misc.SendUDPStrEx(TClient(BattleState.Battle.Clients[i]).IP, FIRST_UDP_SOURCEPORT + i - 1, BattleState.Battle.Port, 2, 'HELLO'); // what we send doesn't really matter (we could probably send an empty packet as well). except MainForm.AddMainLog('Error while sending UDP packet to ' + TClient(BattleState.Battle.Clients[i]).Name + ' (IP=' + TClient(BattleState.Battle.Clients[i]).IP + ')', Colors.Error); end; end;