hedgewars/uFLNetProtocol.pas
author unc0rr
Wed, 02 Dec 2015 22:21:23 +0300
branchqmlfrontend
changeset 11445 330c14f4ba69
parent 11442 6e641b5453f9
child 11446 908aed8525f9
permissions -rw-r--r--
Accept scheme from net
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10951
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff changeset
     1
unit uFLNetProtocol;
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff changeset
     2
interface
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff changeset
     3
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff changeset
     4
procedure passNetData(p: pointer); cdecl;
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff changeset
     5
11421
78d6b99ddcb0 Can send chat messages now
unc0rr
parents: 11420
diff changeset
     6
procedure sendChatLine(msg: PChar); cdecl;
11428
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11425
diff changeset
     7
procedure joinRoom(roomName: PChar); cdecl;
11429
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
     8
procedure partRoom(msg: PChar); cdecl;
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
     9
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
    10
procedure ResetNetState;
11421
78d6b99ddcb0 Can send chat messages now
unc0rr
parents: 11420
diff changeset
    11
10951
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff changeset
    12
implementation
11438
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    13
uses uFLNetTypes, uFLTypes, uFLUICallback, uFLNet, uFLGameConfig, uFLUtils;
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    14
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    15
type
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    16
    PHandler = procedure (var t: TCmdData);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    17
11429
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
    18
var isInRoom: boolean;
11435
f88b3948adf3 UI knowns local player nickname
unc0rr
parents: 11434
diff changeset
    19
    myNickname: shortstring;
11429
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
    20
11435
f88b3948adf3 UI knowns local player nickname
unc0rr
parents: 11434
diff changeset
    21
