hedgewars/uFLGameConfig.pas
author unc0rr
Fri, 31 Oct 2014 00:36:08 +0300
branchqmlfrontend
changeset 10446 7ae44f42a689
parent 10444 47a6231f1fc1
child 10448 4cb727e029fa
permissions -rw-r--r--
Perform some checks on team add
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10406
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
     1
unit uFLGameConfig;
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
     2
interface
10428
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
     3
uses uFLTypes;
10406
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
     4
10430
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
     5
procedure resetGameConfig; cdecl;
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
     6
procedure runQuickGame; cdecl;
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
     7
procedure getPreview; cdecl;
10406
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
     8
10430
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
     9
procedure registerGUIMessagesCallback(p: pointer; f: TGUICallback); cdecl;
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
    10
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
    11
procedure setSeed(seed: PChar); cdecl;
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
    12
function  getSeed: PChar; cdecl;
10428
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
    13
10444
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
    14
procedure tryAddTeam(teamName: PChar);
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
    15
procedure tryRemoveTeam(teamName: PChar);
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
    16
10406
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
    17
implementation
10432
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    18
uses uFLIPC, hwengine, uFLUtils, uFLTeams;
10428
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
    19
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
    20
var guiCallbackPointer: pointer;
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
    21
    guiCallbackFunction: TGUICallback;
10406
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
    22
10426
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    23
const
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    24
    MAXCONFIGS = 5;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    25
    MAXARGS = 32;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    26
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    27
type
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    28
    TGameConfig = record
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    29
            seed: shortstring;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    30
            theme: shortstring;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    31
            script: shortstring;
10432
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    32
            mapgen: Longint;
10426
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    33
            gameType: TGameType;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    34
            teams: array[0..7] of TTeam;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    35
            arguments: array[0..Pred(MAXARGS)] of shortstring;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    36
            argv: array[0..Pred(MAXARGS)] of PChar;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    37
            argumentsNumber: Longword;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    38
            end;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    39
    PGameConfig = ^TGameConfig;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    40
10432
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    41
var
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    42
    currentConfig: TGameConfig;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    43
10430
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
    44
10432
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    45
procedure sendConfig(config: PGameConfig);
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    46
var i: Longword;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    47
begin
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    48
with config^ do
10430
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
    49
begin
10432
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    50
    case gameType of
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    51
    gtPreview: begin
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    52
            ipcToEngine('eseed ' + seed);
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    53
            ipcToEngine('e$mapgen ' + intToStr(mapgen));
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    54
        end;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    55
    gtLocal: begin
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    56
            ipcToEngine('eseed ' + seed);
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    57
            ipcToEngine('e$mapgen ' + intToStr(mapgen));
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    58
            i:= 0;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    59
            while (i < 8) and (teams[i].hogsNumber > 0) do
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    60
                begin
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    61
                    ipcToEngine('eammloadt 93919294221991210322351110012000000002111001010111110001');
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    62
                    ipcToEngine('eammprob 04050405416006555465544647765766666661555101011154111111');
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    63
                    ipcToEngine('eammdelay 00000000000002055000000400070040000000002200000006000200');
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    64
                    ipcToEngine('eammreinf 13111103121111111231141111111111111112111111011111111111');
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    65
                    ipcToEngine('eammstore');
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    66
                    sendTeamConfig(teams[i]);
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    67
                    inc(i)
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    68
                end;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    69
        end;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    70
    end;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    71
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    72
    ipcToEngine('!');
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    73
end;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    74
end;
10426
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    75
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    76
procedure queueExecution;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    77
var pConfig: PGameConfig;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    78
    i: Longword;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    79
begin
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    80
    new(pConfig);
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    81
    pConfig^:= currentConfig;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    82
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    83
    with pConfig^ do
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    84
        for i:= 0 to Pred(MAXARGS) do
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    85
        begin
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    86
            if arguments[i][0] = #255 then 
10428
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
    87
                arguments[i][255]:= #0
10426
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    88
            else
10428
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
    89
                arguments[i][byte(arguments[i][0]) + 1]:= #0;
10426
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    90
            argv[i]:= @arguments[i][1]
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    91
        end;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    92
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    93
    RunEngine(pConfig^.argumentsNumber, @pConfig^.argv);
10432
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    94
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    95
    sendConfig(pConfig)
10426
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    96
end;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    97
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
    98
procedure resetGameConfig; cdecl;
10406
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
    99
begin
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
   100
end;
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
   101
10430
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
   102
procedure setSeed(seed: PChar); cdecl;
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
   103
