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