author | unc0rr |
Tue, 01 Dec 2015 19:49:59 +0300 | |
branch | qmlfrontend |
changeset 11441 | f7fa429e42ab |
parent 11439 | 23912c93935a |
child 11442 | 6e641b5453f9 |
permissions | -rw-r--r-- |
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 | 6 |
procedure sendChatLine(msg: PChar); cdecl; |
11428 | 7 |
procedure joinRoom(roomName: PChar); cdecl; |
11429 | 8 |
procedure partRoom(msg: PChar); cdecl; |
9 |
||
10 |
procedure ResetNetState; |
|
11421 | 11 |
|
10951
89a7f617e091
- Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff
changeset
|
12 |
implementation |
11438 | 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 | 18 |
var isInRoom: boolean; |
11435 | 19 |
myNickname: shortstring; |
11429 | 20 |
|
11435 | 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 | 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 | 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 |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
48 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
49 |
|
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
50 |
procedure handler_CFG_DRAWNMAP(var p: TCmdParamL); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
51 |
begin |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
52 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
53 |
|
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
54 |
procedure handler_CFG_FEATURE_SIZE(var p: TCmdParami); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
55 |
begin |
11438 | 56 |
if isInRoom then |
57 |
begin |
|
58 |
netSetFeatureSize(p.param1); |
|
59 |
updatePreviewIfNeeded |
|
60 |
end; |
|
11434
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
61 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
62 |
|
11438 | 63 |
var fmcfgIndex: integer; |
64 |
||
11434
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
65 |
procedure handler_CFG_FULLMAPCONFIG(var p: TCmdParam); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
66 |
begin |
11438 | 67 |
fmcfgIndex:= 0; |
11434
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
68 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
69 |
|
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
70 |
procedure handler_CFG_FULLMAPCONFIG_s(var s: TCmdParamS); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
71 |
begin |
11438 | 72 |
if not isInRoom then exit; |
73 |
||
74 |
inc(fmcfgIndex); |
|
75 |
case fmcfgIndex of |
|
11441 | 76 |
1: netSetFeatureSize(strToInt(s.str1)); |
77 |
2: if s.str1[0] <> '+' then netSetMap(s.str1); |
|
78 |
3: netSetMapGen(strToInt(s.str1)); |
|
79 |
4: netSetMazeSize(strToInt(s.str1)); |
|
80 |
5: netSetSeed(s.str1); |
|
11438 | 81 |
6: begin |
11441 | 82 |
netSetTemplate(strToInt(s.str1)); |
11438 | 83 |
updatePreviewIfNeeded; |
11441 | 84 |
end; |
11438 | 85 |
end; |
11434
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
86 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
87 |
|
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
88 |
procedure handler_CFG_MAP(var p: TCmdParamS); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
89 |
begin |
11438 | 90 |
if isInRoom then |
91 |
netSetMap(p.str1); |
|
11434
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
92 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
93 |
|
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
94 |
procedure handler_CFG_MAPGEN(var p: TCmdParami); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
95 |
begin |
11438 | 96 |
if isInRoom then |
97 |
begin |
|
98 |
netSetMapGen(p.param1); |
|
99 |
updatePreviewIfNeeded |
|
100 |
end |
|
11434
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
101 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
102 |
|
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
103 |
procedure handler_CFG_MAZE_SIZE(var p: TCmdParami); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
104 |
begin |
11438 | 105 |
if isInRoom then |
106 |
begin |
|
107 |
netSetMazeSize(p.param1); |
|
108 |
updatePreviewIfNeeded |
|
109 |
end |
|
11434
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
110 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
111 |
|
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
112 |
procedure handler_CFG_SCHEME(var p: TCmdParam); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
113 |
begin |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
114 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
115 |
|
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
116 |
procedure handler_CFG_SCHEME_s(var s: TCmdParamS); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
117 |
begin |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
118 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
119 |
|
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
120 |
procedure handler_CFG_SCRIPT(var p: TCmdParamS); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
121 |
begin |
11436 | 122 |
if isInRoom then |
123 |
netSetScript(p.str1) |
|
11434
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
124 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
125 |
|
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
126 |
procedure handler_CFG_SEED(var p: TCmdParamS); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
127 |
begin |
11436 | 128 |
if isInRoom then |
129 |
netSetSeed(p.str1) |
|
11434
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
130 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
131 |
|
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
132 |
procedure handler_CFG_TEMPLATE(var p: TCmdParami); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
133 |
begin |
11438 | 134 |
if isInRoom then |
135 |
begin |
|
136 |
netSetTemplate(p.param1); |
|
137 |
updatePreviewIfNeeded |
|
138 |
end |
|
11434
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
139 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
140 |
|
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
141 |
procedure handler_CFG_THEME(var p: TCmdParamS); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
142 |
begin |
11436 | 143 |
if isInRoom then |
144 |
netSetTheme(p.str1) |
|
11434
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
145 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
146 |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
147 |
procedure handler_CHAT(var p: TCmdParamSL); |
11420 | 148 |
var s: string; |
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
149 |
begin |
11420 | 150 |
s:= p.str1 + #10 + p.str2; |
11429 | 151 |
if isInRoom then |
152 |
sendUI(mtRoomChatLine, @s[1], length(s)) |
|
153 |
else |
|
154 |
sendUI(mtLobbyChatLine, @s[1], length(s)); |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
155 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
156 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
157 |
procedure handler_CLIENT_FLAGS(var p: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
158 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
159 |
end; |
11423 | 160 |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
161 |
procedure handler_CLIENT_FLAGS_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
162 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
163 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
164 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
165 |
procedure handler_CONNECTED(var p: TCmdParami); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
166 |
begin |
11420 | 167 |
sendUI(mtConnected, nil, 0); |
11439 | 168 |
writeln('Server features version ', p.param1); |
11420 | 169 |
sendNet('PROTO' + #10 + '51'); |
170 |
sendNet('NICK' + #10 + 'qmlfrontend'); |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
171 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
172 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
173 |
procedure handler_EM(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
174 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
175 |
end; |
11423 | 176 |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
177 |
procedure handler_EM_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
178 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
179 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
180 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
181 |
procedure handler_ERROR(var p: TCmdParamL); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
182 |
begin |
11428 | 183 |
sendUI(mtError, @p.str1[1], length(p.str1)); |
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
184 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
185 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
186 |
procedure handler_HH_NUM(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
187 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
188 |
end; |
11423 | 189 |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
190 |
procedure handler_HH_NUM_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
191 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
192 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
193 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
194 |
procedure handler_INFO(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
195 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
196 |
end; |
11423 | 197 |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
198 |
procedure handler_INFO_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
199 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
200 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
201 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
202 |
procedure handler_JOINED(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
203 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
204 |
end; |
11423 | 205 |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
206 |
procedure handler_JOINED_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
207 |
begin |
11435 | 208 |
if s.str1 = myNickname then // we joined a room |
11429 | 209 |
begin |
210 |
isInRoom:= true; |
|
211 |
sendUI(mtMoveToRoom, nil, 0); |
|
212 |
end; |
|
213 |
||
214 |
sendUI(mtAddRoomClient, @s.str1[1], length(s.str1)); |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
215 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
216 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
217 |
procedure handler_JOINING(var p: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
218 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
219 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
220 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
221 |
procedure handler_KICKED(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
222 |
begin |
11429 | 223 |
isInRoom:= false; |
224 |
sendUI(mtMoveToLobby, nil, 0); |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
225 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
226 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
227 |
procedure handler_LEFT(var p: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
228 |
begin |
11429 | 229 |
sendUI(mtRemoveLobbyClient, @p.str1[1], length(p.str1)); |
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
230 |
end; |
11423 | 231 |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
232 |
procedure handler_LEFT_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
233 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
234 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
235 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
236 |
procedure handler_LOBBY_JOINED(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
237 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
238 |
end; |
11423 | 239 |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
240 |
procedure handler_LOBBY_JOINED_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
241 |
begin |
11435 | 242 |
if s.str1 = myNickname then |
11429 | 243 |
begin |
244 |
sendUI(mtMoveToLobby, nil, 0); |
|
245 |
sendNet('LIST'); |
|
246 |
end; |
|
11424 | 247 |
|
11420 | 248 |
sendUI(mtAddLobbyClient, @s.str1[1], length(s.str1)); |
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
249 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
250 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
251 |
procedure handler_LOBBY_LEFT(var p: TCmdParamSL); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
252 |
begin |
11428 | 253 |
p.str2:= p.str1 + #10 + p.str2; |
254 |
sendUI(mtRemoveLobbyClient, @p.str2[1], length(p.str2)); |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
255 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
256 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
257 |
procedure handler_NICK(var p: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
258 |
begin |
11435 | 259 |
myNickname:= p.str1; |
260 |
sendUI(mtNickname, @p.str1[1], length(p.str1)); |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
261 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
262 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
263 |
procedure handler_NOTICE(var p: TCmdParamL); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
264 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
265 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
266 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
267 |
procedure handler_PING(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
268 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
269 |
sendNet('PONG') |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
270 |
end; |
11423 | 271 |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
272 |
procedure handler_PING_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
273 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
274 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
275 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
276 |
procedure handler_PROTO(var p: TCmdParami); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
277 |
begin |
11439 | 278 |
writeln('Protocol ', p.param1) |
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
279 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
280 |
|
11434
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
281 |
procedure handler_REMOVE_TEAM(var p: TCmdParamS); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
282 |
begin |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
283 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
284 |
|
11423 | 285 |
var roomInfo: string; |
286 |
roomLinesCount: integer; |
|
287 |
||
11434
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
288 |
procedure handler_ROOMS(var p: TCmdParam); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
289 |
begin |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
290 |
roomInfo:= ''; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
291 |
roomLinesCount:= 0 |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
292 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
293 |
|
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
294 |
procedure handler_ROOMS_s(var s: TCmdParamS); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
295 |
begin |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
296 |
roomInfo:= roomInfo + s.str1 + #10; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
297 |
|
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
298 |
if roomLinesCount = 8 then |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
299 |
begin |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
300 |
sendUI(mtAddRoom, @roomInfo[1], length(roomInfo) - 1); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
301 |
roomLinesCount:= 0; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
302 |
roomInfo:= '' |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
303 |
end else inc(roomLinesCount); |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
304 |
end; |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
305 |
|
11430
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
306 |
procedure handler_ROOM_ADD(var p: TCmdParam); |
11423 | 307 |
begin |
308 |
roomInfo:= ''; |
|
11430
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
309 |
roomLinesCount:= 0 |
11423 | 310 |
end; |
311 |
||
11430
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
312 |
procedure handler_ROOM_ADD_s(var s: TCmdParamS); |
11423 | 313 |
begin |
11430
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
314 |
roomInfo:= roomInfo + s.str1 + #10; |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
315 |
inc(roomLinesCount); |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
316 |
|
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
317 |
if roomLinesCount = 9 then |
11423 | 318 |
begin |
11430
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
319 |
sendUI(mtAddRoom, @roomInfo[1], length(roomInfo) - 1); |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
320 |
roomInfo:= ''; |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
321 |
roomLinesCount:= 0 |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
322 |
end; |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
323 |
end; |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
324 |
|
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
325 |
procedure handler_ROOM_DEL(var p: TCmdParamS); |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
326 |
begin |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
327 |
sendUI(mtRemoveRoom, @p.str1[1], length(p.str1)); |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
328 |
end; |
11423 | 329 |
|
11430
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
330 |
procedure handler_ROOM_UPD(var p: TCmdParam); |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
331 |
begin |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
332 |
roomInfo:= ''; |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
333 |
roomLinesCount:= 0 |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
334 |
end; |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
335 |
|
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
336 |
procedure handler_ROOM_UPD_s(var s: TCmdParamS); |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
337 |
begin |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
338 |
roomInfo:= roomInfo + s.str1 + #10; |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
339 |
inc(roomLinesCount); |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
340 |
|
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
341 |
if roomLinesCount = 10 then |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
342 |
sendUI(mtUpdateRoom, @roomInfo[1], length(roomInfo) - 1); |
11423 | 343 |
end; |
344 |
||
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
345 |
procedure handler_ROUND_FINISHED(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
346 |
begin |
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 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
349 |
procedure handler_RUN_GAME(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
350 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
351 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
352 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
353 |
procedure handler_SERVER_AUTH(var p: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
354 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
355 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
356 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
357 |
procedure handler_SERVER_MESSAGE(var p: TCmdParamL); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
358 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
359 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
360 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
361 |
procedure handler_SERVER_VARS(var p: TCmdParamSL); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
362 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
363 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
364 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
365 |
procedure handler_TEAM_ACCEPTED(var p: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
366 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
367 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
368 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
369 |
procedure handler_TEAM_COLOR(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
370 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
371 |
end; |
11423 | 372 |
|
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
373 |
procedure handler_TEAM_COLOR_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
374 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
375 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
376 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
377 |
procedure handler_WARNING(var p: TCmdParamL); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
378 |
begin |
11428 | 379 |
sendUI(mtWarning, @p.str1[1], length(p.str1)); |
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
380 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
381 |
|
11434
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
382 |
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
|
383 |
PHandler(@handler_ADD_TEAM_s), PHandler(@handler_ASKPASSWORD), |
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
384 |
PHandler(@handler_BANLIST), PHandler(@handler_BANLIST_s), |
11434
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
385 |
PHandler(@handler_BYE), PHandler(@handler_CFG_AMMO), |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
386 |
PHandler(@handler_CFG_DRAWNMAP), PHandler(@handler_CFG_FEATURE_SIZE), |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
387 |
PHandler(@handler_CFG_FULLMAPCONFIG), PHandler(@handler_CFG_FULLMAPCONFIG_s), |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
388 |
PHandler(@handler_CFG_MAP), PHandler(@handler_CFG_MAPGEN), |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
389 |
PHandler(@handler_CFG_MAZE_SIZE), PHandler(@handler_CFG_SCHEME), |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
390 |
PHandler(@handler_CFG_SCHEME_s), PHandler(@handler_CFG_SCRIPT), |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
391 |
PHandler(@handler_CFG_SEED), PHandler(@handler_CFG_TEMPLATE), |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
392 |
PHandler(@handler_CFG_THEME), PHandler(@handler_CHAT), |
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
393 |
PHandler(@handler_CLIENT_FLAGS), PHandler(@handler_CLIENT_FLAGS_s), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
394 |
PHandler(@handler_CONNECTED), PHandler(@handler_EM), PHandler(@handler_EM_s), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
395 |
PHandler(@handler_ERROR), PHandler(@handler_HH_NUM), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
396 |
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
|
397 |
PHandler(@handler_JOINED), PHandler(@handler_JOINED_s), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
398 |
PHandler(@handler_JOINING), PHandler(@handler_KICKED), PHandler(@handler_LEFT), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
399 |
PHandler(@handler_LEFT_s), PHandler(@handler_LOBBY_JOINED), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
400 |
PHandler(@handler_LOBBY_JOINED_s), PHandler(@handler_LOBBY_LEFT), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
401 |
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
|
402 |
PHandler(@handler_PING_s), PHandler(@handler_PROTO), |
d96a37de1076
Apply generated code to .pas files, fix FULLMAPCONFIG handling
unc0rr
parents:
11430
diff
changeset
|
403 |
PHandler(@handler_REMOVE_TEAM), PHandler(@handler_ROOMS), |
11430
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
404 |
PHandler(@handler_ROOMS_s), PHandler(@handler_ROOM_ADD), |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
405 |
PHandler(@handler_ROOM_ADD_s), PHandler(@handler_ROOM_DEL), |
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
406 |
PHandler(@handler_ROOM_UPD), PHandler(@handler_ROOM_UPD_s), |
11423 | 407 |
PHandler(@handler_ROUND_FINISHED), PHandler(@handler_RUN_GAME), |
408 |
PHandler(@handler_SERVER_AUTH), PHandler(@handler_SERVER_MESSAGE), |
|
409 |
PHandler(@handler_SERVER_VARS), PHandler(@handler_TEAM_ACCEPTED), |
|
410 |
PHandler(@handler_TEAM_COLOR), PHandler(@handler_TEAM_COLOR_s), |
|
411 |
PHandler(@handler_WARNING)); |
|
10951
89a7f617e091
- Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff
changeset
|
412 |
|
89a7f617e091
- Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff
changeset
|
413 |
procedure passNetData(p: pointer); cdecl; |
89a7f617e091
- Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff
changeset
|
414 |
begin |
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
415 |
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
|
416 |
end; |
89a7f617e091
- Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff
changeset
|
417 |
|
11421 | 418 |
procedure sendChatLine(msg: PChar); cdecl; |
419 |
begin |
|
420 |
sendNetLn('CHAT'); |
|
421 |
sendNet(msg); |
|
422 |
end; |
|
423 |
||
11428 | 424 |
procedure joinRoom(roomName: PChar); cdecl; |
425 |
begin |
|
426 |
sendNetLn('JOIN_ROOM'); |
|
427 |
sendNet(roomName); |
|
428 |
end; |
|
429 |
||
11429 | 430 |
procedure partRoom(msg: PChar); cdecl; |
431 |
var s: string; |
|
432 |
begin |
|
433 |
if isInRoom then |
|
434 |
begin |
|
435 |
isInRoom:= false; |
|
436 |
s:= 'PART'; |
|
11430
2947f06e8533
Another approach to parsing two-lines protocol commands
unc0rr
parents:
11429
diff
changeset
|
437 |
if length(msg) > 0 then |
11429 | 438 |
s:= s + #10 + msg; |
439 |
sendNet(s); |
|
440 |
sendUI(mtMoveToLobby, nil, 0); |
|
441 |
end |
|
442 |
end; |
|
443 |
||
444 |
procedure ResetNetState; |
|
445 |
begin |
|
446 |
isInRoom:= false; |
|
447 |
end; |
|
448 |
||
10951
89a7f617e091
- Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff
changeset
|
449 |
end. |
11418
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
450 |