]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/targetname.cpp
apply misc fixes from Markus Fischer and Rambetter
[xonotic/netradiant.git] / radiant / targetname.cpp
index f64089bbbe029001003bab1d1d7d8da33c03d723..7a5e3c9b61a6da0e589f9b9b06d9c20dc15db163 100644 (file)
@@ -1,90 +1,90 @@
-/*\r
-Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-\r
-#include "stdafx.h"\r
-\r
-/*!\r
-connects two entities creating a unique target/targetname value \r
-*/\r
-void Entity_Connect(entity_t *e1, entity_t *e2)\r
-{\r
-  const char *maptarget;\r
-  char newtarget[16];\r
-  int maxtarget=0;  // highest t# value in the map\r
-  entity_t *e;      // map entities\r
-\r
-  if (e1 == e2)\r
-       {\r
-#ifdef _DEBUG    \r
-               Sys_Status ("Entity_Connect: Brushes are from same entity.", 0);\r
-#endif\r
-               return;\r
-       }\r
-\r
-  for (e=entities.next ; e != &entities ; e=e->next)\r
-  {\r
-    maptarget = ValueForKey (e, "target");\r
-    if (maptarget && maptarget[0])\r
-    {\r
-      int targetnum = atoi(maptarget+1);\r
-      if (targetnum > maxtarget)\r
-        maxtarget = targetnum;\r
-    }\r
-  }\r
-  sprintf (newtarget, "t%i", maxtarget+1);\r
-  \r
-#ifdef _DEBUG\r
-  Sys_Printf("Connecting entities with new target/targetname: %s\n", newtarget);\r
-#endif  \r
-  \r
-       SetKeyValue (e1, "target", newtarget);\r
-       SetKeyValue (e2, "targetname", newtarget);\r
-}\r
-\r
-int GetUniqueTargetId(int iHint)\r
-{\r
-       int iMin, iMax, i;\r
-       bool fFound;\r
-       entity_t *pe;\r
-       \r
-       fFound = FALSE;\r
-       pe = entities.next;\r
-       iMin = 0; \r
-       iMax = 0;\r
-       \r
-       for (; pe != NULL && pe != &entities ; pe = pe->next)\r
-       {\r
-               i = IntForKey(pe, "target");\r
-               if (i)\r
-               {\r
-                       iMin = MIN(i, iMin);\r
-                       iMax = MAX(i, iMax);\r
-                       if (i == iHint)\r
-                               fFound = TRUE;\r
-               }\r
-       }\r
-\r
-       if (fFound)\r
-               return iMax + 1;\r
-       else\r
-               return iHint;\r
-}\r
-\r
+/*
+Copyright (C) 1999-2007 id Software, Inc. and contributors.
+For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+This file is part of GtkRadiant.
+
+GtkRadiant is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+GtkRadiant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GtkRadiant; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#include "stdafx.h"
+
+/*!
+connects two entities creating a unique target/targetname value 
+*/
+void Entity_Connect(entity_t *e1, entity_t *e2)
+{
+  const char *maptarget;
+  char newtarget[16];
+  int maxtarget=0;  // highest t# value in the map
+  entity_t *e;      // map entities
+
+  if (e1 == e2)
+       {
+#ifdef _DEBUG    
+               Sys_Status ("Entity_Connect: Brushes are from same entity.", 0);
+#endif
+               return;
+       }
+
+  for (e=entities.next ; e != &entities ; e=e->next)
+  {
+    maptarget = ValueForKey (e, "target");
+    if (maptarget && maptarget[0])
+    {
+      int targetnum = atoi(maptarget+1);
+      if (targetnum > maxtarget)
+        maxtarget = targetnum;
+    }
+  }
+  sprintf (newtarget, "t%i", maxtarget+1);
+  
+#ifdef _DEBUG
+  Sys_Printf("Connecting entities with new target/targetname: %s\n", newtarget);
+#endif  
+  
+       SetKeyValue (e1, "target", newtarget);
+       SetKeyValue (e2, "targetname", newtarget);
+}
+
+int GetUniqueTargetId(int iHint)
+{
+       int iMin, iMax, i;
+       bool fFound;
+       entity_t *pe;
+       
+       fFound = FALSE;
+       pe = entities.next;
+       iMin = 0; 
+       iMax = 0;
+       
+       for (; pe != NULL && pe != &entities ; pe = pe->next)
+       {
+               i = IntForKey(pe, "target");
+               if (i)
+               {
+                       iMin = MIN(i, iMin);
+                       iMax = MAX(i, iMax);
+                       if (i == iHint)
+                               fFound = TRUE;
+               }
+       }
+
+       if (fFound)
+               return iMax + 1;
+       else
+               return iHint;
+}
+