begin
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
   104
    currentConfig.seed:= seed
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
   105
end;
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
   106
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
   107
function getSeed: PChar; cdecl;
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
   108
begin
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
   109
    getSeed:= str2PChar(currentConfig.seed)
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
   110
end;
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
   111
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
   112
procedure runQuickGame; cdecl;
10426
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   113
begin
10432
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
   114
    with currentConfig do
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
   115
    begin
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
   116
        gameType:= gtLocal;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
   117
        arguments[0]:= '';
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
   118
        arguments[1]:= '--internal';
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
   119
        arguments[2]:= '--nosound';
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
   120
        argumentsNumber:= 3;
10426
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   121
10432
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
   122
        teams[0]:= createRandomTeam;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
   123
        teams[0].color:= '6341088';
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
   124
        teams[1]:= createRandomTeam;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
   125
        teams[1].color:= '2113696';
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
   126
        teams[1].botLevel:= 1;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
   127
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
   128
        queueExecution;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
   129
    end;
10426
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   130
end;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   131
10430
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
   132
procedure getPreview; cdecl;
10426
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   133
begin
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   134
    with currentConfig do
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   135
    begin
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   136
        gameType:= gtPreview;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   137
        arguments[0]:= '';
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   138
        arguments[1]:= '--internal';
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   139
        arguments[2]:= '--landpreview';
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   140
        argumentsNumber:= 3;
10428
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
   141
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
   142
        queueExecution;
10426
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   143
    end;
10428
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
   144
end;
10426
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   145
10428
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
   146
procedure engineMessageCallback(p: pointer; msg: PChar; len: Longword);
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
   147
begin
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
   148
    if len = 128 * 256 then guiCallbackFunction(guiCallbackPointer, mtPreview, msg, len)
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
   149
end;
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
   150
10430
899a30018ede Getter and setter for seed
unc0rr
parents: 10428
diff changeset
   151
procedure registerGUIMessagesCallback(p: pointer; f: TGUICallback); cdecl;
10428
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
   152
begin
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
   153
    guiCallbackPointer:= p;
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
   154
    guiCallbackFunction:= f;
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
   155
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10426
diff changeset
   156
    registerIPCCallback(nil, @engineMessageCallback)
10426
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   157
end;
727a154cf784 Some refactoring
unc0rr
parents: 10406
diff changeset
   158
10444
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   159
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   160
procedure tryAddTeam(teamName: PChar);
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   161
var msg: ansistring;
10446
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   162
    i, hn, hedgehogsNumber: Longword;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   163
    team: PTeam;
10444
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   164
begin
10446
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   165
    with currentConfig do
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   166
    begin
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   167
        hedgehogsNumber:= 0;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   168
        i:= 0;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   169
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   170
        while (i < 8) and (teams[i].hogsNumber > 0) do
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   171
        begin
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   172
            inc(i);
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   173
            inc(hedgehogsNumber, teams[i].hogsNumber)
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   174
        end;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   175
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   176
        // no free space for a team or reached hogs number maximum
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   177
        if (i > 7) or (hedgehogsNumber >= 48) then exit;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   178
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   179
        team:= teamByName(teamName);
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   180
        if team = nil then exit;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   181
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   182
        teams[i]:= team^;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   183
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   184
        if i = 0 then hn:= 4 else hn:= teams[i - 1].hogsNumber;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   185
        if hn > 48 - hedgehogsNumber then hn:= 48 - hedgehogsNumber;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   186
        teams[i].hogsNumber:= hn;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   187
    end;
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   188
7ae44f42a689 Perform some checks on team add
unc0rr
parents: 10444
diff changeset
   189
10444
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   190
    msg:= '0' + #10 + teamName;
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   191
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   192
    guiCallbackFunction(guiCallbackPointer, mtAddPlayingTeam, @msg[1], length(msg));
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   193
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   194
    msg:= teamName;
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   195
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   196
    guiCallbackFunction(guiCallbackPointer, mtRemoveTeam, @msg[1], length(msg))
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   197
end;
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   198
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   199
procedure tryRemoveTeam(teamName: PChar);
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   200
var msg: ansistring;
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   201
begin
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   202
    msg:= teamName;
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   203
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   204
    guiCallbackFunction(guiCallbackPointer, mtRemovePlayingTeam, @msg[1], length(msg));
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   205
    guiCallbackFunction(guiCallbackPointer, mtAddTeam, @msg[1], length(msg))
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   206
end;
47a6231f1fc1 Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents: 10432
diff changeset
   207
10406
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
   208
end.