]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/filters.cpp
apply misc fixes from Markus Fischer and Rambetter
[xonotic/netradiant.git] / radiant / filters.cpp
index 5e0b069e85bae39ab2c98b722bfb04db78bd11ed..17a91195bff2008312eb90a4ee20fd59e24afee0 100644 (file)
@@ -2,30 +2,30 @@
 Copyright (c) 2001, Loki software, inc.
 All rights reserved.
 
-Redistribution and use in source and binary forms, with or without modification, 
+Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:
 
-Redistributions of source code must retain the above copyright notice, this list 
+Redistributions of source code must retain the above copyright notice, this list
 of conditions and the following disclaimer.
 
 Redistributions in binary form must reproduce the above copyright notice, this
 list of conditions and the following disclaimer in the documentation and/or
 other materials provided with the distribution.
 
-Neither the name of Loki software nor the names of its contributors may be used 
-to endorse or promote products derived from this software without specific prior 
-written permission. 
+Neither the name of Loki software nor the names of its contributors may be used
+to endorse or promote products derived from this software without specific prior
+written permission.
 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' 
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
-DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY 
-DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 #include "stdafx.h"
@@ -37,7 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 // type 5 = surface flags (q2)
 // type 6 = content flags (q2)
 // type 7 = content flags - no match (q2)
-bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exclude)
+bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, const char *str, int exclude)
 {
        bfilter_t *pNew = new bfilter_t;
        pNew->next = pFilter;
@@ -51,7 +51,7 @@ bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exc
        return pNew;
 }
 
-bfilter_t *FilterCreate (int type, int bmask, char *str, int exclude)
+bfilter_t *FilterCreate (int type, int bmask, const char *str, int exclude)
 {
        g_qeglobals.d_savedinfo.filters = FilterAdd(g_qeglobals.d_savedinfo.filters, type, bmask, str, exclude);
        Syn_Printf("Added filter %s (type: %i, bmask: %i, exclude: %i)\n", str, type, bmask, exclude);
@@ -107,13 +107,13 @@ FilterBrush
 
 bool FilterBrush(brush_t *pb)
 {
-       
+
        if (!pb->owner)
                return FALSE;           // during construction
-       
+
        if (pb->hiddenBrush)
                return TRUE;
-       
+
        if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_WORLD)
        {
                if (strcmp(pb->owner->eclass->name, "worldspawn") == 0 || !strcmp(pb->owner->eclass->name,"func_group")) // hack, treating func_group as world
@@ -121,7 +121,7 @@ bool FilterBrush(brush_t *pb)
                        return TRUE;
                }
        }
-       
+
        if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_ENT)
        {
                if (strcmp(pb->owner->eclass->name, "worldspawn") != 0 && strcmp(pb->owner->eclass->name,"func_group")) // hack, treating func_group as world
@@ -129,7 +129,7 @@ bool FilterBrush(brush_t *pb)
                        return TRUE;
                }
        }
-       
+
        if ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_CURVES )
        {
                if (pb->patchBrush)
@@ -137,8 +137,8 @@ bool FilterBrush(brush_t *pb)
                        return TRUE;
                }
        }
-       
-       
+
+
        if ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_DETAILS )
        {
                if (!pb->patchBrush && pb->brush_faces->texdef.contents & CONTENTS_DETAIL )
@@ -153,7 +153,7 @@ bool FilterBrush(brush_t *pb)
                        return TRUE;
                }
        }
-               
+
        // if brush belongs to world entity or a brushmodel entity and is not a patch
        if ( ( strcmp(pb->owner->eclass->name, "worldspawn") == 0
                || !strncmp( pb->owner->eclass->name, "func", 4)
@@ -186,7 +186,7 @@ bool FilterBrush(brush_t *pb)
                                                filterbrush=true;
                                                break;
                                        }
-                               // quake2 - 5 == surface flags, 6 == content flags 
+                               // quake2 - 5 == surface flags, 6 == content flags
                                }
                                else if (filters->attribute == 5)
                                {
@@ -238,7 +238,7 @@ bool FilterBrush(brush_t *pb)
                                        break;
                                }
                        }
-                       
+
                        // exclude by attribute 2 (for patch) brush->pPatch->pShader->getFlags()
                        if (filters->active
                                && filters->attribute == 2)
@@ -253,7 +253,7 @@ bool FilterBrush(brush_t *pb)
                if (!drawpatch) // if a shader is found that should be excluded
                        return TRUE; // exclude this patch
        }
-       
+
        if (strcmp(pb->owner->eclass->name, "worldspawn") != 0) // if brush does not belong to world entity
        {
                bool drawentity=true;
@@ -271,7 +271,7 @@ bool FilterBrush(brush_t *pb)
                                        break;
                                }
                        }
-                       
+
                        // exclude by attribute 4 brush->owner->eclass->nShowFlags
                        else if (filters->active
                                && filters->attribute == 4)