1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-19 03:56:10 +08:00

Fixed conflict between min/max macros and std::min/max when using GCC >= 4.2.

This commit is contained in:
Scott Ehlert
2011-04-28 01:29:36 -05:00
parent 94dd57587b
commit 79f4a53df6
300 changed files with 1041 additions and 1084 deletions

View File

@ -750,7 +750,7 @@ void RunJobWatchApp( char *pCmdLine )
if ( s1 || s2 )
{
// Get rid of the last slash.
s1 = max( s1, s2 );
s1 = MAX( s1, s2 );
s1[0] = 0;
if ( !CreateProcess(

View File

@ -636,7 +636,7 @@ void CDemoSmootherPanel::OnPreview( bool original )
m_bPreviewing = true;
m_bPreviewPaused = false;
m_bPreviewOriginal = original;
SetLastFrame( false, max( 0, m_nSelection[0] - 10 ) );
SetLastFrame( false, MAX( 0, m_nSelection[0] - 10 ) );
m_iPreviewStartTick = GetTickForFrame( m_nPreviewLastFrame );
m_fPreviewCurrentTime = TICKS_TO_TIME( m_iPreviewStartTick );
}
@ -875,14 +875,14 @@ void CDemoSmootherPanel::DrawDebuggingInfo( int frame, float elapsed )
bool showall = m_pShowAllSamples->IsSelected();
if ( !showall )
{
start = max( frame - 200, 0 );
end = min( frame + 200, c - 1 );
start = MAX( frame - 200, 0 );
end = MIN( frame + 200, c - 1 );
}
if ( m_bHasSelection && !showall )
{
start = max( m_nSelection[ 0 ] - 10, 0 );
end = min( m_nSelection[ 1 ] + 10, c - 1 );
start = MAX( m_nSelection[ 0 ] - 10, 0 );
end = MIN( m_nSelection[ 1 ] + 10, c - 1 );
}
bool draworiginal = !m_pHideOriginal->IsSelected();
@ -1111,7 +1111,7 @@ bool CDemoSmootherPanel::GetInterpolatedOriginAndAngles( bool readonly, Vector&
demosmoothing_t *startsample = &m_Smoothing.smooth[ startframe ];
demosmoothing_t *endsample = &m_Smoothing.smooth[ nextframe ];
if ( nextframe >= min( m_nSelection[1] + 10, c - 1 ) )
if ( nextframe >= MIN( m_nSelection[1] + 10, c - 1 ) )
{
if ( !readonly )
{
@ -1219,7 +1219,7 @@ void CDemoSmootherPanel::OnStep( bool forward )
int c = m_Smoothing.smooth.Count();
SetLastFrame( false, m_nPreviewLastFrame + ( forward ? 1 : -1 ) );
SetLastFrame( false, clamp( m_nPreviewLastFrame, max( m_nSelection[ 0 ] - 10, 0 ), min( m_nSelection[ 1 ] + 10, c - 1 ) ) );
SetLastFrame( false, clamp( m_nPreviewLastFrame, MAX( m_nSelection[ 0 ] - 10, 0 ), MIN( m_nSelection[ 1 ] + 10, c - 1 ) ) );
m_fPreviewCurrentTime = TICKS_TO_TIME( GetTickForFrame( m_nPreviewLastFrame ) );
}

View File

@ -108,7 +108,7 @@ int CToolDemoFile::ReadNetworkDataTables( CUtlBuffer *buf )
while( length > 0 )
{
int chunk = min( length, 1024 );
int chunk = MIN( length, 1024 );
g_pFileSystem->Read( data, chunk, m_hDemoFile );
length -= chunk;

View File

@ -330,7 +330,7 @@ bool BuildRules( ISpRecoGrammar* cpRecoGrammar, SPSTATEHANDLE *root, CUtlVector<
if ( numrules > 1 )
{
for ( int skip = 1; skip <= min( MAX_WORD_SKIP, numrules ); skip++ )
for ( int skip = 1; skip <= MIN( MAX_WORD_SKIP, numrules ); skip++ )
{
OutputDebugString( va( "Opt transition from Root to %s\r\n", (*rules)[ 0 ].plaintext ) );
@ -1034,8 +1034,8 @@ void MergeWords( CWordTag *w1, CWordTag *w2 )
{
unsigned int start, end;
start = min( w1->m_uiStartByte, w2->m_uiStartByte );
end = max( w1->m_uiEndByte, w2->m_uiEndByte );
start = MIN( w1->m_uiStartByte, w2->m_uiStartByte );
end = MAX( w1->m_uiEndByte, w2->m_uiEndByte );
unsigned int mid = ( start + end ) / 2;

View File

@ -663,7 +663,7 @@ bool FuzzyWordMatch( char const *w1, char const *w2 )
int len1 = strlen( w1 );
int len2 = strlen( w2 );
int minlen = min( len1, len2 );
int minlen = MIN( len1, len2 );
// Found a match
if ( !strnicmp( w1, w2, minlen ) )

View File

@ -227,7 +227,7 @@ void CDispMeshEvent::GetVirtualMesh( void *userData, virtualmeshlist_t *pList )
pList->surfacePropsIndex = 0; // doesn't matter here, reset at runtime
pList->pHull = NULL;
int indexMax = ARRAYSIZE(pList->indices);
int indexCount = min(m_indexCount, indexMax);
int indexCount = MIN(m_indexCount, indexMax);
Assert(m_indexCount < indexMax);
Q_memcpy( pList->indices, m_pIndices, sizeof(*m_pIndices) * indexCount );
}
@ -247,7 +247,7 @@ void CDispMeshEvent::GetTrianglesInSphere( void *userData, const Vector &center,
Assert(userData==((void *)this));
pList->triangleCount = m_indexCount/3;
int indexMax = ARRAYSIZE(pList->triangleIndices);
int indexCount = min(m_indexCount, indexMax);
int indexCount = MIN(m_indexCount, indexMax);
Assert(m_indexCount < MAX_VIRTUAL_TRIANGLES*3);
Q_memcpy( pList->triangleIndices, m_pIndices, sizeof(*m_pIndices) * indexCount );
}

View File

@ -1054,7 +1054,7 @@ static void Flood_FindConnectedWaterVolumes_r( CUtlVector<node_t *> &list, node_
visited.Set( pLeaf->diskId );
list.AddToTail( pLeaf );
baseleaf.minZ = min( pLeaf->mins.z, baseleaf.minZ );
baseleaf.minZ = MIN( pLeaf->mins.z, baseleaf.minZ );
for (portal_t *p = pLeaf->portals ; p ; p = p->next[!oppositeNodeIndex])
{

View File

@ -33,13 +33,11 @@
#include <xercesc/dom/DOM.hpp>
#include <xercesc/sax/HandlerBase.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include "valve_minmax_off.h"
#if defined(XERCES_NEW_IOSTREAMS)
#include <iostream>
#else
#include <iostream.h>
#endif
#include "valve_minmax_on.h"
#define IXMLDOMNode DOMNode
#define IXMLDOMNodeList DOMNodeList

View File

@ -574,7 +574,7 @@ void CIncremental::AddLightsForActiveLights()
// Copy the light information.
pLight->m_Light = dl->light;
pLight->m_flMaxIntensity = max( dl->light.intensity[0], max( dl->light.intensity[1], dl->light.intensity[2] ) );
pLight->m_flMaxIntensity = MAX( dl->light.intensity[0], MAX( dl->light.intensity[1], dl->light.intensity[2] ) );
}
}
@ -609,8 +609,8 @@ bool CIncremental::LoadIncrementalFile()
FileRead( fp, pLight->m_Light );
pLight->m_flMaxIntensity =
max( pLight->m_Light.intensity.x,
max( pLight->m_Light.intensity.y, pLight->m_Light.intensity.z ) );
MAX( pLight->m_Light.intensity.x,
MAX( pLight->m_Light.intensity.y, pLight->m_Light.intensity.z ) );
int nFaces;
FileRead( fp, nFaces );

View File

@ -191,8 +191,8 @@ bool IsLeafAmbientSurfaceLight( dworldlight_t *wl )
if ( wl->style != 0 )
return false;
float intensity = max( wl->intensity[0], wl->intensity[1] );
intensity = max( intensity, wl->intensity[2] );
float intensity = MAX( wl->intensity[0], wl->intensity[1] );
intensity = MAX( intensity, wl->intensity[2] );
return (intensity * g_flWorldLightMinEmitSurfaceDistanceRatio) < g_flWorldLightMinEmitSurface;
}
@ -345,7 +345,7 @@ void AddSampleToList( CUtlVector<ambientsample_t> &list, const Vector &samplePos
for (int s = 0; s < 3; s++ )
{
float dc = fabs(list[i].cube[k][s] - list[j].cube[k][s]);
maxDC = max(maxDC,dc);
maxDC = MAX(maxDC,dc);
}
totalDC += maxDC;
}
@ -452,8 +452,8 @@ float AABBDistance( const Vector &mins0, const Vector &maxs0, const Vector &mins
Vector delta;
for ( int i = 0; i < 3; i++ )
{
float greatestMin = max(mins0[i], mins1[i]);
float leastMax = min(maxs0[i], maxs1[i]);
float greatestMin = MAX(mins0[i], mins1[i]);
float leastMax = MIN(maxs0[i], maxs1[i]);
delta[i] = (greatestMin < leastMax) ? 0 : (leastMax - greatestMin);
}
return delta.Length();
@ -533,9 +533,9 @@ void ComputeAmbientForLeaf( int iThread, int leafID, CUtlVector<ambientsample_t>
int xSize = (dleafs[leafID].maxs[0] - dleafs[leafID].mins[0]) / 32;
int ySize = (dleafs[leafID].maxs[1] - dleafs[leafID].mins[1]) / 32;
int zSize = (dleafs[leafID].maxs[2] - dleafs[leafID].mins[2]) / 64;
xSize = max(xSize,1);
ySize = max(xSize,1);
zSize = max(xSize,1);
xSize = MAX(xSize,1);
ySize = MAX(xSize,1);
zSize = MAX(xSize,1);
// generate update 128 candidate samples, always at least one sample
int volumeCount = xSize * ySize * zSize;
if ( g_bFastAmbient )

View File

@ -90,8 +90,8 @@ int CNormalList::FindOrAddNormal( Vector const &vNormal )
for( int iDim=0; iDim < 3; iDim++ )
{
gi[iDim] = (int)( ((vNormal[iDim] + 1.0f) * 0.5f) * NUM_SUBDIVS - 0.000001f );
gi[iDim] = min( gi[iDim], NUM_SUBDIVS );
gi[iDim] = max( gi[iDim], 0 );
gi[iDim] = MIN( gi[iDim], NUM_SUBDIVS );
gi[iDim] = MAX( gi[iDim], 0 );
}
// Look for a matching vector in there.
@ -1326,8 +1326,8 @@ bool CanLeafTraceToSky( int iLeaf )
for ( int j = 0; j < NUMVERTEXNORMALS; j+=4 )
{
// search back to see if we can hit a sky brush
delta.LoadAndSwizzle( g_anorms[j], g_anorms[min( j+1, NUMVERTEXNORMALS-1 )],
g_anorms[min( j+2, NUMVERTEXNORMALS-1 )], g_anorms[min( j+3, NUMVERTEXNORMALS-1 )] );
delta.LoadAndSwizzle( g_anorms[j], g_anorms[MIN( j+1, NUMVERTEXNORMALS-1 )],
g_anorms[MIN( j+2, NUMVERTEXNORMALS-1 )], g_anorms[MIN( j+3, NUMVERTEXNORMALS-1 )] );
delta *= -MAX_TRACE_LENGTH;
delta += center4;
@ -2816,18 +2816,18 @@ static void ComputeLightmapGradients( SSE_SampleInfo_t& info, bool const* pHasPr
if (sample.t > 0)
{
if (sample.s > 0) gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j-1-w] ) );
gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j-w] ) );
if (sample.s < w-1) gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j+1-w] ) );
if (sample.s > 0) gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j-1-w] ) );
gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j-w] ) );
if (sample.s < w-1) gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j+1-w] ) );
}
if (sample.t < h-1)
{
if (sample.s > 0) gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j-1+w] ) );
gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j+w] ) );
if (sample.s < w-1) gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j+1+w] ) );
if (sample.s > 0) gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j-1+w] ) );
gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j+w] ) );
if (sample.s < w-1) gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j+1+w] ) );
}
if (sample.s > 0) gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j-1] ) );
if (sample.s < w-1) gradient[i] = max( gradient[i], fabs( pIntensity[j] - pIntensity[j+1] ) );
if (sample.s > 0) gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j-1] ) );
if (sample.s < w-1) gradient[i] = MAX( gradient[i], fabs( pIntensity[j] - pIntensity[j+1] ) );
}
}
}
@ -3118,7 +3118,7 @@ void BuildFacelights (int iThread, int facenum)
int nSample = 4 * grp;
sample_t *sample = sampleInfo.m_pFaceLight->sample + nSample;
int numSamples = min ( 4, sampleInfo.m_pFaceLight->numsamples - nSample );
int numSamples = MIN ( 4, sampleInfo.m_pFaceLight->numsamples - nSample );
FourVectors positions;
FourVectors normals;

