hedgewars/uTeams.pas
changeset 9790 0b4b9fda5bd4
parent 9749 443d233316e5
child 9950 2759212a27de
child 9998 736015b847e3
--- a/hedgewars/uTeams.pas	Fri Dec 13 21:55:19 2013 +0400
+++ b/hedgewars/uTeams.pas	Fri Dec 13 22:14:02 2013 +0400
@@ -679,6 +679,62 @@
 end;
 
 
+procedure chSetHat(var s: shortstring);
+begin
+if (not isDeveloperMode) or (CurrentTeam = nil) then exit;
+with CurrentTeam^ do
+    begin
+    if not CurrentHedgehog^.King then
+    if (s = '')
+    or (((GameFlags and gfKing) <> 0) and (s = 'crown'))
+    or ((Length(s) > 39) and (Copy(s,1,8) = 'Reserved') and (Copy(s,9,32) <> PlayerHash)) then
+        CurrentHedgehog^.Hat:= 'NoHat'
+    else
+        CurrentHedgehog^.Hat:= s
+    end;
+end;
+
+procedure chGrave(var s: shortstring);
+begin
+    if CurrentTeam = nil then
+        OutError(errmsgIncorrectUse + ' "/grave"', true);
+    if s[1]='"' then
+        Delete(s, 1, 1);
+    if s[byte(s[0])]='"' then
+        Delete(s, byte(s[0]), 1);
+    CurrentTeam^.GraveName:= s
+end;
+
+procedure chFort(var s: shortstring);
+begin
+    if CurrentTeam = nil then
+        OutError(errmsgIncorrectUse + ' "/fort"', true);
+    if s[1]='"' then
+        Delete(s, 1, 1);
+    if s[byte(s[0])]='"' then
+        Delete(s, byte(s[0]), 1);
+    CurrentTeam^.FortName:= s
+end;
+
+procedure chFlag(var s: shortstring);
+begin
+    if CurrentTeam = nil then
+        OutError(errmsgIncorrectUse + ' "/flag"', true);
+    if s[1]='"' then
+        Delete(s, 1, 1);
+    if s[byte(s[0])]='"' then
+        Delete(s, byte(s[0]), 1);
+    CurrentTeam^.flag:= s
+end;
+
+procedure chOwner(var s: shortstring);
+begin
+    if CurrentTeam = nil then
+        OutError(errmsgIncorrectUse + ' "/owner"', true);
+
+    CurrentTeam^.Owner:= s
+end;
+
 procedure initModule;
 begin
 RegisterVariable('addhh', @chAddHH, false);
@@ -687,6 +743,11 @@
 RegisterVariable('bind', @chBind, true );
 RegisterVariable('teamgone', @chTeamGone, true );
 RegisterVariable('finish', @chFinish, true ); // all teams gone
+RegisterVariable('fort'    , @chFort         , false);
+RegisterVariable('grave'   , @chGrave        , false);
+RegisterVariable('hat'     , @chSetHat       , false);
+RegisterVariable('flag'    , @chFlag         , false);
+RegisterVariable('owner'   , @chOwner        , false);
 
 CurrentTeam:= nil;
 PreviousTeam:= nil;