hedgewars/uTeams.pas
changeset 9790 0b4b9fda5bd4
parent 9749 443d233316e5
child 9950 2759212a27de
child 9998 736015b847e3
equal deleted inserted replaced
9789:4b7df6e96b78 9790:0b4b9fda5bd4
   677     if oldCI then AddCI(oldHH^.Gear);
   677     if oldCI then AddCI(oldHH^.Gear);
   678     if newCI then AddCI(newHog^.Gear)
   678     if newCI then AddCI(newHog^.Gear)
   679 end;
   679 end;
   680 
   680 
   681 
   681 
       
   682 procedure chSetHat(var s: shortstring);
       
   683 begin
       
   684 if (not isDeveloperMode) or (CurrentTeam = nil) then exit;
       
   685 with CurrentTeam^ do
       
   686     begin
       
   687     if not CurrentHedgehog^.King then
       
   688     if (s = '')
       
   689     or (((GameFlags and gfKing) <> 0) and (s = 'crown'))
       
   690     or ((Length(s) > 39) and (Copy(s,1,8) = 'Reserved') and (Copy(s,9,32) <> PlayerHash)) then
       
   691         CurrentHedgehog^.Hat:= 'NoHat'
       
   692     else
       
   693         CurrentHedgehog^.Hat:= s
       
   694     end;
       
   695 end;
       
   696 
       
   697 procedure chGrave(var s: shortstring);
       
   698 begin
       
   699     if CurrentTeam = nil then
       
   700         OutError(errmsgIncorrectUse + ' "/grave"', true);
       
   701     if s[1]='"' then
       
   702         Delete(s, 1, 1);
       
   703     if s[byte(s[0])]='"' then
       
   704         Delete(s, byte(s[0]), 1);
       
   705     CurrentTeam^.GraveName:= s
       
   706 end;
       
   707 
       
   708 procedure chFort(var s: shortstring);
       
   709 begin
       
   710     if CurrentTeam = nil then
       
   711         OutError(errmsgIncorrectUse + ' "/fort"', true);
       
   712     if s[1]='"' then
       
   713         Delete(s, 1, 1);
       
   714     if s[byte(s[0])]='"' then
       
   715         Delete(s, byte(s[0]), 1);
       
   716     CurrentTeam^.FortName:= s
       
   717 end;
       
   718 
       
   719 procedure chFlag(var s: shortstring);
       
   720 begin
       
   721     if CurrentTeam = nil then
       
   722         OutError(errmsgIncorrectUse + ' "/flag"', true);
       
   723     if s[1]='"' then
       
   724         Delete(s, 1, 1);
       
   725     if s[byte(s[0])]='"' then
       
   726         Delete(s, byte(s[0]), 1);
       
   727     CurrentTeam^.flag:= s
       
   728 end;
       
   729 
       
   730 procedure chOwner(var s: shortstring);
       
   731 begin
       
   732     if CurrentTeam = nil then
       
   733         OutError(errmsgIncorrectUse + ' "/owner"', true);
       
   734 
       
   735     CurrentTeam^.Owner:= s
       
   736 end;
       
   737 
   682 procedure initModule;
   738 procedure initModule;
   683 begin
   739 begin
   684 RegisterVariable('addhh', @chAddHH, false);
   740 RegisterVariable('addhh', @chAddHH, false);
   685 RegisterVariable('addteam', @chAddTeam, false);
   741 RegisterVariable('addteam', @chAddTeam, false);
   686 RegisterVariable('hhcoords', @chSetHHCoords, false);
   742 RegisterVariable('hhcoords', @chSetHHCoords, false);
   687 RegisterVariable('bind', @chBind, true );
   743 RegisterVariable('bind', @chBind, true );
   688 RegisterVariable('teamgone', @chTeamGone, true );
   744 RegisterVariable('teamgone', @chTeamGone, true );
   689 RegisterVariable('finish', @chFinish, true ); // all teams gone
   745 RegisterVariable('finish', @chFinish, true ); // all teams gone
       
   746 RegisterVariable('fort'    , @chFort         , false);
       
   747 RegisterVariable('grave'   , @chGrave        , false);
       
   748 RegisterVariable('hat'     , @chSetHat       , false);
       
   749 RegisterVariable('flag'    , @chFlag         , false);
       
   750 RegisterVariable('owner'   , @chOwner        , false);
   690 
   751 
   691 CurrentTeam:= nil;
   752 CurrentTeam:= nil;
   692 PreviousTeam:= nil;
   753 PreviousTeam:= nil;
   693 CurrentHedgehog:= nil;
   754 CurrentHedgehog:= nil;
   694 TeamsCount:= 0;
   755 TeamsCount:= 0;