author | unc0rr |
Fri, 20 Nov 2015 23:56:13 +0300 | |
branch | qmlfrontend |
changeset 11418 | 091149424aa4 |
parent 11416 | 78d6b99ddcb0 |
child 11419 | 8a5cc31483c6 |
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 |
|
11416 | 6 |
procedure sendChatLine(msg: PChar); cdecl; |
7 |
||
10951
89a7f617e091
- Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff
changeset
|
8 |
implementation |
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
9 |
uses uFLNetTypes, uFLTypes, uFLUICallback, uFLNet; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
10 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
11 |
type |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
12 |
PHandler = procedure (var t: TCmdData); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
13 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
14 |
procedure handler_ASKPASSWORD(var p: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
15 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
16 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
17 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
18 |
procedure handler_BANLIST(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
19 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
20 |
end; |
11418 | 21 |
|
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
22 |
procedure handler_BANLIST_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
23 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
24 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
25 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
26 |
procedure handler_BYE(var p: TCmdParamSL); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
27 |
begin |
11415 | 28 |
sendUI(mtDisconnected, @p.str2[1], length(p.str2)); |
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
29 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
30 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
31 |
procedure handler_CHAT(var p: TCmdParamSL); |
11415 | 32 |
var s: string; |
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
33 |
begin |
11415 | 34 |
s:= p.str1 + #10 + p.str2; |
35 |
sendUI(mtLobbyChatLine, @s[1], length(s)); |
|
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
36 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
37 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
38 |
procedure handler_CLIENT_FLAGS(var p: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
39 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
40 |
end; |
11418 | 41 |
|
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
42 |
procedure handler_CLIENT_FLAGS_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
43 |
begin |
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 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
46 |
procedure handler_CONNECTED(var p: TCmdParami); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
47 |
begin |
11415 | 48 |
sendUI(mtConnected, nil, 0); |
49 |
sendNet('PROTO' + #10 + '51'); |
|
50 |
sendNet('NICK' + #10 + 'qmlfrontend'); |
|
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
51 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
52 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
53 |
procedure handler_EM(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
54 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
55 |
end; |
11418 | 56 |
|
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
57 |
procedure handler_EM_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
58 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
59 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
60 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
61 |
procedure handler_ERROR(var p: TCmdParamL); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
62 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
63 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
64 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
65 |
procedure handler_HH_NUM(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
66 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
67 |
end; |
11418 | 68 |
|
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
69 |
procedure handler_HH_NUM_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
70 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
71 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
72 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
73 |
procedure handler_INFO(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
74 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
75 |
end; |
11418 | 76 |
|
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
77 |
procedure handler_INFO_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
78 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
79 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
80 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
81 |
procedure handler_JOINED(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
82 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
83 |
end; |
11418 | 84 |
|
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
85 |
procedure handler_JOINED_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
86 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
87 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
88 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
89 |
procedure handler_JOINING(var p: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
90 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
91 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
92 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
93 |
procedure handler_KICKED(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
94 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
95 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
96 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
97 |
procedure handler_LEFT(var p: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
98 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
99 |
end; |
11418 | 100 |
|
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
101 |
procedure handler_LEFT_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
102 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
103 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
104 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
105 |
procedure handler_LOBBY_JOINED(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
106 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
107 |
end; |
11418 | 108 |
|
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
109 |
procedure handler_LOBBY_JOINED_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
110 |
begin |
11415 | 111 |
sendUI(mtAddLobbyClient, @s.str1[1], length(s.str1)); |
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
112 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
113 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
114 |
procedure handler_LOBBY_LEFT(var p: TCmdParamSL); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
115 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
116 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
117 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
118 |
procedure handler_NICK(var p: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
119 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
120 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
121 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
122 |
procedure handler_NOTICE(var p: TCmdParamL); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
123 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
124 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
125 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
126 |
procedure handler_PING(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
127 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
128 |
sendNet('PONG') |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
129 |
end; |
11418 | 130 |
|
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
131 |
procedure handler_PING_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
132 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
133 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
134 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
135 |
procedure handler_PROTO(var p: TCmdParami); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
136 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
137 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
138 |
|
11418 | 139 |
type TRoomAction = (raUnknown, raAdd, raUpdate, raRemove); |
140 |
const raRoomInfoLength: array[TRoomAction] of integer = (1, 9, 10, 1); |
|
141 |
const raRoomAction: array[TRoomAction] of TMessageType = (mtAddRoom, mtAddRoom, mtUpdateRoom, mtRemoveRoom); |
|
142 |
var roomInfo: string; |
|
143 |
roomLinesCount: integer; |
|
144 |
roomAction: TRoomAction; |
|
145 |
||
146 |
procedure handler_ROOM(var p: TCmdParam); |
|
147 |
begin |
|
148 |
roomInfo:= ''; |
|
149 |
roomLinesCount:= 0; |
|
150 |
roomAction:= raUnknown |
|
151 |
end; |
|
152 |
||
153 |
procedure handler_ROOM_s(var s: TCmdParamS); |
|
154 |
begin |
|
155 |
if roomAction = raUnknown then |
|
156 |
begin |
|
157 |
if s.str1 = 'ADD' then |
|
158 |
roomAction:= raAdd |
|
159 |
else |
|
160 |
if s.str1 = 'UPD' then |
|
161 |
roomAction:= raUpdate |
|
162 |
else |
|
163 |
if s.str1 = 'DEL' then |
|
164 |
roomAction:= raRemove |
|
165 |
end |
|
166 |
else begin |
|
167 |
roomInfo:= roomInfo + s.str1 + #10; |
|
168 |
inc(roomLinesCount); |
|
169 |
||
170 |
if roomLinesCount = raRoomInfoLength[roomAction] then |
|
171 |
begin |
|
172 |
sendUI(raRoomAction[roomAction], @roomInfo[1], length(roomInfo)); |
|
173 |
roomLinesCount:= 0; |
|
174 |
roomInfo:= '' |
|
175 |
end; |
|
176 |
end; |
|
177 |
end; |
|
178 |
||
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
179 |
procedure handler_ROOMS(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
180 |
begin |
11418 | 181 |
roomInfo:= ''; |
182 |
roomLinesCount:= 0 |
|
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
183 |
end; |
11418 | 184 |
|
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
185 |
procedure handler_ROOMS_s(var s: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
186 |
begin |
11418 | 187 |
roomInfo:= roomInfo + s.str1 + #10; |
188 |
||
189 |
if roomLinesCount = 8 then |
|
190 |
begin |
|
191 |
sendUI(mtAddRoom, @roomInfo[1], length(roomInfo)); |
|
192 |
roomLinesCount:= 0; |
|
193 |
roomInfo:= '' |
|
194 |
end else inc(roomLinesCount); |
|
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
195 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
196 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
197 |
procedure handler_ROUND_FINISHED(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
198 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
199 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
200 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
201 |
procedure handler_RUN_GAME(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
202 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
203 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
204 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
205 |
procedure handler_SERVER_AUTH(var p: TCmdParamS); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
206 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
207 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
208 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
209 |
procedure handler_SERVER_MESSAGE(var p: TCmdParamL); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
210 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
211 |
end; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
212 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
213 |
procedure handler_SERVER_VARS(var p: TCmdParamSL); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
214 |
begin |
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_TEAM_ACCEPTED(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_TEAM_COLOR(var p: TCmdParam); |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
222 |
begin |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
223 |
end; |
11418 | 224 |
|
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
225 |
procedure handler_TEAM_COLOR_s(var s: 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; |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
228 |
|
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
229 |
procedure handler_WARNING(var p: TCmdParamL); |
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 |
const handlers: array[TCmdType] of PHandler = (PHandler(@handler_ASKPASSWORD), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
234 |
PHandler(@handler_BANLIST), PHandler(@handler_BANLIST_s), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
235 |
PHandler(@handler_BYE), PHandler(@handler_CHAT), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
236 |
PHandler(@handler_CLIENT_FLAGS), PHandler(@handler_CLIENT_FLAGS_s), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
237 |
PHandler(@handler_CONNECTED), PHandler(@handler_EM), PHandler(@handler_EM_s), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
238 |
PHandler(@handler_ERROR), PHandler(@handler_HH_NUM), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
239 |
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
|
240 |
PHandler(@handler_JOINED), PHandler(@handler_JOINED_s), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
241 |
PHandler(@handler_JOINING), PHandler(@handler_KICKED), PHandler(@handler_LEFT), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
242 |
PHandler(@handler_LEFT_s), PHandler(@handler_LOBBY_JOINED), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
243 |
PHandler(@handler_LOBBY_JOINED_s), PHandler(@handler_LOBBY_LEFT), |
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
244 |
PHandler(@handler_NICK), PHandler(@handler_NOTICE), PHandler(@handler_PING), |
11418 | 245 |
PHandler(@handler_PING_s), PHandler(@handler_PROTO), PHandler(@handler_ROOM), |
246 |
PHandler(@handler_ROOM_s), PHandler(@handler_ROOMS), PHandler(@handler_ROOMS_s), |
|
247 |
PHandler(@handler_ROUND_FINISHED), PHandler(@handler_RUN_GAME), |
|
248 |
PHandler(@handler_SERVER_AUTH), PHandler(@handler_SERVER_MESSAGE), |
|
249 |
PHandler(@handler_SERVER_VARS), PHandler(@handler_TEAM_ACCEPTED), |
|
250 |
PHandler(@handler_TEAM_COLOR), PHandler(@handler_TEAM_COLOR_s), |
|
251 |
PHandler(@handler_WARNING)); |
|
10951
89a7f617e091
- Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff
changeset
|
252 |
|
89a7f617e091
- Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff
changeset
|
253 |
procedure passNetData(p: pointer); cdecl; |
89a7f617e091
- Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff
changeset
|
254 |
begin |
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
255 |
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
|
256 |
end; |
89a7f617e091
- Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff
changeset
|
257 |
|
11416 | 258 |
procedure sendChatLine(msg: PChar); cdecl; |
259 |
begin |
|
260 |
sendNetLn('CHAT'); |
|
261 |
sendNet(msg); |
|
262 |
end; |
|
263 |
||
10951
89a7f617e091
- Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
diff
changeset
|
264 |
end. |
11413
ffff8a0d1a76
Implement processing net commands in the main thread
unc0rr
parents:
10953
diff
changeset
|
265 |