]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Fix FloodEntities origin-less check
authormaek <maek@paranoici.org>
Fri, 24 Mar 2017 10:15:47 +0000 (10:15 +0000)
committermaek <maek@paranoici.org>
Fri, 24 Mar 2017 10:15:47 +0000 (10:15 +0000)
tools/quake3/q3map2/bspfile_abstract.c
tools/quake3/q3map2/portals.c
tools/quake3/q3map2/q3map2.h

index 1dab66dbda76c4cf7a83b62b9d3816ab0d0e431d..cea3239af0a3bed3594b530c0a16820eff3a8a27 100644 (file)
@@ -831,7 +831,7 @@ vec_t FloatForKey( const entity_t *ent, const char *key ){
    gets a 3-element vector value for an entity key
  */
 
-void GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec ){
+qboolean GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec ){
        const char  *k;
        double v1, v2, v3;
 
@@ -845,6 +845,9 @@ void GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec ){
        vec[ 0 ] = v1;
        vec[ 1 ] = v2;
        vec[ 2 ] = v3;
+
+       /* true if the key is found, false otherwise */
+       return strlen( k );
 }
 
 
index aee1446ea5a4fb237299f4ac1c11c644ae1438c9..20ed301bee31cc0a205dc725fa88692b1546a84e 100644 (file)
@@ -664,7 +664,7 @@ qboolean PlaceOccupant( node_t *headnode, vec3_t origin, entity_t *occupant, qbo
 int FloodEntities( tree_t *tree ){
        int i, s;
        vec3_t origin, offset, scale, angles;
-       qboolean r, inside, skybox;
+       qboolean r, inside, skybox, found;
        node_t      *headnode;
        entity_t    *e, *tripped;
        const char  *value;
@@ -684,10 +684,10 @@ int FloodEntities( tree_t *tree ){
                e = &entities[ i ];
 
                /* get origin */
-               GetVectorForKey( e, "origin", origin );
+               found = GetVectorForKey( e, "origin", origin );
 
                /* as a special case, allow origin-less entities */
-               if ( VectorCompare( origin, vec3_origin ) ) {
+               if ( !found ) {
                        continue;
                }
 
index 7bbbc42be5e2cf4e5d011b59061152fce98dd1d2..44cd0b581d39fe26306918bb09cd30429ed729a3 100644 (file)
@@ -1913,7 +1913,7 @@ qboolean                    KeyExists( const entity_t *ent, const char *key ); /
 const char                  *ValueForKey( const entity_t *ent, const char *key );
 int                         IntForKey( const entity_t *ent, const char *key );
 vec_t                       FloatForKey( const entity_t *ent, const char *key );
-void                        GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec );
+qboolean                    GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec );
 entity_t                    *FindTargetEntity( const char *target );
 void                        GetEntityShadowFlags( const entity_t *ent, const entity_t *ent2, int *castShadows, int *recvShadows );
 void InjectCommandLine( char **argv, int beginArgs, int endArgs );