hedgewars/uTeams.pas
changeset 7151 ec15d9e1a7e3
parent 7119 2737c488756b
child 7180 53ffc8853008
child 7184 211ab9e2cb15
equal deleted inserted replaced
7148:c7ee9592c9a1 7151:ec15d9e1a7e3
   480 end;
   480 end;
   481 
   481 
   482 procedure chAddHH(var id: shortstring);
   482 procedure chAddHH(var id: shortstring);
   483 var s: shortstring;
   483 var s: shortstring;
   484     Gear: PGear;
   484     Gear: PGear;
       
   485     c: LongInt;
   485 begin
   486 begin
   486 s:= '';
   487 s:= '';
   487 if (not isDeveloperMode) or (CurrentTeam = nil) then
   488 if (not isDeveloperMode) or (CurrentTeam = nil) then
   488     exit;
   489     exit;
   489 with CurrentTeam^ do
   490 with CurrentTeam^ do
   490     begin
   491     begin
   491     SplitBySpace(id, s);
   492     SplitBySpace(id, s);
   492     CurrentHedgehog:= @Hedgehogs[HedgehogsNumber];
   493     CurrentHedgehog:= @Hedgehogs[HedgehogsNumber];
   493     val(id, CurrentHedgehog^.BotLevel);
   494     val(id, CurrentHedgehog^.BotLevel, c);
   494     Gear:= AddGear(0, 0, gtHedgehog, 0, _0, _0, 0);
   495     Gear:= AddGear(0, 0, gtHedgehog, 0, _0, _0, 0);
   495     SplitBySpace(s, id);
   496     SplitBySpace(s, id);
   496     val(s, Gear^.Health);
   497     val(s, Gear^.Health, c);
   497     TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true);
   498     TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true);
   498     Gear^.Hedgehog^.Team:= CurrentTeam;
   499     Gear^.Hedgehog^.Team:= CurrentTeam;
   499     if (GameFlags and gfSharedAmmo) <> 0 then
   500     if (GameFlags and gfSharedAmmo) <> 0 then
   500         CurrentHedgehog^.AmmoStore:= Clan^.ClanIndex
   501         CurrentHedgehog^.AmmoStore:= Clan^.ClanIndex
   501     else if (GameFlags and gfPerHogAmmo) <> 0 then
   502     else if (GameFlags and gfPerHogAmmo) <> 0 then
   512     end
   513     end
   513 end;
   514 end;
   514 
   515 
   515 procedure chAddTeam(var s: shortstring);
   516 procedure chAddTeam(var s: shortstring);
   516 var Color: Longword;
   517 var Color: Longword;
       
   518     c: LongInt;
   517     ts, cs: shortstring;
   519     ts, cs: shortstring;
   518 begin
   520 begin
   519 cs:= '';
   521 cs:= '';
   520 ts:= '';
   522 ts:= '';
   521 if isDeveloperMode then
   523 if isDeveloperMode then
   522     begin
   524     begin
   523     SplitBySpace(s, cs);
   525     SplitBySpace(s, cs);
   524     SplitBySpace(cs, ts);
   526     SplitBySpace(cs, ts);
   525     val(cs, Color);
   527     val(cs, Color, c);
   526     TryDo(Color <> 0, 'Error: black team color', true);
   528     TryDo(Color <> 0, 'Error: black team color', true);
   527 
   529 
   528     // color is always little endian so the mask must be constant also in big endian archs
   530     // color is always little endian so the mask must be constant also in big endian archs
   529     Color:= Color or $FF000000;
   531     Color:= Color or $FF000000;
   530     AddTeam(Color);
   532     AddTeam(Color);
   537     end
   539     end
   538 end;
   540 end;
   539 
   541 
   540 procedure chSetHHCoords(var x: shortstring);
   542 procedure chSetHHCoords(var x: shortstring);
   541 var y: shortstring;
   543 var y: shortstring;
   542     t: Longint;
   544     t, c: Longint;
   543 begin
   545 begin
   544 y:= '';
   546 y:= '';
   545 if (not isDeveloperMode) or (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then
   547 if (not isDeveloperMode) or (CurrentHedgehog = nil) or (CurrentHedgehog^.Gear = nil) then
   546     exit;
   548     exit;
   547 SplitBySpace(x, y);
   549 SplitBySpace(x, y);
   548 val(x, t);
   550 val(x, t, c);
   549 CurrentHedgehog^.Gear^.X:= int2hwFloat(t);
   551 CurrentHedgehog^.Gear^.X:= int2hwFloat(t);
   550 val(y, t);
   552 val(y, t, c);
   551 CurrentHedgehog^.Gear^.Y:= int2hwFloat(t)
   553 CurrentHedgehog^.Gear^.Y:= int2hwFloat(t)
   552 end;
   554 end;
   553 
   555 
   554 procedure chBind(var id: shortstring);
   556 procedure chBind(var id: shortstring);
   555 var s: shortstring;
   557 var s: shortstring;