]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' of git://de.git.xonotic.org/xonotic/xonotic-data.pk3dir
authorRudolf Polzer <divverent@alientrap.org>
Sat, 29 Jan 2011 08:29:20 +0000 (09:29 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 29 Jan 2011 08:29:20 +0000 (09:29 +0100)
qcsrc/server/miscfunctions.qc

index 849dcdab45197e62877c96d5bf124b1bd4443589..112162e407efc87d2010ab71a154d38dcbd25821 100644 (file)
@@ -2862,65 +2862,65 @@ void SoundEntity_Detach(entity pl)
 float ParseCommandPlayerSlotTarget_firsttoken;
 entity GetCommandPlayerSlotTargetFromTokenizedCommand(float tokens, float idx) // idx = start index
 {
-    string s;
-    entity e, head;
-    float n;
+       string s;
+       entity e, head;
+       float n;
 
-    s = string_null;
+       s = string_null;
 
-    ParseCommandPlayerSlotTarget_firsttoken = -1;
+       ParseCommandPlayerSlotTarget_firsttoken = -1;
 
-    if (tokens > idx)
-    {
-        if (substring(argv(idx), 0, 1) == "#")
-        {
-            s = substring(argv(idx), 1, -1);
-            ++idx;
-            if (s == "")
-                if (tokens > idx)
-                {
-                    s = argv(idx);
-                    ++idx;
-                }
+       if (tokens > idx)
+       {
+               if (substring(argv(idx), 0, 1) == "#")
+               {
+                       s = substring(argv(idx), 1, -1);
+                       ++idx;
+                       if (s == "") if (tokens > idx)
+                       {
+                               s = argv(idx);
+                               ++idx;
+                       }
                        ParseCommandPlayerSlotTarget_firsttoken = idx;
-            if (s == ftos(stof(s)))
-            {
-                e = edict_num(stof(s));
-                if (e.flags & FL_CLIENT)
-                    return e;
-            }
-        }
-        else
-        {
-            // it must be a nick name
-            s = argv(idx);
-            ++idx;
+                       n = stof(s);
+                       if (s == ftos(n) && n > 0 && n <= maxclients)
+                       {
+                               e = edict_num(n);
+                               if (e.flags & FL_CLIENT)
+                                       return e;
+                       }
+               }
+               else
+               {
+                       // it must be a nick name
+                       s = argv(idx);
+                       ++idx;
                        ParseCommandPlayerSlotTarget_firsttoken = idx;
 
-            n = 0;
-            FOR_EACH_CLIENT(head)
-            if (head.netname == s)
-            {
-                e = head;
-                ++n;
-            }
-            if (n == 1)
-                return e;
+                       n = 0;
+                       FOR_EACH_CLIENT(head)
+                               if (head.netname == s)
+                               {
+                                       e = head;
+                                       ++n;
+                               }
+                       if (n == 1)
+                               return e;
 
-            s = strdecolorize(s);
-            n = 0;
-            FOR_EACH_CLIENT(head)
-            if (strdecolorize(head.netname) == s)
-            {
-                e = head;
-                ++n;
-            }
-            if (n == 1)
-                return e;
-        }
-    }
+                       s = strdecolorize(s);
+                       n = 0;
+                       FOR_EACH_CLIENT(head)
+                               if (strdecolorize(head.netname) == s)
+                               {
+                                       e = head;
+                                       ++n;
+                               }
+                       if (n == 1)
+                               return e;
+               }
+       }
 
-    return world;
+       return world;
 }
 
 .float scale2;