Enable CXX_GUARDEDALLOC support through SCons.
[blender.git] / source / gameengine / Expressions / VoidValue.h
index bec611d62ce68bde27e311d73abf8a935037fce9..f30f8c1be7c564c73ca02e7c6c8567ad284de955 100644 (file)
@@ -2,15 +2,12 @@
  * VoidValue.h: interface for the CVoidValue class.
  * $Id$
  *
- * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
+ * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program 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. The Blender
- * Foundation also sells licenses for use in proprietary software under
- * the Blender License.  See http://www.blender.org/BL/ for information
- * about this.
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,7 +16,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
@@ -28,7 +25,7 @@
  *
  * Contributor(s): none yet.
  *
- * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ * ***** END GPL LICENSE BLOCK *****
  */
 #ifndef __VOIDVALUE_H__
 #define __VOIDVALUE_H__
@@ -44,13 +41,13 @@ class CVoidValue : public CPropValue
 
 public:
        /// Construction/destruction
-       CVoidValue()                                                                                                                            : m_pAnything(NULL),    m_bDeleteOnDestruct(false) { }
-       CVoidValue(void * voidptr, bool bDeleteOnDestruct, AllocationTYPE alloctype)    : m_pAnything(voidptr), m_bDeleteOnDestruct(bDeleteOnDestruct) { if (alloctype == STACKVALUE) CValue::DisableRefCount(); }
+       CVoidValue()                                                                                                                            : m_bDeleteOnDestruct(false), m_pAnything(NULL)  { }
+       CVoidValue(void * voidptr, bool bDeleteOnDestruct, AllocationTYPE alloctype)    : m_bDeleteOnDestruct(bDeleteOnDestruct), m_pAnything(voidptr)  { if (alloctype == STACKVALUE) CValue::DisableRefCount(); }
        virtual                         ~CVoidValue();                                                                                  // Destruct void value, delete memory if we're owning it
 
        /// Value -> String or number
        virtual const STR_String &      GetText();                                                                                              // Get string description of void value (unimplemented)
-       virtual float           GetNumber()                                                                                             { return -1; }
+       virtual double          GetNumber()                                                                                             { return -1; }
 
        /// Value calculation
        virtual CValue*         Calc(VALUE_OPERATOR op, CValue *val);
@@ -62,6 +59,13 @@ public:
        /// Data members
        bool                            m_bDeleteOnDestruct;
        void*                           m_pAnything;
+       
+       
+#ifdef WITH_CXX_GUARDEDALLOC
+public:
+       void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:CVoidValue"); }
+       void operator delete( void *mem ) { MEM_freeN(mem); }
+#endif
 };
 
 #endif // !defined _VOIDVALUE_H