From ee88bdeca83ebf6aff4b2bebf2c1f93eb2bf9541 Mon Sep 17 00:00:00 2001 From: navewindre Date: Sun, 18 Nov 2018 20:06:19 +0100 Subject: d --- internal_rewrite/Valve/dt_common.h | 91 +++++--------------------------------- 1 file changed, 11 insertions(+), 80 deletions(-) (limited to 'internal_rewrite/Valve/dt_common.h') diff --git a/internal_rewrite/Valve/dt_common.h b/internal_rewrite/Valve/dt_common.h index e936587..ff0f7b7 100644 --- a/internal_rewrite/Valve/dt_common.h +++ b/internal_rewrite/Valve/dt_common.h @@ -129,86 +129,17 @@ typedef enum } SendPropType; -class DVariant -{ -public: - DVariant() - { - m_Type = DPT_Float; - } - DVariant( float val ) - { - m_Type = DPT_Float; m_Float = val; - } - - const char *ToString() - { - static char text[ 128 ]; - - switch( m_Type ) - { - case DPT_Int: - sprintf( text, "%i", m_Int ); - break; - case DPT_Float: - sprintf( text, "%.3f", m_Float ); - break; - case DPT_Vector: - sprintf( text, "(%.3f,%.3f,%.3f)", - m_Vector[ 0 ], m_Vector[ 1 ], m_Vector[ 2 ] ); - break; - case DPT_VectorXY: - sprintf( text, "(%.3f,%.3f)", - m_Vector[ 0 ], m_Vector[ 1 ] ); - break; -#if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!! - case DPT_Quaternion: - snprintf( text, sizeof( text ), "(%.3f,%.3f,%.3f %.3f)", - m_Vector[ 0 ], m_Vector[ 1 ], m_Vector[ 2 ], m_Vector[ 3 ] ); - break; -#endif - case DPT_String: - if( m_pString ) - return m_pString; - else - return "NULL"; - break; - case DPT_Array: - sprintf( text, "Array" ); - break; - case DPT_DataTable: - sprintf( text, "DataTable" ); - break; -#ifdef SUPPORTS_INT64 - case DPT_Int64: - snprintf( text, sizeof( text ), "%I64d", m_Int64 ); - break; -#endif - default: - sprintf( text, "DVariant type %i unknown", m_Type ); - break; - } - - return text; - } - - union - { - float m_Float; - int m_Int; - const char *m_pString; - void *m_pData; // For DataTables. -#if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!! - float m_Vector[ 4 ]; -#else - float m_Vector[ 3 ]; -#endif - -#ifdef SUPPORTS_INT64 - int64 m_Int64; -#endif - }; - SendPropType m_Type; +struct DVariant { + union { + float m_Float; + long m_Int; + char* m_pString; + void* m_pData; + float m_Vector[ 3 ]; + __int64 m_Int64; + }; + + int m_Type; }; -- cgit v1.2.3