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