View File

@ -89,19 +89,19 @@ void AddDirectToRadial( radial_t *rad,
s_max = ( int )( coordmaxs[0] + 0.9999f ) + 1; // ????
t_max = ( int )( coordmaxs[1] + 0.9999f ) + 1;
s_min = max( s_min, 0 );
t_min = max( t_min, 0 );
s_max = min( s_max, rad->w );
t_max = min( t_max, rad->h );
s_min = MAX( s_min, 0 );
t_min = MAX( t_min, 0 );
s_max = MIN( s_max, rad->w );
t_max = MIN( t_max, rad->h );
for( s = s_min; s < s_max; s++ )
{
for( t = t_min; t < t_max; t++ )
{
float s0 = max( coordmins[0] - s, -1.0 );
float t0 = max( coordmins[1] - t, -1.0 );
float s1 = min( coordmaxs[0] - s, 1.0 );
float t1 = min( coordmaxs[1] - t, 1.0 );
float s0 = MAX( coordmins[0] - s, -1.0 );
float t0 = MAX( coordmins[1] - t, -1.0 );
float s1 = MIN( coordmaxs[0] - s, 1.0 );
float t1 = MIN( coordmaxs[1] - t, 1.0 );
area = (s1 - s0) * (t1 - t0);
@ -110,7 +110,7 @@ void AddDirectToRadial( radial_t *rad,
ds = fabs( coord[0] - s );
dt = fabs( coord[1] - t );
r = max( ds, dt );
r = MAX( ds, dt );
if (r < 0.1)
{
@ -176,8 +176,8 @@ void AddBouncedToRadial( radial_t *rad,
distt = (coordmaxs[1] - coordmins[1]);
// patches less than a luxel in size could be mistakeningly filtered, so clamp.
dists = max( 1.0, dists );
distt = max( 1.0, distt );
dists = MAX( 1.0, dists );
distt = MAX( 1.0, distt );
// find possible domain of patch influence
s_min = ( int )( coord[0] - dists * RADIALDIST );
@ -186,10 +186,10 @@ void AddBouncedToRadial( radial_t *rad,
t_max = ( int )( coord[1] + distt * RADIALDIST + 1.0f );
// clamp to valid luxel
s_min = max( s_min, 0 );
t_min = max( t_min, 0 );
s_max = min( s_max, rad->w );
t_max = min( t_max, rad->h );
s_min = MAX( s_min, 0 );
t_min = MAX( t_min, 0 );
s_max = MIN( s_max, rad->w );
t_max = MIN( t_max, rad->h );
for( s = s_min; s < s_max; s++ )
{
@ -249,10 +249,10 @@ void PatchLightmapCoordRange( radial_t *rad, int ndxPatch, Vector2D &mins, Vecto
for (i = 0; i < w->numpoints; i++)
{
WorldToLuxelSpace( &rad->l, w->p[i], coord );
mins[0] = min( mins[0], coord[0] );
maxs[0] = max( maxs[0], coord[0] );
mins[1] = min( mins[1], coord[1] );
maxs[1] = max( maxs[1], coord[1] );
mins[0] = MIN( mins[0], coord[0] );
maxs[0] = MAX( maxs[0], coord[0] );
mins[1] = MIN( mins[1], coord[1] );
maxs[1] = MAX( maxs[1], coord[1] );
}
}
@ -810,7 +810,7 @@ void FinalLightFace( int iThread, int facenum )
// garymct: minlight is a per entity minimum light value?
for( i=0; i<3; i++ )
{
lb[bumpSample].m_vecLighting[i] = max( lb[bumpSample].m_vecLighting[i], minlight );
lb[bumpSample].m_vecLighting[i] = MAX( lb[bumpSample].m_vecLighting[i], minlight );
}
// Do the average light computation, I'm assuming (perhaps incorrectly?)

View File

@ -185,9 +185,9 @@ void PatchSampleData_AddSample( CPatch *pPatch, int ndxPatch )
// Make sure mins are smaller than maxs so we don't iterate for 4 bil.
Assert( patchSampleMins[0] <= patchSampleMaxs[0] && patchSampleMins[1] <= patchSampleMaxs[1] && patchSampleMins[2] <= patchSampleMaxs[2] );
patchSampleMins[0] = min( patchSampleMins[0], patchSampleMaxs[0] );
patchSampleMins[1] = min( patchSampleMins[1], patchSampleMaxs[1] );
patchSampleMins[2] = min( patchSampleMins[2], patchSampleMaxs[2] );
patchSampleMins[0] = MIN( patchSampleMins[0], patchSampleMaxs[0] );
patchSampleMins[1] = MIN( patchSampleMins[1], patchSampleMaxs[1] );
patchSampleMins[2] = MIN( patchSampleMins[2], patchSampleMaxs[2] );
int iterateCoords[3];
for ( iterateCoords[0]=patchSampleMins[0]; iterateCoords[0] <= patchSampleMaxs[0]; iterateCoords[0]++ )

View File

@ -283,7 +283,7 @@ void ReadLightFile (char *filename)
texlights[j].filename = filename;
file_texlights ++;
num_texlights = max( num_texlights, j + 1 );
num_texlights = MAX( num_texlights, j + 1 );
}
}
qprintf ( "[%i texlights parsed from '%s']\n\n", file_texlights, filename);
@ -818,7 +818,7 @@ int CreateChildPatch( int nParentIndex, winding_t *pWinding, float flArea, const
if ( (child->face_maxs[i] == child->maxs[i] || child->face_mins[i] == child->mins[i] )
&& total[i] > minchop )
{
child->chop = max( minchop, child->chop / 2 );
child->chop = MAX( minchop, child->chop / 2 );
break;
}
}
@ -878,7 +878,7 @@ void SubdividePatch( int ndxPatch )
if (patch->chop > minchop)
{
bSubdivide = true;
patch->chop = max( minchop, patch->chop / 2 );
patch->chop = MAX( minchop, patch->chop / 2 );
}
}
}
@ -2619,7 +2619,7 @@ int ParseCommandLine( int argc, char **argv, bool *onlydetail )
Warning("Error: expected positive value after '-chop'\n" );
return 1;
}
minchop = min( minchop, maxchop );
minchop = MIN( minchop, maxchop );
}
else
{

View File

@ -109,7 +109,7 @@ void CVRADDispColl::CalcSampleRadius2AndBox( dface_t *pFace )
m_flSampleRadius2 = flSampleRadius * flSampleRadius;
// Calculate the patch radius - the max sample edge length * the number of luxels per edge "chop."
float flSampleSize = max( m_flSampleWidth, m_flSampleHeight );
float flSampleSize = MAX( m_flSampleWidth, m_flSampleHeight );
float flPatchSampleRadius = flSampleSize * dispchop * 2.2f;
if ( flPatchSampleRadius > g_MaxDispPatchRadius )
{
@ -440,7 +440,7 @@ void CVRADDispColl::CreateChildPatchesFromRoot( int iParentPatch, int *pChildPat
vecEdges[3] = pParentPatch->winding->p[3] - pParentPatch->winding->p[0];
// Should the patch be subdivided - check the area.
float flMaxLength = max( m_flSampleWidth, m_flSampleHeight );
float flMaxLength = MAX( m_flSampleWidth, m_flSampleHeight );
float flMinEdgeLength = flMaxLength * dispchop;
// Find the longest edge.
@ -551,7 +551,7 @@ void CVRADDispColl::CreateChildPatches( int iParentPatch, int nLevel )
return;
// Should the patch be subdivided - check the area.
float flMaxLength = max( m_flSampleWidth, m_flSampleHeight );
float flMaxLength = MAX( m_flSampleWidth, m_flSampleHeight );
float flMinEdgeLength = flMaxLength * dispchop;
// Split along the longest edge.
@ -659,7 +659,7 @@ void CVRADDispColl::CreateChildPatchesSub( int iParentPatch )
return;
// Should the patch be subdivided - check the area.
float flMaxLength = max( m_flSampleWidth, m_flSampleHeight );
float flMaxLength = MAX( m_flSampleWidth, m_flSampleHeight );
float flMinEdgeLength = flMaxLength * dispchop;
// Split along the longest edge.
@ -870,8 +870,8 @@ bool CVRADDispColl::InitParentPatch( int iPatch, Vector *pPoints, float &flArea
{
for ( int iAxis = 0; iAxis < 3; ++iAxis )
{
vecMin[iAxis] = min( vecMin[iAxis], pPoints[iPoint][iAxis] );
vecMax[iAxis] = max( vecMax[iAxis], pPoints[iPoint][iAxis] );
vecMin[iAxis] = MIN( vecMin[iAxis], pPoints[iPoint][iAxis] );
vecMax[iAxis] = MAX( vecMax[iAxis], pPoints[iPoint][iAxis] );
}
}
@ -1019,8 +1019,8 @@ bool CVRADDispColl::InitPatch( int iPatch, int iParentPatch, int iChild, Vector
{
for ( int iAxis = 0; iAxis < 3; ++iAxis )
{
vecMin[iAxis] = min( vecMin[iAxis], pPoints[iPoint][iAxis] );
vecMax[iAxis] = max( vecMax[iAxis], pPoints[iPoint][iAxis] );
vecMin[iAxis] = MIN( vecMin[iAxis], pPoints[iPoint][iAxis] );
vecMax[iAxis] = MAX( vecMax[iAxis], pPoints[iPoint][iAxis] );
}
}

View File

@ -606,15 +606,15 @@ public:
// HACKHACK: Compute the average coverage for this triangle by sampling the AABB of its texture space
float ComputeCoverageForTriangle( int shadowTextureIndex, const Vector2D &t0, const Vector2D &t1, const Vector2D &t2 )
{
float umin = min(t0.x, t1.x);
umin = min(umin, t2.x);
float umax = max(t0.x, t1.x);
umax = max(umax, t2.x);
float umin = MIN(t0.x, t1.x);
umin = MIN(umin, t2.x);
float umax = MAX(t0.x, t1.x);
umax = MAX(umax, t2.x);
float vmin = min(t0.y, t1.y);
vmin = min(vmin, t2.y);
float vmax = max(t0.y, t1.y);
vmax = max(vmax, t2.y);
float vmin = MIN(t0.y, t1.y);
vmin = MIN(vmin, t2.y);
float vmax = MAX(t0.y, t1.y);
vmax = MAX(vmax, t2.y);
// UNDONE: Do something about tiling
umin = clamp(umin, 0, 1);

View File

@ -500,7 +500,7 @@ void RunVTexOnFile( const char *pBaseDir, const char *pFilename )
char executableDir[MAX_PATH];
GetModuleFileName( NULL, executableDir, sizeof( executableDir ) );
char *pLastSlash = max( strrchr( executableDir, '/' ), strrchr( executableDir, '\\' ) );
char *pLastSlash = MAX( strrchr( executableDir, '/' ), strrchr( executableDir, '\\' ) );
if ( !pLastSlash )
Error( "Can't find filename in '%s'.\n", executableDir );