equal
deleted
inserted
replaced
28 procedure netSetTemplate(template: LongInt); |
28 procedure netSetTemplate(template: LongInt); |
29 procedure netSetAmmo(name: shortstring; definition: ansistring); |
29 procedure netSetAmmo(name: shortstring; definition: ansistring); |
30 procedure netSetScheme(scheme: TScheme); |
30 procedure netSetScheme(scheme: TScheme); |
31 procedure netAddTeam(team: TTeam); |
31 procedure netAddTeam(team: TTeam); |
32 procedure netSetTeamColor(team: shortstring; color: Longword); |
32 procedure netSetTeamColor(team: shortstring; color: Longword); |
|
33 procedure netSetHedgehogsNumber(team: shortstring; hogsNumber: Longword); |
|
34 procedure netRemoveTeam(teamName: shortstring); |
|
35 procedure netResetTeams(); |
33 procedure updatePreviewIfNeeded; |
36 procedure updatePreviewIfNeeded; |
34 |
37 |
35 procedure sendConfig(config: PGameConfig); |
38 procedure sendConfig(config: PGameConfig); |
36 |
39 |
37 implementation |
40 implementation |
220 sendUI(mtAddPlayingTeam, @msg[1], length(msg)); |
223 sendUI(mtAddPlayingTeam, @msg[1], length(msg)); |
221 |
224 |
222 msg:= teamName + #10 + colorsSet[teams[i].color]; |
225 msg:= teamName + #10 + colorsSet[teams[i].color]; |
223 sendUI(mtTeamColor, @msg[1], length(msg)); |
226 sendUI(mtTeamColor, @msg[1], length(msg)); |
224 |
227 |
|
228 msg:= teamName + #10 + IntToStr(hn); |
|
229 sendUI(mtHedgehogsNumber, @msg[1], length(msg)); |
|
230 |
225 msg:= teamName; |
231 msg:= teamName; |
226 sendUI(mtRemoveTeam, @msg[1], length(msg)) |
232 sendUI(mtRemoveTeam, @msg[1], length(msg)) |
227 end |
233 end |
228 end; |
234 end; |
229 |
235 |
230 |
236 |
231 procedure tryRemoveTeam(teamName: PChar); cdecl; |
237 procedure tryRemoveTeam(teamName: PChar); cdecl; |
232 var msg: ansistring; |
238 var msg: shortstring; |
233 i: Longword; |
239 i: Longword; |
234 tn: shortstring; |
240 tn: shortstring; |
235 begin |
241 begin |
236 with currentConfig do |
242 with currentConfig do |
237 begin |
243 begin |
260 |
266 |
261 |
267 |
262 procedure changeTeamColor(teamName: PChar; dir: LongInt); cdecl; |
268 procedure changeTeamColor(teamName: PChar; dir: LongInt); cdecl; |
263 var i, dc: Longword; |
269 var i, dc: Longword; |
264 tn: shortstring; |
270 tn: shortstring; |
265 msg: ansistring; |
271 msg: ansistring; |
266 begin |
272 begin |
267 with currentConfig do |
273 with currentConfig do |
268 begin |
274 begin |
269 i:= 0; |
275 i:= 0; |
270 tn:= teamName; |
276 tn:= teamName; |
454 msg:= team.teamName + #10 + colorsSet[teams[i].color]; |
460 msg:= team.teamName + #10 + colorsSet[teams[i].color]; |
455 sendUI(mtTeamColor, @msg[1], length(msg)); |
461 sendUI(mtTeamColor, @msg[1], length(msg)); |
456 end |
462 end |
457 end; |
463 end; |
458 |
464 |
|
465 procedure netRemoveTeam(teamName: shortstring); |
|
466 var msg: shortstring; |
|
467 i: Longword; |
|
468 tn: shortstring; |
|
469 isLocal: boolean; |
|
470 begin |
|
471 with currentConfig do |
|
472 begin |
|
473 i:= 0; |
|
474 tn:= teamName; |
|
475 while (i < 8) and (teams[i].teamName <> tn) do |
|
476 inc(i); |
|
477 |
|
478 // team not found??? |
|
479 if (i > 7) then exit; |
|
480 |
|
481 isLocal:= not teams[i].extDriven; |
|
482 |
|
483 while (i < 7) and (teams[i + 1].hogsNumber > 0) do |
|
484 begin |
|
485 teams[i]:= teams[i + 1]; |
|
486 inc(i) |
|
487 end; |
|
488 |
|
489 teams[i].hogsNumber:= 0 |
|
490 end; |
|
491 |
|
492 msg:= teamName; |
|
493 |
|
494 sendUI(mtRemovePlayingTeam, @msg[1], length(msg)); |
|
495 if isLocal then |
|
496 sendUI(mtAddTeam, @msg[1], length(msg)) |
|
497 end; |
|
498 |
459 procedure netSetTeamColor(team: shortstring; color: Longword); |
499 procedure netSetTeamColor(team: shortstring; color: Longword); |
460 var i: Longword; |
500 var i: Longword; |
461 msg: ansistring; |
501 msg: ansistring; |
462 begin |
502 begin |
463 with currentConfig do |
503 with currentConfig do |
464 begin |
504 begin |
465 i:= 0; |
505 i:= 0; |
466 |
506 |
474 msg:= team + #10 + colorsSet[teams[i].color]; |
514 msg:= team + #10 + colorsSet[teams[i].color]; |
475 sendUI(mtTeamColor, @msg[1], length(msg)) |
515 sendUI(mtTeamColor, @msg[1], length(msg)) |
476 end |
516 end |
477 end; |
517 end; |
478 |
518 |
|
519 procedure netSetHedgehogsNumber(team: shortstring; hogsNumber: Longword); |
|
520 var i: Longword; |
|
521 msg: ansistring; |
|
522 begin |
|
523 if hogsNumber > 8 then exit; |
|
524 |
|
525 with currentConfig do |
|
526 begin |
|
527 i:= 0; |
|
528 |
|
529 while (i < 8) and (teams[i].teamName <> team) do |
|
530 inc(i); |
|
531 // team not found??? |
|
532 if (i > 7) then exit; |
|
533 |
|
534 teams[i].hogsNumber:= hogsNumber; |
|
535 |
|
536 msg:= team + #10 + IntToStr(hogsNumber); |
|
537 sendUI(mtHedgehogsNumber, @msg[1], length(msg)) |
|
538 end |
|
539 end; |
|
540 |
|
541 procedure netResetTeams(); |
|
542 var msg: shortstring; |
|
543 i: Longword; |
|
544 begin |
|
545 with currentConfig do |
|
546 begin |
|
547 i:= 0; |
|
548 |
|
549 while (i < 8) and (teams[i].hogsNumber > 0) do |
|
550 begin |
|
551 msg:= teams[i].teamName; |
|
552 |
|
553 sendUI(mtRemovePlayingTeam, @msg[1], length(msg)); |
|
554 if not teams[i].extDriven then |
|
555 sendUI(mtAddTeam, @msg[1], length(msg)); |
|
556 |
|
557 teams[i].hogsNumber:= 0; |
|
558 inc(i) |
|
559 end; |
|
560 |
|
561 end; |
|
562 end; |
|
563 |
479 end. |
564 end. |