hedgewars/uFLTeams.pas
author unc0rr
Tue, 30 Sep 2014 00:54:04 +0400
branchqmlfrontend
changeset 10434 1614b13ad35e
child 10440 b74a7bbe224e
permissions -rw-r--r--
Themes model, also add some files I forgot to add previously
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     1
unit uFLTeams;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     2
interface
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     3
uses uFLTypes;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     4
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     5
function createRandomTeam: TTeam;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     6
procedure sendTeamConfig(var team: TTeam);
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     7
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     8
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
     9
implementation
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    10
uses uFLUtils, uFLIPC;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    11
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    12
function createRandomTeam: TTeam;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    13
var t: TTeam;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    14
    i: Longword;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    15
begin
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    16
    with t do
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    17
    begin
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    18
        teamName:= 'team' + inttostr(random(100));
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    19
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    20
        for i:= 0 to 7 do
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    21
            with hedgehogs[i] do
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    22
            begin
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    23
                name:= 'hedgehog ' + inttostr(i);
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    24
                hat:= 'NoHat'
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    25
            end;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    26
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    27
        botLevel:= 0;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    28
        hogsNumber:= 4
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    29
    end;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    30
    createRandomTeam:= t
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    31
end;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    32
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    33
procedure sendTeamConfig(var team: TTeam);
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    34
var i: Longword;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    35
begin
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    36
    with team do
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    37
    begin
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    38
        ipcToEngine('eaddteam <hash> ' + color + ' ' + teamName);
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    39
        for i:= 0 to Pred(hogsNumber) do
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    40
        begin
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    41
            ipcToEngine('eaddhh ' + inttostr(botLevel) + ' 100 ' + hedgehogs[i].name);
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    42
            ipcToEngine('ehat ' + hedgehogs[i].hat);
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    43
        end;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    44
    end
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    45
end;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    46
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    47
end.