equal
deleted
inserted
replaced
91 var i: LongInt; |
91 var i: LongInt; |
92 begin |
92 begin |
93 if isDeveloperMode then |
93 if isDeveloperMode then |
94 begin |
94 begin |
95 i:= StrToInt(s); |
95 i:= StrToInt(s); |
96 TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old (got '+intToStr(i)+', expecting '+intToStr(cNetProtoVersion)+')', true); |
96 checkFails(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old (got '+intToStr(i)+', expecting '+intToStr(cNetProtoVersion)+')', true); |
97 TryDo(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new (got '+intToStr(i)+', expecting '+intToStr(cNetProtoVersion)+')', true); |
97 checkFails(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new (got '+intToStr(i)+', expecting '+intToStr(cNetProtoVersion)+')', true); |
98 end |
98 end |
99 end; |
99 end; |
100 |
100 |
101 procedure chTeamLocal(var s: shortstring); |
101 procedure chTeamLocal(var s: shortstring); |
102 begin |
102 begin |
377 procedure chNextTurn(var s: shortstring); |
377 procedure chNextTurn(var s: shortstring); |
378 var gi: PGear; |
378 var gi: PGear; |
379 begin |
379 begin |
380 s:= s; // avoid compiler hint |
380 s:= s; // avoid compiler hint |
381 |
381 |
382 TryDo(AllInactive, '/nextturn called when not all gears are inactive', true); |
382 if checkFails(AllInactive, '/nextturn called when not all gears are inactive', true) then exit; |
383 |
383 |
384 CheckSum:= CheckSum xor GameTicks; |
384 CheckSum:= CheckSum xor GameTicks; |
385 gi := GearsList; |
385 gi := GearsList; |
386 while gi <> nil do |
386 while gi <> nil do |
387 begin |
387 begin |
396 s[1]:= 'N'; |
396 s[1]:= 'N'; |
397 SDLNet_Write32(CheckSum, @s[2]); |
397 SDLNet_Write32(CheckSum, @s[2]); |
398 SendIPC(s) |
398 SendIPC(s) |
399 end |
399 end |
400 else |
400 else |
401 TryDo(CurrentTeam^.hasGone or (CheckSum = lastTurnChecksum), 'Desync detected', true); |
401 checkFails(CurrentTeam^.hasGone or (CheckSum = lastTurnChecksum), 'Desync detected', true); |
402 |
402 |
403 AddFileLog('Next turn: time '+inttostr(GameTicks)); |
403 AddFileLog('Next turn: time '+inttostr(GameTicks)); |
404 end; |
404 end; |
405 |
405 |
406 procedure chTimer(var s: shortstring); |
406 procedure chTimer(var s: shortstring); |
407 begin |
407 begin |
408 if CheckNoTeamOrHH then |
408 if CheckNoTeamOrHH then |
409 exit; |
409 exit; |
410 |
410 |
411 TryDo((s[0] = #1) and (s[1] >= '1') and (s[1] <= '5'), 'Malformed /timer', true); |
411 if checkFails((s[0] = #1) and (s[1] >= '1') and (s[1] <= '5'), 'Malformed /timer', true) then exit; |
412 |
412 |
413 if not isExternalSource then |
413 if not isExternalSource then |
414 SendIPC(s); |
414 SendIPC(s); |
415 bShowFinger:= false; |
415 bShowFinger:= false; |
416 with CurrentHedgehog^.Gear^ do |
416 with CurrentHedgehog^.Gear^ do |
448 procedure chSetWeapon(var s: shortstring); |
448 procedure chSetWeapon(var s: shortstring); |
449 begin |
449 begin |
450 if CheckNoTeamOrHH then |
450 if CheckNoTeamOrHH then |
451 exit; |
451 exit; |
452 |
452 |
453 TryDo((s[0] = #1) and (s[1] <= char(High(TAmmoType))), 'Malformed /setweap', true); |
453 if checkFails((s[0] = #1) and (s[1] <= char(High(TAmmoType))), 'Malformed /setweap', true) then exit; |
454 |
454 |
455 if not isExternalSource then |
455 if not isExternalSource then |
456 SendIPC('w' + s); |
456 SendIPC('w' + s); |
457 |
457 |
458 with CurrentHedgehog^.Gear^ do |
458 with CurrentHedgehog^.Gear^ do |