hedgewars/uFLTeams.pas
author unc0rr
Sun, 06 Dec 2015 19:56:33 +0300
branchqmlfrontend
changeset 11444 91f8c6ff5bab
parent 11442 6b04a266feee
child 11445 465b4db35232
permissions -rw-r--r--
- Send team to net - Handle TEAM_ACCEPTED
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
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
     8
function getTeamsList: PPChar; cdecl;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
     9
procedure freeTeamsList;
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    10
10446
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
    11
function teamByName(s: shortstring): PTeam;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
    12
11444
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
    13
procedure sendTeam(var team: TTeam);
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
    14
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    15
implementation
11444
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
    16
uses uFLUtils, uFLIPC, uPhysFSLayer, uFLData, uFLNet;
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    17
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    18
const MAX_TEAM_NAMES = 128;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    19
var
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    20
    teamsList: PTeam;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    21
    teamsNumber: Longword;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    22
    listOfTeamNames: array[0..MAX_TEAM_NAMES] of PChar;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    23
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    24
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    25
function createRandomTeam: TTeam;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    26
var t: TTeam;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    27
    i: Longword;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    28
begin
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    29
    with t do
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    30
    begin
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    31
        teamName:= 'team' + inttostr(random(100));
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
        for i:= 0 to 7 do
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    34
            with hedgehogs[i] do
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
                name:= 'hedgehog ' + inttostr(i);
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    37
                hat:= 'NoHat'
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    38
            end;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    39
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    40
        botLevel:= 0;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    41
        hogsNumber:= 4
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    42
    end;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    43
    createRandomTeam:= t
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
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    46
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    47
procedure sendTeamConfig(var team: TTeam);
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    48
var i: Longword;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    49
begin
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    50
    with team do
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    51
    begin
10450
bf9e30b4ef9b - Store index of color instead of its value
unc0rr
parents: 10448
diff changeset
    52
        ipcToEngine('eaddteam <hash> ' + colorsSet[color] + ' ' + teamName);
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    53
        for i:= 0 to Pred(hogsNumber) do
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    54
        begin
10612
eb3c1a289a23 Script combobox.wiki
unc0rr
parents: 10517
diff changeset
    55
            ipcToEngine('eaddhh ' + inttostr(botLevel) + ' 100 hog');// + hedgehogs[i].name);
eb3c1a289a23 Script combobox.wiki
unc0rr
parents: 10517
diff changeset
    56
            //ipcToEngine('ehat ' + hedgehogs[i].hat);
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    57
        end;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    58
    end
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    59
end;
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
    60
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    61
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    62
procedure loadTeam(var team: TTeam; fileName: shortstring);
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    63
var f: PFSFile;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    64
    section: LongInt;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    65
    l: shortstring;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    66
begin
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    67
    section:= -1;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    68
    f:= pfsOpenRead(fileName);
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    69
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    70
    while (not pfsEOF(f)) do
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    71
    begin
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    72
        pfsReadLn(f, l);
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    73
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    74
        if l = '' then
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    75
        else if l = '[Team]' then 
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    76
            section:= 0
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    77
        else if l[1] = '[' then
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    78
            section:= -1
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    79
        else if section = 0 then
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    80
        begin // [Team]
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    81
            if copy(l, 1, 5) = 'Name=' then
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    82
                team.teamName:= midStr(l, 6)
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    83
            else if copy(l, 1, 6) = 'Grave=' then
11442
6b04a266feee - Accept team and team color from net
unc0rr
parents: 11437
diff changeset
    84
                team.grave:= midStr(l, 7)
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    85
            else if copy(l, 1, 5) = 'Fort=' then
11442
6b04a266feee - Accept team and team color from net
unc0rr
parents: 11437
diff changeset
    86
                team.fort:= midStr(l, 6)
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    87
            else if copy(l, 1, 5) = 'Flag=' then
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    88
                team.flag:= midStr(l, 6)
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    89
        end;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    90
        // TODO: load hedgehogs and other stuff
11437
6e641b5453f9 Accept ammo scheme from network
unc0rr
parents: 10612
diff changeset
    91
        team.botLevel:= 0
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    92
    end;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    93
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    94
    pfsClose(f)
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    95
end;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    96
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    97
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    98
procedure loadTeams;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
    99
var filesList, tmp: PPChar;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   100
    team: PTeam;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   101
    s: shortstring;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   102
    l: Longword;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   103
