From: Rudolf Polzer Date: Tue, 27 Mar 2012 10:11:37 +0000 (+0200) Subject: Merge remote-tracking branch 'github/master' X-Git-Tag: xonotic-v0.7.0~16^2~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b7e36c120eb1546a6c6f97f30e42ab7f9a559c61;p=xonotic%2Fnetradiant.git Merge remote-tracking branch 'github/master' Conflicts: .gitignore config.py libs/synapse/synapse.cpp plugins/imagehl/lbmlib.cpp plugins/surface_heretic2/surfacedialog.cpp plugins/surface_ufoai/surfacedialog.cpp radiant/brushscript.cpp radiant/main.cpp radiant/preferences.cpp tools/quake3/common/cmdlib.c tools/quake3/common/cmdlib.h tools/quake3/q3map2/path_init.c windows_compile_guide/index.html --- b7e36c120eb1546a6c6f97f30e42ab7f9a559c61 diff --cc contrib/bobtoolz/DBrush.cpp index 7c24cd0f,3e54e797..4a2b9c09 --- a/contrib/bobtoolz/DBrush.cpp +++ b/contrib/bobtoolz/DBrush.cpp @@@ -703,12 -689,12 +703,12 @@@ void DBrush::SaveToFile( FILE *pFile ) ( *pp )->points[0][0], ( *pp )->points[0][1], ( *pp )->points[0][2], ( *pp )->points[1][0], ( *pp )->points[1][1], ( *pp )->points[1][2], ( *pp )->points[2][0], ( *pp )->points[2][1], ( *pp )->points[2][2], - ( *pp )->texInfo.m_TextureName, - ( *pp )->texInfo.m_fShift[0], ( *pp )->texInfo.m_fShift[1], - ( *pp )->texInfo.m_fScale[0], ( *pp )->texInfo.m_fScale[0], - ( *pp )->texInfo.m_fRotate ); + ( *pp )->m_shader.c_str(), + ( *pp )->texInfo.m_texdef.shift[0], ( *pp )->texInfo.m_texdef.shift[1], + ( *pp )->texInfo.m_texdef.scale[0], ( *pp )->texInfo.m_texdef.scale[0], + ( *pp )->texInfo.m_texdef.rotate ); - fprintf( pFile, buffer ); + fprintf( pFile, "%s", buffer ); } fprintf( pFile, "}\n" ); diff --cc tools/quake3/common/cmdlib.c index 5164001c,35f4d75b..41fd1ca1 --- a/tools/quake3/common/cmdlib.c +++ b/tools/quake3/common/cmdlib.c @@@ -244,7 -244,10 +244,10 @@@ char *ExpandArg( const char *path ) char *ExpandPath( const char *path ){ static char full[1024]; - if ( !*qdir || path[0] == '/' || path[0] == '\\' || path[1] == ':' ) { - if ( !qdir[0] ) { ++ if ( !qdir ) { + Error( "ExpandPath called without qdir set" ); + } + if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) { strcpy( full, path ); return full; } @@@ -254,8 -257,8 +257,8 @@@ char *ExpandGamePath( const char *path ){ static char full[1024]; - if ( !*gamedir ) { - if ( !qdir[0] ) { - Error( "ExpandGamePath called without qdir set" ); ++ if ( !gamedir[0] ) { + Error( "ExpandGamePath called without gamedir set" ); } if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) { strcpy( full, path ); diff --cc tools/quake3/common/cmdlib.h index 3c9b5a54,3fb98feb..f6f5e4d1 --- a/tools/quake3/common/cmdlib.h +++ b/tools/quake3/common/cmdlib.h @@@ -53,11 -53,7 +53,11 @@@ #endif +#ifdef PATH_MAX +#define MAX_OS_PATH PATH_MAX +#else - #define MAX_OS_PATH 1024 + #define MAX_OS_PATH 4096 +#endif #define MEM_BLOCKSIZE 4096 // the dec offsetof macro doesnt work very well... diff --cc tools/quake3/q3map2/path_init.c index 2591c5bf,901f07fc..07ebc31b --- a/tools/quake3/q3map2/path_init.c +++ b/tools/quake3/q3map2/path_init.c @@@ -66,32 -66,23 +66,27 @@@ char *LokiGetHomeDir( void ) #ifndef Q_UNIX return NULL; #else + static char buf[ 4096 ]; + struct passwd pw, *pwp; char *home; - uid_t id; - struct passwd *pwd; + static char homeBuf[MAX_OS_PATH]; /* get the home environment variable */ home = getenv( "HOME" ); - if ( home == NULL ) { - /* do some more digging */ - id = getuid(); - setpwent(); - while ( ( pwd = getpwent() ) != NULL ) - { - if ( pwd->pw_uid == id ) { - home = pwd->pw_dir; - break; - } - if ( home ) { - return Q_strncpyz( buf, home, sizeof( buf ) ); - } + + /* look up home dir in password database */ - if ( getpwuid_r( getuid(), &pw, buf, sizeof( buf ), &pwp ) == 0 ) { - return pw.pw_dir; ++ if(!home) ++ { ++ if ( getpwuid_r( getuid(), &pw, buf, sizeof( buf ), &pwp ) == 0 ) { ++ return pw.pw_dir; + } - endpwent(); } - return NULL; + snprintf( homeBuf, sizeof( homeBuf ), "%s/.", home ); + + /* return it */ + return homeBuf; #endif } @@@ -130,21 -105,22 +125,16 @@@ void LokiInitPaths( char *argv0 ) qboolean found; - /* get home dir */ - home = LokiGetHomeDir(); - if ( home == NULL ) { - home = "."; - } - + path = getenv( "PATH" ); + /* do some path divining */ - strcpy( temp, argv0 ); - if ( strrchr( argv0, '/' ) ) { + Q_strncpyz( temp, argv0, sizeof( temp ) ); + if ( strrchr( temp, '/' ) ) { argv0 = strrchr( argv0, '/' ) + 1; } - else - { - /* get path environment variable */ - path = getenv( "PATH" ); - - /* minor setup */ - last = last0; - last[ 0 ] = path[ 0 ]; - last[ 1 ] = '\0'; + else if ( path ) { found = qfalse; + last = path; /* go through each : segment of path */ while ( last[ 0 ] != '\0' && found == qfalse ) diff --cc tools/quake3/q3map2/q3map2.h index 935d1c7f,245e34c6..bbb3e76e --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@@ -82,9 -80,11 +82,11 @@@ #include "inout.h" #include "vfs.h" #include "png.h" - +#include "md4.h" #include + #define MIN(a, b) ((a) < (b) ? (a) : (b)) + #define MAX(a, b) ((a) > (b) ? (a) : (b)) /* -------------------------------------------------------------------------------