diff --git a/tools/quake3/common/aselib.cpp b/tools/quake3/common/aselib.cpp index 499a7b68..73f73486 100644 --- a/tools/quake3/common/aselib.cpp +++ b/tools/quake3/common/aselib.cpp @@ -21,7 +21,9 @@ #include "aselib.h" +#include "cmdlib.h" #include "inout.h" +#include "qstringops.h" #include #include diff --git a/tools/quake3/common/aselib.h b/tools/quake3/common/aselib.h index 1f982c0d..49ec5b57 100644 --- a/tools/quake3/common/aselib.h +++ b/tools/quake3/common/aselib.h @@ -20,8 +20,6 @@ */ -#include "cmdlib.h" -#include "mathlib.h" #include "polyset.h" void ASE_Load( const char *filename, bool verbose, bool meshanims ); diff --git a/tools/quake3/common/bspfile.cpp b/tools/quake3/common/bspfile.cpp index 3aa4aac6..bf36ede7 100644 --- a/tools/quake3/common/bspfile.cpp +++ b/tools/quake3/common/bspfile.cpp @@ -21,6 +21,7 @@ #include "cmdlib.h" +#include "qstringops.h" #include "mathlib.h" #include "inout.h" #include "bspfile.h" diff --git a/tools/quake3/common/cmdlib.cpp b/tools/quake3/common/cmdlib.cpp index 15ac913c..72e3d891 100644 --- a/tools/quake3/common/cmdlib.cpp +++ b/tools/quake3/common/cmdlib.cpp @@ -30,6 +30,7 @@ #include "cmdlib.h" #include "inout.h" +#include "qstringops.h" #include #include @@ -45,7 +46,6 @@ #define BASEDIRNAME "quake" // assumed to have a 2 or 3 following #ifdef SAFE_MALLOC -// FIXME switch to -std=c99 or above to use proper %zu format specifier for size_t void_ptr safe_malloc( size_t size ){ void *p = malloc( size ); if ( !p ) { @@ -324,63 +324,6 @@ int FileTime( const char *path ){ -//http://stackoverflow.com/questions/27303062/strstr-function-like-that-ignores-upper-or-lower-case -//chux: Somewhat tricky to match the corner cases of strstr() with inputs like "x","", "","x", "","" -const char *strIstr( const char* haystack, const char* needle ) { - do { - const char* h = haystack; - const char* n = needle; - while ( tolower( (unsigned char)*h ) == tolower( (unsigned char)*n ) && *n != '\0' ) { - h++; - n++; - } - if ( *n == '\0' ) { - return haystack; - } - } while ( *haystack++ ); - return NULL; -} - -char *strIstr( char* haystack, const char* needle ) { - return const_cast( strIstr( const_cast( haystack ), needle ) ); -} - -/* - * Copy src to string dst of size size. At most size-1 characters - * will be copied. Always NUL terminates (unless size == 0). - * Returns strlen(src); if retval >= size, truncation occurred. - */ -size_t strcpyQ( char* dest, const char* src, const size_t dest_size ) { - const size_t src_len = strlen( src ); - if( src_len < dest_size ) - memcpy( dest, src, src_len + 1 ); - else if( dest_size != 0 ){ - memcpy( dest, src, dest_size - 1 ); - dest[dest_size - 1] = '\0'; - } - return src_len; -} - -size_t strcatQ( char* dest, const char* src, const size_t dest_size ) { - const size_t dest_len = strlen( dest ); - return dest_len + strcpyQ( dest + dest_len, src, dest_size > dest_len? dest_size - dest_len : 0 ); -} - -size_t strncatQ( char* dest, const char* src, const size_t dest_size, const size_t src_len ) { - const size_t dest_len = strlen( dest ); - const size_t ds_len = dest_len + src_len; - if( ds_len < dest_size ){ - memcpy( dest + dest_len, src, src_len ); - dest[ds_len] = '\0'; - } - else if( dest_len < dest_size ){ - memcpy( dest + dest_len, src, dest_size - dest_len - 1 ); - dest[dest_size - 1] = '\0'; - } - return ds_len; -} - - /* ============================================================================= diff --git a/tools/quake3/common/cmdlib.h b/tools/quake3/common/cmdlib.h index 507366bb..f12ee7a7 100644 --- a/tools/quake3/common/cmdlib.h +++ b/tools/quake3/common/cmdlib.h @@ -91,68 +91,6 @@ void_ptr safe_calloc_info( size_t size, const char* info ); #define offsetof_array( TYPE, ARRAY_MEMBER, ARRAY_SIZE ) ( offsetof( TYPE, ARRAY_MEMBER[0] ) + sizeof( TYPE::ARRAY_MEMBER[0] ) * ARRAY_SIZE ) - -static inline bool strEmpty( const char* string ){ - return *string == '\0'; -} -static inline bool strEmptyOrNull( const char* string ){ - return string == NULL || *string == '\0'; -} -static inline void strClear( char* string ){ - *string = '\0'; -} -static inline char *strLower( char *string ){ - for( char *in = string; *in; ++in ) - *in = tolower( *in ); - return string; -} -static inline char *copystring( const char *src ){ // version of strdup() with safe_malloc() - const size_t size = strlen( src ) + 1; - return void_ptr( memcpy( safe_malloc( size ), src, size ) ); -} -const char* strIstr( const char* haystack, const char* needle ); - char* strIstr( char* haystack, const char* needle ); -#ifdef WIN32 - #define Q_stricmp stricmp - #define Q_strnicmp strnicmp -#else - #define Q_stricmp strcasecmp - #define Q_strnicmp strncasecmp -#endif -static inline bool strEqual( const char* string, const char* other ){ - return strcmp( string, other ) == 0; -} -static inline bool strnEqual( const char* string, const char* other, size_t n ){ - return strncmp( string, other, n ) == 0; -} -static inline bool striEqual( const char* string, const char* other ){ - return Q_stricmp( string, other ) == 0; -} -static inline bool strniEqual( const char* string, const char* other, size_t n ){ - return Q_strnicmp( string, other, n ) == 0; -} - -static inline bool strEqualPrefix( const char* string, const char* prefix ){ - return strnEqual( string, prefix, strlen( prefix ) ); -} -static inline bool striEqualPrefix( const char* string, const char* prefix ){ - return strniEqual( string, prefix, strlen( prefix ) ); -} -static inline bool strEqualSuffix( const char* string, const char* suffix ){ - const size_t stringLength = strlen( string ); - const size_t suffixLength = strlen( suffix ); - return ( suffixLength > stringLength )? false : strnEqual( string + stringLength - suffixLength, suffix, suffixLength ); -} -static inline bool striEqualSuffix( const char* string, const char* suffix ){ - const size_t stringLength = strlen( string ); - const size_t suffixLength = strlen( suffix ); - return ( suffixLength > stringLength )? false : strniEqual( string + stringLength - suffixLength, suffix, suffixLength ); -} -/* strlcpy, strlcat versions */ -size_t strcpyQ( char* dest, const char* src, const size_t dest_size ); -size_t strcatQ( char* dest, const char* src, const size_t dest_size ); -size_t strncatQ( char* dest, const char* src, const size_t dest_size, const size_t src_len ); - void Q_getwd( char *out ); int Q_filelength( FILE *f ); @@ -171,12 +109,6 @@ void ExpandWildcards( int *argc, char ***argv ); double I_FloatTime( void ); -[[ noreturn ]] void Error( const char *error, ... ); -#define ENSURE( condition ) \ - (void) \ - ( (!!( condition )) || \ - (Error( "%s:%u:%s: Condition '%s' failed.", __FILE__, __LINE__, __func__, #condition ), 0) ) - FILE *SafeOpenWrite( const char *filename, const char *mode = "wb" ); FILE *SafeOpenRead( const char *filename, const char *mode = "rb" ); void SafeRead( FILE *f, void *buffer, int count ); diff --git a/tools/quake3/common/imagelib.cpp b/tools/quake3/common/imagelib.cpp index 717bc096..ad819e05 100644 --- a/tools/quake3/common/imagelib.cpp +++ b/tools/quake3/common/imagelib.cpp @@ -23,6 +23,7 @@ #include "inout.h" #include "cmdlib.h" +#include "qstringops.h" #include "etclib.h" #include "imagelib.h" #include "vfs.h" diff --git a/tools/quake3/common/inout.cpp b/tools/quake3/common/inout.cpp index f3adbff3..07d9b90f 100644 --- a/tools/quake3/common/inout.cpp +++ b/tools/quake3/common/inout.cpp @@ -54,7 +54,6 @@ bool verbose = false; // possibly written to disk at the end of the run //++timo FIXME: need to be global, required when creating nodes? xmlDocPtr doc; -xmlNodePtr tree; // some useful stuff xmlNodePtr xml_NodeForVec( const Vector3& v ){ diff --git a/tools/quake3/common/inout.h b/tools/quake3/common/inout.h index e5b3b02c..62a7b889 100644 --- a/tools/quake3/common/inout.h +++ b/tools/quake3/common/inout.h @@ -19,25 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef __INOUT__ -#define __INOUT__ - -// inout is the only stuff relying on xml, include the headers there -#include "libxml/tree.h" - -template class BasicVector3; -typedef BasicVector3 Vector3; - -// some useful xml routines -xmlNodePtr xml_NodeForVec( const Vector3& v ); -void xml_SendNode( xmlNodePtr node ); -// print a message in q3map output and send the corresponding select information down the xml stream -// bError: do we end with an error on this one or do we go ahead? -void xml_Select( const char *msg, int entitynum, int brushnum, bool bError ); -// end q3map with an error message and send a point information in the xml stream -// note: we might want to add a boolean to use this as a warning or an error thing.. -void xml_Winding( const char *msg, const Vector3 p[], int numpoints, bool die ); -void xml_Point( const char *msg, const Vector3& pt ); +#pragma once void Broadcast_Setup( const char *dest ); void Broadcast_Shutdown(); @@ -57,13 +39,8 @@ extern bool verbose; void Sys_Printf( const char *text, ... ); void Sys_FPrintf( int flag, const char *text, ... ); void Sys_Warning( const char *format, ... ); - -#ifdef _DEBUG -#define DBG_XML 1 -#endif - -#ifdef DBG_XML -void DumpXML(); -#endif - -#endif +[[ noreturn ]] void Error( const char *error, ... ); +#define ENSURE( condition ) \ + (void) \ + ( (!!( condition )) || \ + (Error( "%s:%u:%s: Condition '%s' failed.", __FILE__, __LINE__, __func__, #condition ), 0) ) diff --git a/tools/quake3/common/inout_xml.h b/tools/quake3/common/inout_xml.h new file mode 100644 index 00000000..73055e95 --- /dev/null +++ b/tools/quake3/common/inout_xml.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 1999-2006 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 + */ + +#pragma once + +// inout is the only stuff relying on xml, include the headers there +typedef struct _xmlNode xmlNode; +typedef xmlNode *xmlNodePtr; + +template class BasicVector3; +typedef BasicVector3 Vector3; + +// some useful xml routines +xmlNodePtr xml_NodeForVec( const Vector3& v ); +void xml_SendNode( xmlNodePtr node ); +// print a message in q3map output and send the corresponding select information down the xml stream +// bError: do we end with an error on this one or do we go ahead? +void xml_Select( const char *msg, int entitynum, int brushnum, bool bError ); +// end q3map with an error message and send a point information in the xml stream +// note: we might want to add a boolean to use this as a warning or an error thing.. +void xml_Winding( const char *msg, const Vector3 p[], int numpoints, bool die ); +void xml_Point( const char *msg, const Vector3& pt ); + +#ifdef _DEBUG +#define DBG_XML 1 +#endif + +#ifdef DBG_XML +void DumpXML(); +#endif diff --git a/tools/quake3/common/polyset.h b/tools/quake3/common/polyset.h index 62114f36..76ee8991 100644 --- a/tools/quake3/common/polyset.h +++ b/tools/quake3/common/polyset.h @@ -25,6 +25,8 @@ #define POLYSET_MAXTRIANGLES 4096 #define POLYSET_MAXPOLYSETS 64 +#include "mathlib.h" + typedef float st_t[2]; typedef float rgb_t[3]; diff --git a/tools/quake3/common/qfiles.h b/tools/quake3/common/qfiles.h index 75f558fc..f2709de6 100644 --- a/tools/quake3/common/qfiles.h +++ b/tools/quake3/common/qfiles.h @@ -27,6 +27,8 @@ // This file must be identical in the quake and utils directories // +#include "mathlib.h" + // surface geometry should not exceed these limits #define SHADER_MAX_VERTEXES 1000 #define SHADER_MAX_INDEXES ( 6 * SHADER_MAX_VERTEXES ) diff --git a/tools/quake3/common/qstringops.h b/tools/quake3/common/qstringops.h new file mode 100644 index 00000000..3f29df16 --- /dev/null +++ b/tools/quake3/common/qstringops.h @@ -0,0 +1,139 @@ +/* + Copyright (C) 1999-2006 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 + */ + +#pragma once + +#include +#include +#include + +inline bool strEmpty( const char* string ){ + return *string == '\0'; +} +inline bool strEmptyOrNull( const char* string ){ + return string == NULL || *string == '\0'; +} +inline void strClear( char* string ){ + *string = '\0'; +} +inline char *strLower( char *string ){ + for( char *in = string; *in; ++in ) + *in = tolower( *in ); + return string; +} +inline char *copystring( const char *src ){ // version of strdup() with malloc() + const size_t size = strlen( src ) + 1; + return static_cast( memcpy( malloc( size ), src, size ) ); +} +#ifdef WIN32 + #define Q_stricmp stricmp + #define Q_strnicmp strnicmp +#else + #define Q_stricmp strcasecmp + #define Q_strnicmp strncasecmp +#endif +inline bool strEqual( const char* string, const char* other ){ + return strcmp( string, other ) == 0; +} +inline bool strnEqual( const char* string, const char* other, size_t n ){ + return strncmp( string, other, n ) == 0; +} +inline bool striEqual( const char* string, const char* other ){ + return Q_stricmp( string, other ) == 0; +} +inline bool strniEqual( const char* string, const char* other, size_t n ){ + return Q_strnicmp( string, other, n ) == 0; +} + +inline bool strEqualPrefix( const char* string, const char* prefix ){ + return strnEqual( string, prefix, strlen( prefix ) ); +} +inline bool striEqualPrefix( const char* string, const char* prefix ){ + return strniEqual( string, prefix, strlen( prefix ) ); +} +inline bool strEqualSuffix( const char* string, const char* suffix ){ + const size_t stringLength = strlen( string ); + const size_t suffixLength = strlen( suffix ); + return ( suffixLength > stringLength )? false : strnEqual( string + stringLength - suffixLength, suffix, suffixLength ); +} +inline bool striEqualSuffix( const char* string, const char* suffix ){ + const size_t stringLength = strlen( string ); + const size_t suffixLength = strlen( suffix ); + return ( suffixLength > stringLength )? false : strniEqual( string + stringLength - suffixLength, suffix, suffixLength ); +} + +//http://stackoverflow.com/questions/27303062/strstr-function-like-that-ignores-upper-or-lower-case +//chux: Somewhat tricky to match the corner cases of strstr() with inputs like "x","", "","x", "","" +inline const char *strIstr( const char* haystack, const char* needle ) { + do { + const char* h = haystack; + const char* n = needle; + while ( tolower( (unsigned char)*h ) == tolower( (unsigned char)*n ) && *n != '\0' ) { + h++; + n++; + } + if ( *n == '\0' ) { + return haystack; + } + } while ( *haystack++ ); + return NULL; +} + +inline char *strIstr( char* haystack, const char* needle ) { + return const_cast( strIstr( const_cast( haystack ), needle ) ); +} + +/* strlcpy, strlcat versions */ + +/* + * Copy src to string dst of size size. At most size-1 characters + * will be copied. Always NUL terminates (unless size == 0). + * Returns strlen(src); if retval >= size, truncation occurred. + */ +inline size_t strcpyQ( char* dest, const char* src, const size_t dest_size ) { + const size_t src_len = strlen( src ); + if( src_len < dest_size ) + memcpy( dest, src, src_len + 1 ); + else if( dest_size != 0 ){ + memcpy( dest, src, dest_size - 1 ); + dest[dest_size - 1] = '\0'; + } + return src_len; +} + +inline size_t strcatQ( char* dest, const char* src, const size_t dest_size ) { + const size_t dest_len = strlen( dest ); + return dest_len + strcpyQ( dest + dest_len, src, dest_size > dest_len? dest_size - dest_len : 0 ); +} + +inline size_t strncatQ( char* dest, const char* src, const size_t dest_size, const size_t src_len ) { + const size_t dest_len = strlen( dest ); + const size_t ds_len = dest_len + src_len; + if( ds_len < dest_size ){ + memcpy( dest + dest_len, src, src_len ); + dest[ds_len] = '\0'; + } + else if( dest_len < dest_size ){ + memcpy( dest + dest_len, src, dest_size - dest_len - 1 ); + dest[dest_size - 1] = '\0'; + } + return ds_len; +} diff --git a/tools/quake3/common/scriplib.cpp b/tools/quake3/common/scriplib.cpp index 2ebfc84b..6633de34 100644 --- a/tools/quake3/common/scriplib.cpp +++ b/tools/quake3/common/scriplib.cpp @@ -23,6 +23,7 @@ #include "cmdlib.h" #include "inout.h" +#include "qstringops.h" #include "scriplib.h" #include "vfs.h" diff --git a/tools/quake3/common/trilib.cpp b/tools/quake3/common/trilib.cpp index 9a267281..191164c6 100644 --- a/tools/quake3/common/trilib.cpp +++ b/tools/quake3/common/trilib.cpp @@ -25,6 +25,8 @@ #include #include "cmdlib.h" +#include "inout.h" +#include "qstringops.h" #include "mathlib.h" #include "polyset.h" #include "trilib.h" diff --git a/tools/quake3/common/vfs.cpp b/tools/quake3/common/vfs.cpp index 4ac9f4bd..bfb7d2dd 100644 --- a/tools/quake3/common/vfs.cpp +++ b/tools/quake3/common/vfs.cpp @@ -46,6 +46,7 @@ #include #include "cmdlib.h" +#include "qstringops.h" #include "filematch.h" #include "inout.h" #include "vfs.h" diff --git a/tools/quake3/q3data/md3lib.cpp b/tools/quake3/q3data/md3lib.cpp index 90eb69f4..9f39eb5e 100644 --- a/tools/quake3/q3data/md3lib.cpp +++ b/tools/quake3/q3data/md3lib.cpp @@ -19,8 +19,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include #include "md3lib.h" +#include "inout.h" +#include "../common/cmdlib.h" /* ** MD3_ComputeTagFromTri diff --git a/tools/quake3/q3data/md3lib.h b/tools/quake3/q3data/md3lib.h index 5158b539..2722a3e7 100644 --- a/tools/quake3/q3data/md3lib.h +++ b/tools/quake3/q3data/md3lib.h @@ -19,9 +19,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include "../common/cmdlib.h" -#include "mathlib.h" #include "../common/qfiles.h" void MD3_Dump( const char *filename ); diff --git a/tools/quake3/q3data/models.cpp b/tools/quake3/q3data/models.cpp index 9f9e203a..1835df69 100644 --- a/tools/quake3/q3data/models.cpp +++ b/tools/quake3/q3data/models.cpp @@ -19,7 +19,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include #include "q3data.h" //================================================================= diff --git a/tools/quake3/q3data/p3dlib.cpp b/tools/quake3/q3data/p3dlib.cpp index c6e26d8f..cd76675c 100644 --- a/tools/quake3/q3data/p3dlib.cpp +++ b/tools/quake3/q3data/p3dlib.cpp @@ -26,6 +26,7 @@ #include #include "../common/cmdlib.h" +#include "../common/qstringops.h" #define MAX_POLYSETS 64 diff --git a/tools/quake3/q3data/q3data.h b/tools/quake3/q3data/q3data.h index 51ed42ec..f5ca09a3 100644 --- a/tools/quake3/q3data/q3data.h +++ b/tools/quake3/q3data/q3data.h @@ -29,6 +29,8 @@ #include #include "../common/cmdlib.h" +#include "../common/inout.h" +#include "../common/qstringops.h" #include "scriplib.h" #include "mathlib.h" #include "polyset.h" diff --git a/tools/quake3/q3map2/bsp.cpp b/tools/quake3/q3map2/bsp.cpp index c2776302..63817bb9 100644 --- a/tools/quake3/q3map2/bsp.cpp +++ b/tools/quake3/q3map2/bsp.cpp @@ -284,8 +284,6 @@ static void FixBrushSides( entity_t *e ){ void ProcessWorldModel( void ){ entity_t *e; - xmlNodePtr polyline, leaknode; - char level[ 2 ]; const char *value; /* sets integer blockSize from worldspawn "_blocksize" key if it exists */ @@ -332,17 +330,7 @@ void ProcessWorldModel( void ){ const bool leaked = ( leakStatus != EFloodEntities::Good ); if( leaked ){ - Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "**********************\n" ); - Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "******* leaked *******\n" ); - Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "**********************\n" ); - polyline = LeakFile( tree ); - leaknode = xmlNewNode( NULL, (const xmlChar*)"message" ); - xmlNodeAddContent( leaknode, (const xmlChar*)"MAP LEAKED\n" ); - xmlAddChild( leaknode, polyline ); - level[0] = (int) '0' + SYS_ERR; - level[1] = 0; - xmlSetProp( leaknode, (const xmlChar*)"level", (const xmlChar*)level ); - xml_SendNode( leaknode ); + Leak_feedback( tree ); if ( leaktest ) { Sys_FPrintf( SYS_WRN, "--- MAP LEAKED, ABORTING LEAKTEST ---\n" ); exit( 0 ); diff --git a/tools/quake3/q3map2/games.cpp b/tools/quake3/q3map2/games.cpp index b72efae8..6bffb2d4 100644 --- a/tools/quake3/q3map2/games.cpp +++ b/tools/quake3/q3map2/games.cpp @@ -29,7 +29,8 @@ #include "games.h" #include "bspfile_ibsp.h" #include "bspfile_rbsp.h" -#include "cmdlib.h" +#include "qstringops.h" +#include "inout.h" struct game_default : game_t { diff --git a/tools/quake3/q3map2/leakfile.cpp b/tools/quake3/q3map2/leakfile.cpp index f47a464b..e278e41a 100644 --- a/tools/quake3/q3map2/leakfile.cpp +++ b/tools/quake3/q3map2/leakfile.cpp @@ -30,6 +30,7 @@ /* dependencies */ #include "q3map2.h" +#include "libxml/tree.h" @@ -117,3 +118,18 @@ xmlNodePtr LeakFile( const tree_t& tree ){ return xml_node; } + +void Leak_feedback( const tree_t& tree ){ + Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "**********************\n" ); + Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "******* leaked *******\n" ); + Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "**********************\n" ); + xmlNodePtr polyline = LeakFile( tree ); + xmlNodePtr leaknode = xmlNewNode( NULL, (const xmlChar*)"message" ); + xmlNodeAddContent( leaknode, (const xmlChar*)"MAP LEAKED\n" ); + xmlAddChild( leaknode, polyline ); + char level[ 2 ]; + level[0] = (int) '0' + SYS_ERR; + level[1] = 0; + xmlSetProp( leaknode, (const xmlChar*)"level", (const xmlChar*)level ); + xml_SendNode( leaknode ); +} diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index f7940855..faec163c 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -69,6 +69,7 @@ #include "version.h" /* ttimo: might want to guard that if built outside of the GtkRadiant tree */ #include "cmdlib.h" +#include "qstringops.h" #include "md5lib.h" #include "ddslib.h" @@ -77,6 +78,7 @@ #include "imagelib.h" #include "qthreads.h" #include "inout.h" +#include "inout_xml.h" #include "vfs.h" #include "png.h" #include "md4.h" @@ -1513,7 +1515,7 @@ void MakeTreePortals( tree_t& tree ); /* leakfile.c */ -xmlNodePtr LeakFile( const tree_t& tree ); +void Leak_feedback( const tree_t& tree ); /* prtfile.c */