]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/targetname.cpp
Merge branch 'master' of github.com:TTimo/GtkRadiant
[xonotic/netradiant.git] / radiant / targetname.cpp
index 7a5e3c9b61a6da0e589f9b9b06d9c20dc15db163..84461afde9c92016d6508e31a3ebd26bfabb861e 100644 (file)
@@ -1,90 +1,88 @@
 /*
-Copyright (C) 1999-2007 id Software, Inc. and contributors.
-For a list of contributors, see the accompanying CONTRIBUTORS file.
+   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.
+   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 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.
+   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
-*/
+   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
+   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);
+       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);
-  
+       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);
+       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 GetUniqueTargetId( int iHint ){
        int iMin, iMax, i;
        bool fFound;
        entity_t *pe;
-       
+
        fFound = FALSE;
        pe = entities.next;
-       iMin = 0; 
+       iMin = 0;
        iMax = 0;
-       
-       for (; pe != NULL && pe != &entities ; pe = pe->next)
+
+       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)
+               i = IntForKey( pe, "target" );
+               if ( i ) {
+                       iMin = MIN( i, iMin );
+                       iMax = MAX( i, iMax );
+                       if ( i == iHint ) {
                                fFound = TRUE;
+                       }
                }
        }
 
-       if (fFound)
+       if ( fFound ) {
                return iMax + 1;
-       else
+       }
+       else{
                return iHint;
+       }
 }
-