procedure handler_ADD_TEAM(var p: TCmdParam);
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    22
begin
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    23
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    24
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    25
procedure handler_ADD_TEAM_s(var s: TCmdParamS);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    26
begin
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    27
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    28
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    29
procedure handler_ASKPASSWORD(var p: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    30
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    31
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    32
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    33
procedure handler_BANLIST(var p: TCmdParam);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    34
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    35
end;
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
    36
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    37
procedure handler_BANLIST_s(var s: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    38
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    39
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    40
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    41
procedure handler_BYE(var p: TCmdParamSL);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    42
begin
11420
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 11418
diff changeset
    43
    sendUI(mtDisconnected, @p.str2[1], length(p.str2));
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    44
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
    45
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    46
procedure handler_CFG_AMMO(var p: TCmdParamSL);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    47
begin
11442
6e641b5453f9 Accept ammo scheme from network
unc0rr
parents: 11441
diff changeset
    48
    netSetAmmo(p.str1, p.str2)
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    49
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    50
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    51
procedure handler_CFG_DRAWNMAP(var p: TCmdParamL);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    52
begin
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    53
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    54
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    55
procedure handler_CFG_FEATURE_SIZE(var p: TCmdParami);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    56
begin
11438
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    57
    if isInRoom then
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    58
    begin
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    59
        netSetFeatureSize(p.param1);
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    60
        updatePreviewIfNeeded
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    61
    end;
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    62
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    63
11438
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    64
var fmcfgIndex: integer;
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    65
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    66
procedure handler_CFG_FULLMAPCONFIG(var p: TCmdParam);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    67
begin
11438
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    68
    fmcfgIndex:= 0;
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    69
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    70
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    71
procedure handler_CFG_FULLMAPCONFIG_s(var s: TCmdParamS);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    72
begin
11438
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    73
    if not isInRoom then exit;
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    74
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    75
    inc(fmcfgIndex);
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    76
    case fmcfgIndex of
11441
f7fa429e42ab Fix FULLMAPCONFIG handling
unc0rr
parents: 11439
diff changeset
    77
        1: netSetFeatureSize(strToInt(s.str1));
f7fa429e42ab Fix FULLMAPCONFIG handling
unc0rr
parents: 11439
diff changeset
    78
        2: if s.str1[0] <> '+' then netSetMap(s.str1);
f7fa429e42ab Fix FULLMAPCONFIG handling
unc0rr
parents: 11439
diff changeset
    79
        3: netSetMapGen(strToInt(s.str1));
f7fa429e42ab Fix FULLMAPCONFIG handling
unc0rr
parents: 11439
diff changeset
    80
        4: netSetMazeSize(strToInt(s.str1));
f7fa429e42ab Fix FULLMAPCONFIG handling
unc0rr
parents: 11439
diff changeset
    81
        5: netSetSeed(s.str1);
11438
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    82
        6: begin
11441
f7fa429e42ab Fix FULLMAPCONFIG handling
unc0rr
parents: 11439
diff changeset
    83
                netSetTemplate(strToInt(s.str1));
11438
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    84
                updatePreviewIfNeeded;
11441
f7fa429e42ab Fix FULLMAPCONFIG handling
unc0rr
parents: 11439
diff changeset
    85
            end;
11438
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    86
    end;
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    87
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    88
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    89
procedure handler_CFG_MAP(var p: TCmdParamS);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    90
begin
11438
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    91
    if isInRoom then
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    92
        netSetMap(p.str1);
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    93
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    94
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    95
procedure handler_CFG_MAPGEN(var p: TCmdParami);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
    96
begin
11438
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    97
    if isInRoom then
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    98
    begin
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    99
        netSetMapGen(p.param1);
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
   100
        updatePreviewIfNeeded
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
   101
    end
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   102
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   103
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   104
procedure handler_CFG_MAZE_SIZE(var p: TCmdParami);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   105
begin
11438
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
   106
    if isInRoom then
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
   107
    begin
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
   108
        netSetMazeSize(p.param1);
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
   109
        updatePreviewIfNeeded
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
   110
    end
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   111
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   112
11445
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   113
var schemeIndex: LongInt;
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   114
    tmpScheme: TScheme;
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   115
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   116
procedure handler_CFG_SCHEME(var p: TCmdParam);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   117
begin
11445
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   118
    schemeIndex:= 0
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   119
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   120
11445
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   121
const schemeFields: array[0..43] of pointer = (
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   122
      @tmpScheme.schemeName          //  0
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   123
    , @tmpScheme.fortsmode           //  1
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   124
    , @tmpScheme.divteams            //  2
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   125
    , @tmpScheme.solidland           //  3
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   126
    , @tmpScheme.border              //  4
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   127
    , @tmpScheme.lowgrav             //  5
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   128
    , @tmpScheme.laser               //  6
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   129
    , @tmpScheme.invulnerability     //  7
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   130
    , @tmpScheme.resethealth         //  8
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   131
    , @tmpScheme.vampiric            //  9
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   132
    , @tmpScheme.karma               // 10
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   133
    , @tmpScheme.artillery           // 11
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   134
    , @tmpScheme.randomorder         // 12
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   135
    , @tmpScheme.king                // 13
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   136
    , @tmpScheme.placehog            // 14
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   137
    , @tmpScheme.sharedammo          // 15
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   138
    , @tmpScheme.disablegirders      // 16
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   139
    , @tmpScheme.disablelandobjects  // 17
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   140
    , @tmpScheme.aisurvival          // 18
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   141
    , @tmpScheme.infattack           // 19
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   142
    , @tmpScheme.resetweps           // 20
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   143
    , @tmpScheme.perhogammo          // 21
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   144
    , @tmpScheme.disablewind         // 22
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   145
    , @tmpScheme.morewind            // 23
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   146
    , @tmpScheme.tagteam             // 24
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   147
    , @tmpScheme.bottomborder        // 25
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   148
    , @tmpScheme.damagefactor        // 26
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   149
    , @tmpScheme.turntime            // 27
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   150
    , @tmpScheme.health              // 28
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   151
    , @tmpScheme.suddendeath         // 29
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   152
    , @tmpScheme.caseprobability     // 30
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   153
    , @tmpScheme.minestime           // 31
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   154
    , @tmpScheme.minesnum            // 32
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   155
    , @tmpScheme.minedudpct          // 33
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   156
    , @tmpScheme.explosives          // 34
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   157
    , @tmpScheme.airmines            // 35
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   158
    , @tmpScheme.healthprobability   // 36
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   159
    , @tmpScheme.healthcaseamount    // 37
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   160
    , @tmpScheme.waterrise           // 38
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   161
    , @tmpScheme.healthdecrease      // 39
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   162
    , @tmpScheme.ropepct             // 40
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   163
    , @tmpScheme.getawaytime         // 41
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   164
    , @tmpScheme.worldedge           // 42
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   165
    , @tmpScheme.scriptparam         // 43
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   166
   );
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   167
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   168
procedure handler_CFG_SCHEME_s(var s: TCmdParamS);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   169
begin
11445
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   170
    if(schemeIndex = 0) then
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   171
        tmpScheme.schemeName:= s.str1
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   172
    else
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   173
    if(schemeIndex = 43) then
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   174
        tmpScheme.scriptparam:= copy(s.str1, 2, length(s.str1) - 1)
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   175
    else
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   176
    if(schemeIndex < 26) then
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   177
        PBoolean(schemeFields[schemeIndex])^:= s.str1[1] = 't'
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   178
    else
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   179
    if(schemeIndex < 43) then
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   180
        PLongInt(schemeFields[schemeIndex])^:= strToInt(s.str1);
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   181
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   182
    if(schemeIndex = 43) then
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   183
        netSetScheme(tmpScheme);
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   184
330c14f4ba69 Accept scheme from net
unc0rr
parents: 11442
diff changeset
   185
    inc(schemeIndex);
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   186
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   187
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   188
procedure handler_CFG_SCRIPT(var p: TCmdParamS);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   189
begin
11436
80a9b14bb8d3 Some game config methods and signals
unc0rr
parents: 11435
diff changeset
   190
    if isInRoom then
80a9b14bb8d3 Some game config methods and signals
unc0rr
parents: 11435
diff changeset
   191
        netSetScript(p.str1)
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   192
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   193
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   194
procedure handler_CFG_SEED(var p: TCmdParamS);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   195
begin
11436
80a9b14bb8d3 Some game config methods and signals
unc0rr
parents: 11435
diff changeset
   196
    if isInRoom then
80a9b14bb8d3 Some game config methods and signals
unc0rr
parents: 11435
diff changeset
   197
        netSetSeed(p.str1)
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   198
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   199
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   200
procedure handler_CFG_TEMPLATE(var p: TCmdParami);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   201
begin
11438
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
   202
    if isInRoom then
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
   203
    begin
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
   204
        netSetTemplate(p.param1);
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
   205
        updatePreviewIfNeeded
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
   206
    end
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   207
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   208
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   209
procedure handler_CFG_THEME(var p: TCmdParamS);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   210
begin
11436
80a9b14bb8d3 Some game config methods and signals
unc0rr
parents: 11435
diff changeset
   211
    if isInRoom then
80a9b14bb8d3 Some game config methods and signals
unc0rr
parents: 11435
diff changeset
   212
        netSetTheme(p.str1)
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   213
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   214
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   215
procedure handler_CHAT(var p: TCmdParamSL);
11420
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 11418
diff changeset
   216
var s: string;
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   217
begin
11420
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 11418
diff changeset
   218
    s:= p.str1 + #10 + p.str2;
11429
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   219
    if isInRoom then
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   220
        sendUI(mtRoomChatLine, @s[1], length(s))
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   221
    else
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   222
        sendUI(mtLobbyChatLine, @s[1], length(s));
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   223
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   224
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   225
procedure handler_CLIENT_FLAGS(var p: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   226
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   227
end;
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   228
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   229
procedure handler_CLIENT_FLAGS_s(var s: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   230
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   231
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   232
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   233
procedure handler_CONNECTED(var p: TCmdParami);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   234
begin
11420
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 11418
diff changeset
   235
    sendUI(mtConnected, nil, 0);
11439
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   236
    writeln('Server features version ', p.param1);
11420
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 11418
diff changeset
   237
    sendNet('PROTO' + #10 + '51');
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 11418
diff changeset
   238
    sendNet('NICK' + #10 + 'qmlfrontend');
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   239
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   240
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   241
procedure handler_EM(var p: TCmdParam);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   242
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   243
end;
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   244
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   245
procedure handler_EM_s(var s: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   246
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   247
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   248
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   249
procedure handler_ERROR(var p: TCmdParamL);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   250
begin
11428
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11425
diff changeset
   251
    sendUI(mtError, @p.str1[1], length(p.str1));
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   252
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   253
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   254
procedure handler_HH_NUM(var p: TCmdParam);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   255
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   256
end;
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   257
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   258
procedure handler_HH_NUM_s(var s: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   259
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   260
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   261
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   262
procedure handler_INFO(var p: TCmdParam);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   263
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   264
end;
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   265
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   266
procedure handler_INFO_s(var s: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   267
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   268
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   269
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   270
procedure handler_JOINED(var p: TCmdParam);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   271
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   272
end;
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   273
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   274
procedure handler_JOINED_s(var s: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   275
begin
11435
f88b3948adf3 UI knowns local player nickname
unc0rr
parents: 11434
diff changeset
   276
    if s.str1 = myNickname then // we joined a room
11429
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   277
    begin
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   278
        isInRoom:= true;
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   279
        sendUI(mtMoveToRoom, nil, 0);
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   280
    end;
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   281
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   282
    sendUI(mtAddRoomClient, @s.str1[1], length(s.str1));
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   283
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   284
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   285
procedure handler_JOINING(var p: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   286
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   287
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   288
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   289
procedure handler_KICKED(var p: TCmdParam);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   290
begin
11429
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   291
    isInRoom:= false;
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   292
    sendUI(mtMoveToLobby, nil, 0);
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   293
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   294
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   295
procedure handler_LEFT(var p: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   296
begin
11429
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   297
    sendUI(mtRemoveLobbyClient, @p.str1[1], length(p.str1));
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   298
end;
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   299
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   300
procedure handler_LEFT_s(var s: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   301
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   302
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   303
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   304
procedure handler_LOBBY_JOINED(var p: TCmdParam);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   305
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   306
end;
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   307
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   308
procedure handler_LOBBY_JOINED_s(var s: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   309
begin
11435
f88b3948adf3 UI knowns local player nickname
unc0rr
parents: 11434
diff changeset
   310
    if s.str1 = myNickname then
11429
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   311
    begin
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   312
        sendUI(mtMoveToLobby, nil, 0);
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   313
        sendNet('LIST');
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   314
    end;
11424
8a5cc31483c6 - Handle ROOM DEL
unc0rr
parents: 11423
diff changeset
   315
11420
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents: 11418
diff changeset
   316
    sendUI(mtAddLobbyClient, @s.str1[1], length(s.str1));
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   317
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   318
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   319
procedure handler_LOBBY_LEFT(var p: TCmdParamSL);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   320
begin
11428
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11425
diff changeset
   321
    p.str2:= p.str1 + #10 + p.str2;
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11425
diff changeset
   322
    sendUI(mtRemoveLobbyClient, @p.str2[1], length(p.str2));
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   323
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   324
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   325
procedure handler_NICK(var p: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   326
begin
11435
f88b3948adf3 UI knowns local player nickname
unc0rr
parents: 11434
diff changeset
   327
    myNickname:= p.str1;
f88b3948adf3 UI knowns local player nickname
unc0rr
parents: 11434
diff changeset
   328
    sendUI(mtNickname, @p.str1[1], length(p.str1));
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   329
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   330
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   331
procedure handler_NOTICE(var p: TCmdParamL);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   332
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   333
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   334
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   335
procedure handler_PING(var p: TCmdParam);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   336
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   337
    sendNet('PONG')
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   338
end;
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   339
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   340
procedure handler_PING_s(var s: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   341
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   342
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   343
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   344
procedure handler_PROTO(var p: TCmdParami);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   345
begin
11439
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   346
    writeln('Protocol ', p.param1)
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   347
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   348
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   349
procedure handler_REMOVE_TEAM(var p: TCmdParamS);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   350
begin
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   351
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   352
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   353
var roomInfo: string;
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   354
    roomLinesCount: integer;
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   355
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   356
procedure handler_ROOMS(var p: TCmdParam);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   357
begin
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   358
    roomInfo:= '';
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   359
    roomLinesCount:= 0
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   360
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   361
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   362
procedure handler_ROOMS_s(var s: TCmdParamS);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   363
begin
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   364
    roomInfo:= roomInfo + s.str1 + #10;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   365
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   366
    if roomLinesCount = 8 then
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   367
    begin
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   368
        sendUI(mtAddRoom, @roomInfo[1], length(roomInfo) - 1);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   369
        roomLinesCount:= 0;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   370
        roomInfo:= ''
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   371
    end else inc(roomLinesCount);
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   372
end;
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   373
11430
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   374
procedure handler_ROOM_ADD(var p: TCmdParam);
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   375
begin
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   376
    roomInfo:= '';
11430
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   377
    roomLinesCount:= 0
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   378
end;
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   379
11430
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   380
procedure handler_ROOM_ADD_s(var s: TCmdParamS);
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   381
begin
11430
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   382
    roomInfo:= roomInfo + s.str1 + #10;
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   383
    inc(roomLinesCount);
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   384
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   385
    if roomLinesCount = 9 then
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   386
    begin
11430
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   387
        sendUI(mtAddRoom, @roomInfo[1], length(roomInfo) - 1);
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   388
        roomInfo:= '';
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   389
        roomLinesCount:= 0
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   390
    end;
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   391
end;
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   392
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   393
procedure handler_ROOM_DEL(var p: TCmdParamS);
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   394
begin
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   395
    sendUI(mtRemoveRoom, @p.str1[1], length(p.str1));
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   396
end;
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   397
11430
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   398
procedure handler_ROOM_UPD(var p: TCmdParam);
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   399
begin
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   400
    roomInfo:= '';
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   401
    roomLinesCount:= 0
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   402
end;
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   403
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   404
procedure handler_ROOM_UPD_s(var s: TCmdParamS);
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   405
begin
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   406
    roomInfo:= roomInfo + s.str1 + #10;
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   407
    inc(roomLinesCount);
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   408
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   409
    if roomLinesCount = 10 then
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   410
        sendUI(mtUpdateRoom, @roomInfo[1], length(roomInfo) - 1);
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   411
end;
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   412
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   413
procedure handler_ROUND_FINISHED(var p: TCmdParam);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   414
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   415
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   416
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   417
procedure handler_RUN_GAME(var p: TCmdParam);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   418
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   419
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   420
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   421
procedure handler_SERVER_AUTH(var p: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   422
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   423
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   424
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   425
procedure handler_SERVER_MESSAGE(var p: TCmdParamL);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   426
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   427
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   428
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   429
procedure handler_SERVER_VARS(var p: TCmdParamSL);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   430
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   431
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   432
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   433
procedure handler_TEAM_ACCEPTED(var p: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   434
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   435
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   436
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   437
procedure handler_TEAM_COLOR(var p: TCmdParam);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   438
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   439
end;
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   440
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   441
procedure handler_TEAM_COLOR_s(var s: TCmdParamS);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   442
begin
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   443
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   444
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   445
procedure handler_WARNING(var p: TCmdParamL);
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   446
begin
11428
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11425
diff changeset
   447
    sendUI(mtWarning, @p.str1[1], length(p.str1));
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   448
end;
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   449
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   450
const handlers: array[TCmdType] of PHandler = (PHandler(@handler_ADD_TEAM),
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   451
    PHandler(@handler_ADD_TEAM_s), PHandler(@handler_ASKPASSWORD),
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   452
    PHandler(@handler_BANLIST), PHandler(@handler_BANLIST_s),
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   453
    PHandler(@handler_BYE), PHandler(@handler_CFG_AMMO),
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   454
    PHandler(@handler_CFG_DRAWNMAP), PHandler(@handler_CFG_FEATURE_SIZE),
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   455
    PHandler(@handler_CFG_FULLMAPCONFIG), PHandler(@handler_CFG_FULLMAPCONFIG_s),
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   456
    PHandler(@handler_CFG_MAP), PHandler(@handler_CFG_MAPGEN),
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   457
    PHandler(@handler_CFG_MAZE_SIZE), PHandler(@handler_CFG_SCHEME),
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   458
    PHandler(@handler_CFG_SCHEME_s), PHandler(@handler_CFG_SCRIPT),
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   459
    PHandler(@handler_CFG_SEED), PHandler(@handler_CFG_TEMPLATE),
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   460
    PHandler(@handler_CFG_THEME), PHandler(@handler_CHAT),
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   461
    PHandler(@handler_CLIENT_FLAGS), PHandler(@handler_CLIENT_FLAGS_s),
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   462
    PHandler(@handler_CONNECTED), PHandler(@handler_EM), PHandler(@handler_EM_s),
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   463
    PHandler(@handler_ERROR), PHandler(@handler_HH_NUM),
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   464
    PHandler(@handler_HH_NUM_s), PHandler(@handler_INFO), PHandler(@handler_INFO_s),
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   465
    PHandler(@handler_JOINED), PHandler(@handler_JOINED_s),
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   466
    PHandler(@handler_JOINING), PHandler(@handler_KICKED), PHandler(@handler_LEFT),
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   467
    PHandler(@handler_LEFT_s), PHandler(@handler_LOBBY_JOINED),
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   468
    PHandler(@handler_LOBBY_JOINED_s), PHandler(@handler_LOBBY_LEFT),
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   469
    PHandler(@handler_NICK), PHandler(@handler_NOTICE), PHandler(@handler_PING),
11434
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   470
    PHandler(@handler_PING_s), PHandler(@handler_PROTO),
d96a37de1076 Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents: 11430
diff changeset
   471
    PHandler(@handler_REMOVE_TEAM), PHandler(@handler_ROOMS),
11430
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   472
    PHandler(@handler_ROOMS_s), PHandler(@handler_ROOM_ADD),
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   473
    PHandler(@handler_ROOM_ADD_s), PHandler(@handler_ROOM_DEL),
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   474
    PHandler(@handler_ROOM_UPD), PHandler(@handler_ROOM_UPD_s),
11423
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   475
    PHandler(@handler_ROUND_FINISHED), PHandler(@handler_RUN_GAME),
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   476
    PHandler(@handler_SERVER_AUTH), PHandler(@handler_SERVER_MESSAGE),
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   477
    PHandler(@handler_SERVER_VARS), PHandler(@handler_TEAM_ACCEPTED),
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   478
    PHandler(@handler_TEAM_COLOR), PHandler(@handler_TEAM_COLOR_s),
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11421
diff changeset
   479
    PHandler(@handler_WARNING));
10951
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff changeset
   480
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff changeset
   481
procedure passNetData(p: pointer); cdecl;
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff changeset
   482
begin
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   483
    handlers[TCmdData(p^).cmd.cmd](TCmdData(p^))
10951
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff changeset
   484
end;
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff changeset
   485
11421
78d6b99ddcb0 Can send chat messages now
unc0rr
parents: 11420
diff changeset
   486
procedure sendChatLine(msg: PChar); cdecl;
78d6b99ddcb0 Can send chat messages now
unc0rr
parents: 11420
diff changeset
   487
begin
78d6b99ddcb0 Can send chat messages now
unc0rr
parents: 11420
diff changeset
   488
    sendNetLn('CHAT');
78d6b99ddcb0 Can send chat messages now
unc0rr
parents: 11420
diff changeset
   489
    sendNet(msg);
78d6b99ddcb0 Can send chat messages now
unc0rr
parents: 11420
diff changeset
   490
end;
78d6b99ddcb0 Can send chat messages now
unc0rr
parents: 11420
diff changeset
   491
11428
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11425
diff changeset
   492
procedure joinRoom(roomName: PChar); cdecl;
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11425
diff changeset
   493
begin
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11425
diff changeset
   494
    sendNetLn('JOIN_ROOM');
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11425
diff changeset
   495
    sendNet(roomName);
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11425
diff changeset
   496
end;
e045dc60c37e - Warnings/errors message box
unc0rr
parents: 11425
diff changeset
   497
11429
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   498
procedure partRoom(msg: PChar); cdecl;
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   499
var s: string;
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   500
begin
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   501
    if isInRoom then
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   502
    begin
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   503
        isInRoom:= false;
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   504
        s:= 'PART';
11430
2947f06e8533 Another approach to parsing two-lines protocol commands
unc0rr
parents: 11429
diff changeset
   505
        if length(msg) > 0 then
11429
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   506
            s:= s + #10 + msg;
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   507
        sendNet(s);
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   508
        sendUI(mtMoveToLobby, nil, 0);
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   509
    end
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   510
end;
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   511
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   512
procedure ResetNetState;
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   513
begin
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   514
    isInRoom:= false;
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   515
end;
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
   516
10951
89a7f617e091 - Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff changeset
   517
end.
11418
ffff8a0d1a76 Implement processing net commands in the main thread
unc0rr
parents: 10953
diff changeset
   518