From a87fcf989933d3e7cc1413d7d25136afa159d113 Mon Sep 17 00:00:00 2001 From: Timothee 'TTimo' Besset Date: Sun, 27 May 2012 20:17:32 -0500 Subject: [PATCH] make bool/qboolean/boolean *slightly* less wonky --- libs/bytebool.h | 1 + libs/cmdlib.h | 20 ++------------------ libs/pakstuff.h | 4 +--- radiant/brush.cpp | 2 +- radiant/brush.h | 2 +- radiant/undo.cpp | 2 +- radiant/undo.h | 2 +- 7 files changed, 8 insertions(+), 25 deletions(-) diff --git a/libs/bytebool.h b/libs/bytebool.h index e0617893..a6fcb326 100644 --- a/libs/bytebool.h +++ b/libs/bytebool.h @@ -13,6 +13,7 @@ typedef bool qboolean; #define qfalse false #else typedef enum { qfalse, qtrue } qboolean; +typedef qboolean bool; // some code uses bool directly .. #endif typedef unsigned char byte; diff --git a/libs/cmdlib.h b/libs/cmdlib.h index 1dde0fc6..782b602b 100644 --- a/libs/cmdlib.h +++ b/libs/cmdlib.h @@ -38,6 +38,8 @@ #define PATH_MAX 260 #endif +#include "bytebool.h" + // some easy portability crap #ifdef _WIN32 #include @@ -47,24 +49,6 @@ #define Q_mkdir( a,b ) mkdir( a,b ) #endif -#ifdef __cplusplus -typedef bool qboolean; -#endif - -// NOTE TTimo: is this worth anything? -#ifndef __BYTEBOOL__ -#define __BYTEBOOL__ - -#ifndef __cplusplus -typedef enum {false, true} boolean; -#else -typedef unsigned char boolean; -#endif - -typedef unsigned char byte; - -#endif // __BYTEBOOL__ - void DefaultExtension( char *path, char *extension ); void DefaultPath( char *path, char *basepath ); void StripFilename( char *path ); diff --git a/libs/pakstuff.h b/libs/pakstuff.h index a2ace159..00198a71 100644 --- a/libs/pakstuff.h +++ b/libs/pakstuff.h @@ -28,9 +28,7 @@ #include #endif -#ifndef __cplusplus -typedef int bool; // leo -#endif +#include "bytebool.h" #ifdef __cplusplus extern "C" diff --git a/radiant/brush.cpp b/radiant/brush.cpp index 7747531e..b6fc0344 100644 --- a/radiant/brush.cpp +++ b/radiant/brush.cpp @@ -929,7 +929,7 @@ void Brush_Build( brush_t *b, bool bSnap, bool bMarkMap, bool bConvert, bool bFi The incoming face is NOT left referenced. ============== */ -void Brush_SplitBrushByFace( brush_t *in, face_t *f, brush_t **front, brush_t **back, boolean bCaulk ){ +void Brush_SplitBrushByFace( brush_t *in, face_t *f, brush_t **front, brush_t **back, qboolean bCaulk ){ brush_t *b; face_t *nf; vec3_t temp; diff --git a/radiant/brush.h b/radiant/brush.h index 66c05740..1d8869fc 100644 --- a/radiant/brush.h +++ b/radiant/brush.h @@ -47,7 +47,7 @@ void Brush_ResetFaceOriginals( brush_t *b ); face_t* Brush_Ray( vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlags = 0 ); void Brush_RemoveFromList( brush_t *b ); // bCaulk means the faces created during the operation will be caulked, this is used in conjunction with g_PrefsDlg.m_bClipCaulk -void Brush_SplitBrushByFace( brush_t *in, face_t *f, brush_t **front, brush_t **back, boolean bCaulk = false ); +void Brush_SplitBrushByFace( brush_t *in, face_t *f, brush_t **front, brush_t **back, qboolean bCaulk = false ); void Brush_SelectFaceForDragging( brush_t *b, face_t *f, qboolean shear ); void Brush_SetTexture( brush_t *b, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale = false, IPluginTexdef* pPlugTexdef = (IPluginTexdef*)NULL ); void Brush_SideSelect( brush_t *b, vec3_t origin, vec3_t dir, qboolean shear ); diff --git a/radiant/undo.cpp b/radiant/undo.cpp index d576f82b..f56a65b6 100644 --- a/radiant/undo.cpp +++ b/radiant/undo.cpp @@ -610,7 +610,7 @@ void Undo_End( void ){ Undo_Undo ============= */ -void Undo_Undo( boolean bSilent ){ +void Undo_Undo( qboolean bSilent ){ // spog - disable undo if undo levels = 0 if ( g_PrefsDlg.m_nUndoLevels == 0 ) { Sys_Printf( "Undo_Undo: undo is disabled.\n" ); diff --git a/radiant/undo.h b/radiant/undo.h index 1081031d..591e9ed7 100644 --- a/radiant/undo.h +++ b/radiant/undo.h @@ -42,7 +42,7 @@ void Undo_AddEntity( entity_t *entity ); //end an entity after the operation is performed void Undo_EndEntity( entity_t *entity ); //undo last operation (bSilent == true -> will not print the "undone blah blah message") -void Undo_Undo( boolean bSilent = false ); +void Undo_Undo( qboolean bSilent = false ); //redo last undone operation void Undo_Redo( void ); //get the undo Id of the next undo (0 if none available)