begin
10442
c58db813240b Load and show local teams list
unc0rr
parents: 10440
diff changeset
   104
    filesList:= pfsEnumerateFiles('/Config/Teams');
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   105
    teamsNumber:= 0;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   106
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   107
    tmp:= filesList;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   108
    while tmp^ <> nil do
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   109
    begin
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   110
        s:= shortstring(tmp^);
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   111
        l:= length(s);
10442
c58db813240b Load and show local teams list
unc0rr
parents: 10440
diff changeset
   112
        if (l > 4) and (copy(s, l - 3, 4) = '.hwt') then inc(teamsNumber);
c58db813240b Load and show local teams list
unc0rr
parents: 10440
diff changeset
   113
        inc(tmp)
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   114
    end;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   115
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   116
    // TODO: no teams at all?
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   117
    teamsList:= GetMem(sizeof(teamsList^) * teamsNumber);
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   118
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   119
    team:= teamsList;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   120
    tmp:= filesList;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   121
    while tmp^ <> nil do
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   122
    begin
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   123
        s:= shortstring(tmp^);
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   124
        l:= length(s);
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   125
        if (l > 4) and (copy(s, l - 3, 4) = '.hwt') then 
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   126
            begin
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   127
                loadTeam(team^, '/Config/Teams/' + s);
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   128
                inc(team)
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   129
            end;
10442
c58db813240b Load and show local teams list
unc0rr
parents: 10440
diff changeset
   130
        inc(tmp)
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   131
    end;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   132
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   133
    pfsFreeList(filesList)
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   134
end;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   135
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   136
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   137
function getTeamsList: PPChar; cdecl;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   138
var i, t, l: Longword;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   139
    team: PTeam;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   140
begin
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   141
    if teamsList = nil then
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   142
        loadTeams;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   143
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   144
    t:= teamsNumber;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   145
    if t >= MAX_TEAM_NAMES then 
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   146
        t:= MAX_TEAM_NAMES;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   147
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   148
    team:= teamsList;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   149
    for i:= 0 to Pred(t) do
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   150
    begin
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   151
        l:= length(team^.teamName);
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   152
        if l >= 255 then l:= 254;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   153
        team^.teamName[l + 1]:= #0;
10442
c58db813240b Load and show local teams list
unc0rr
parents: 10440
diff changeset
   154
        listOfTeamNames[i]:= @team^.teamName[1];
c58db813240b Load and show local teams list
unc0rr
parents: 10440
diff changeset
   155
        inc(team)
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   156
    end;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   157
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   158
    listOfTeamNames[t]:= nil;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   159
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   160
    getTeamsList:= listOfTeamNames
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   161
end;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   162
10446
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
   163
function teamByName(s: shortstring): PTeam;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
   164
var i: Longword;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
   165
    team: PTeam;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
   166
begin
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
   167
    team:= teamsList;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
   168
    i:= 0;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
   169
    while (i < teamsNumber) and (team^.teamName <> s) do
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
   170
    begin
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
   171
        inc(team);
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
   172
        inc(i)
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
   173
    end;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
   174
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
   175
    if i < teamsNumber then teamByName:= team else teamByName:= nil
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10442
diff changeset
   176
end;
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   177
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   178
procedure freeTeamsList;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   179
begin
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   180
    if teamsList <> nil then
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   181
        FreeMem(teamsList, sizeof(teamsList^) * teamsNumber)
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   182
end;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10434
diff changeset
   183
11444
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   184
procedure sendTeam(var team: TTeam);
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   185
var i: Longword;
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   186
begin
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   187
    with team do
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   188
    begin
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   189
        sendNetLn('ADD_TEAM');
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   190
        sendNetLn(teamName);
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   191
        sendNetLn(IntToStr(color));
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   192
        sendNetLn(grave);
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   193
        sendNetLn(fort);
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   194
        sendNetLn(voice);
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   195
        sendNetLn(flag);
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   196
        sendNetLn(IntToStr(botLevel));
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   197
        for i := 0 to 7 do
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   198
        begin
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   199
            sendNetLn(hedgehogs[i].name);
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   200
            sendNetLn(hedgehogs[i].hat);
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   201
        end;
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   202
        sendNetLn('')
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   203
    end;
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   204
end;
91f8c6ff5bab - Send team to net
unc0rr
parents: 11442
diff changeset
   205
10434
1614b13ad35e Themes model, also add some files I forgot to add previously
unc0rr
parents:
diff changeset
   206
end.