fix reserved hats from scripting
authornemo
Mon, 29 Oct 2012 17:38:54 -0400
changeset 7887 e987dff8e5f2
parent 7885 2a3a9e385cac
child 7889 57b117d441b9
fix reserved hats from scripting
hedgewars/uScript.pas
--- a/hedgewars/uScript.pas	Mon Oct 29 17:17:26 2012 -0400
+++ b/hedgewars/uScript.pas	Mon Oct 29 17:38:54 2012 -0400
@@ -1669,7 +1669,10 @@
         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
             hat:= lua_tostring(L, 2);
             gear^.Hedgehog^.Hat:= hat;
-            LoadHedgehogHat(gear^.Hedgehog^, hat);
+            if (Length(hat) > 39) and (Copy(hat,1,8) = 'Reserved') and (Copy(hat,9,32) = gear^.Hedgehog^.Team^.PlayerHash) then
+                LoadHedgehogHat(gear^.Hedgehog^, 'Reserved/' + Copy(hat,9,Length(hat)-8))
+            else
+                LoadHedgehogHat(gear^.Hedgehog^, hat);
         end;
     lc_sethoghat:= 0;
 end;