Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2009-05-11 00:53:58 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2009-05-11 00:53:58 +0400
commit386122ada6432b29437c3ca7f1eea2b5b919d377 (patch)
tree88923d82aaf1b87c1498db6112d027297ff1c492 /source/gameengine/Expressions
parent6f5ef6044dabdd383a91a14c65a2f9f454fb5c42 (diff)
BGE performance, 4th round: logic
This commit extends the technique of dynamic linked list to the logic system to eliminate as much as possible temporaries, map lookup or full scan. The logic engine is now free of memory allocation, which is an important stability factor. The overhead of the logic system is reduced by a factor between 3 and 6 depending on the logic setup. This is the speed-up you can expect on a logic setup using simple bricks. Heavy bricks like python controllers and ray sensors will still take about the same time to execute so the speed up will be less important. The core of the logic engine has been much reworked but the functionality is still the same except for one thing: the priority system on the execution of controllers. The exact same remark applies to actuators but I'll explain for controllers only: Previously, it was possible, with the "executePriority" attribute to set a controller to run before any other controllers in the game. Other than that, the sequential execution of controllers, as defined in Blender was guaranteed by default. With the new system, the sequential execution of controllers is still guaranteed but only within the controllers of one object. the user can no longer set a controller to run before any other controllers in the game. The "executePriority" attribute controls the execution of controllers within one object. The priority is a small number starting from 0 for the first controller and incrementing for each controller. If this missing feature is a must, a special method can be implemented to set a controller to run before all other controllers. Other improvements: - Systematic use of reference in parameter passing to avoid unnecessary data copy - Use pre increment in iterator instead of post increment to avoid temporary allocation - Use const char* instead of STR_String whenever possible to avoid temporary allocation - Fix reference counting bugs (memory leak) - Fix a crash in certain cases of state switching and object deletion - Minor speed up in property sensor - Removal of objects during the game is a lot faster
Diffstat (limited to 'source/gameengine/Expressions')
-rw-r--r--source/gameengine/Expressions/BoolValue.cpp8
-rw-r--r--source/gameengine/Expressions/BoolValue.h5
-rw-r--r--source/gameengine/Expressions/CMakeLists.txt1
-rw-r--r--source/gameengine/Expressions/ErrorValue.cpp6
-rw-r--r--source/gameengine/Expressions/ErrorValue.h2
-rw-r--r--source/gameengine/Expressions/FloatValue.cpp2
-rw-r--r--source/gameengine/Expressions/FloatValue.h2
-rw-r--r--source/gameengine/Expressions/IfExpr.cpp7
-rw-r--r--source/gameengine/Expressions/InputParser.cpp10
-rw-r--r--source/gameengine/Expressions/InputParser.h10
-rw-r--r--source/gameengine/Expressions/IntValue.cpp2
-rw-r--r--source/gameengine/Expressions/IntValue.h2
-rw-r--r--source/gameengine/Expressions/ListValue.cpp12
-rw-r--r--source/gameengine/Expressions/ListValue.h2
-rw-r--r--source/gameengine/Expressions/Makefile1
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp2
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.h14
-rw-r--r--source/gameengine/Expressions/SConscript2
-rw-r--r--source/gameengine/Expressions/StringValue.cpp2
-rw-r--r--source/gameengine/Expressions/StringValue.h2
-rw-r--r--source/gameengine/Expressions/Value.cpp10
-rw-r--r--source/gameengine/Expressions/Value.h39
-rw-r--r--source/gameengine/Expressions/VectorValue.cpp2
-rw-r--r--source/gameengine/Expressions/VectorValue.h2
24 files changed, 75 insertions, 72 deletions
diff --git a/source/gameengine/Expressions/BoolValue.cpp b/source/gameengine/Expressions/BoolValue.cpp
index 4e0a71e5a19..d90da8b3a92 100644
--- a/source/gameengine/Expressions/BoolValue.cpp
+++ b/source/gameengine/Expressions/BoolValue.cpp
@@ -26,6 +26,9 @@
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
+const STR_String CBoolValue::sTrueString = "TRUE";
+const STR_String CBoolValue::sFalseString = "FALSE";
+
CBoolValue::CBoolValue()
/*
@@ -45,7 +48,7 @@ CBoolValue::CBoolValue(bool inBool)
-CBoolValue::CBoolValue(bool innie,STR_String name,AllocationTYPE alloctype)
+CBoolValue::CBoolValue(bool innie,const char *name,AllocationTYPE alloctype)
{
m_bool = innie;
SetName(name);
@@ -190,9 +193,6 @@ double CBoolValue::GetNumber()
const STR_String& CBoolValue::GetText()
{
- static STR_String sTrueString = STR_String("TRUE");
- static STR_String sFalseString = STR_String("FALSE");
-
return m_bool ? sTrueString : sFalseString;
}
diff --git a/source/gameengine/Expressions/BoolValue.h b/source/gameengine/Expressions/BoolValue.h
index 9352b9d4b92..726619e7193 100644
--- a/source/gameengine/Expressions/BoolValue.h
+++ b/source/gameengine/Expressions/BoolValue.h
@@ -28,9 +28,12 @@ class CBoolValue : public CPropValue
//PLUGIN_DECLARE_SERIAL(CBoolValue,CValue)
public:
+ static const STR_String sTrueString;
+ static const STR_String sFalseString;
+
CBoolValue();
CBoolValue(bool inBool);
- CBoolValue(bool innie, STR_String name, AllocationTYPE alloctype = CValue::HEAPVALUE);
+ CBoolValue(bool innie, const char *name, AllocationTYPE alloctype = CValue::HEAPVALUE);
virtual const STR_String& GetText();
virtual double GetNumber();
diff --git a/source/gameengine/Expressions/CMakeLists.txt b/source/gameengine/Expressions/CMakeLists.txt
index 6b2a835d648..eb87fdcee81 100644
--- a/source/gameengine/Expressions/CMakeLists.txt
+++ b/source/gameengine/Expressions/CMakeLists.txt
@@ -31,6 +31,7 @@ SET(INC
../../../source/kernel/gen_system
../../../intern/string
../../../intern/moto/include
+ ../../../source/gameengine/Scenegraph
${PYTHON_INC}
)
diff --git a/source/gameengine/Expressions/ErrorValue.cpp b/source/gameengine/Expressions/ErrorValue.cpp
index 651a772db19..a44abf8b22e 100644
--- a/source/gameengine/Expressions/ErrorValue.cpp
+++ b/source/gameengine/Expressions/ErrorValue.cpp
@@ -34,13 +34,15 @@ effect: constructs a new CErrorValue containing errormessage "Error"
-CErrorValue::CErrorValue(STR_String errmsg)
+CErrorValue::CErrorValue(const char *errmsg)
/*
pre:
effect: constructs a new CErrorValue containing errormessage errmsg
*/
{
- m_strErrorText = "[" + errmsg + "]";
+ m_strErrorText = "[";
+ m_strErrorText += errmsg;
+ m_strErrorText += "]";
SetError(true);
}
diff --git a/source/gameengine/Expressions/ErrorValue.h b/source/gameengine/Expressions/ErrorValue.h
index 5b5795196ba..b4b758feea7 100644
--- a/source/gameengine/Expressions/ErrorValue.h
+++ b/source/gameengine/Expressions/ErrorValue.h
@@ -25,7 +25,7 @@ public:
virtual const STR_String & GetText();
virtual double GetNumber();
CErrorValue();
- CErrorValue(STR_String errmsg);
+ CErrorValue(const char *errmsg);
virtual ~CErrorValue();
virtual CValue* Calc(VALUE_OPERATOR op, CValue* val);
virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
diff --git a/source/gameengine/Expressions/FloatValue.cpp b/source/gameengine/Expressions/FloatValue.cpp
index a31d3b9a528..4de685a82c1 100644
--- a/source/gameengine/Expressions/FloatValue.cpp
+++ b/source/gameengine/Expressions/FloatValue.cpp
@@ -50,7 +50,7 @@ effect: constructs a new CFloatValue containing value fl
-CFloatValue::CFloatValue(float fl,STR_String name,AllocationTYPE alloctype)
+CFloatValue::CFloatValue(float fl,const char *name,AllocationTYPE alloctype)
/*
pre:
effect: constructs a new CFloatValue containing value fl
diff --git a/source/gameengine/Expressions/FloatValue.h b/source/gameengine/Expressions/FloatValue.h
index 41f70b5c54c..fb75b7c702b 100644
--- a/source/gameengine/Expressions/FloatValue.h
+++ b/source/gameengine/Expressions/FloatValue.h
@@ -23,7 +23,7 @@ class CFloatValue : public CPropValue
public:
CFloatValue();
CFloatValue(float fl);
- CFloatValue(float fl,STR_String name,AllocationTYPE alloctype=CValue::HEAPVALUE);
+ CFloatValue(float fl,const char *name,AllocationTYPE alloctype=CValue::HEAPVALUE);
virtual const STR_String & GetText();
diff --git a/source/gameengine/Expressions/IfExpr.cpp b/source/gameengine/Expressions/IfExpr.cpp
index 5d3eb3641ca..fcb37bff52d 100644
--- a/source/gameengine/Expressions/IfExpr.cpp
+++ b/source/gameengine/Expressions/IfExpr.cpp
@@ -15,6 +15,7 @@
#include "IfExpr.h"
#include "EmptyValue.h"
#include "ErrorValue.h"
+#include "BoolValue.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -72,14 +73,14 @@ ret: a new object containing the value of m_e1 if m_guard is a boolean TRUE
{
CValue *guardval;
guardval = m_guard->Calculate();
- STR_String text = guardval->GetText();
+ const STR_String& text = guardval->GetText();
guardval->Release();
- if (text == STR_String("TRUE"))
+ if (&text == &CBoolValue::sTrueString)
{
return m_e1->Calculate();
}
- else if (text == STR_String("FALSE"))
+ else if (&text == &CBoolValue::sFalseString)
{
return m_e2->Calculate();
}
diff --git a/source/gameengine/Expressions/InputParser.cpp b/source/gameengine/Expressions/InputParser.cpp
index 91a14f97851..b15b206a38a 100644
--- a/source/gameengine/Expressions/InputParser.cpp
+++ b/source/gameengine/Expressions/InputParser.cpp
@@ -66,7 +66,7 @@ CParser::~CParser()
-void CParser::ScanError(STR_String str)
+void CParser::ScanError(const char *str)
{
// sets the global variable errmsg to an errormessage with
// contents str, appending if it already exists
@@ -81,7 +81,7 @@ void CParser::ScanError(STR_String str)
-CExpression* CParser::Error(STR_String str)
+CExpression* CParser::Error(const char *str)
{
// makes and returns a new CConstExpr filled with an CErrorValue
// with string str
@@ -537,7 +537,7 @@ CExpression *CParser::Expr() {
}
CExpression* CParser::ProcessText
-(STR_String intext) {
+(const char *intext) {
// and parses the string in intext and returns it.
@@ -574,7 +574,7 @@ CExpression* CParser::ProcessText
-float CParser::GetFloat(STR_String txt)
+float CParser::GetFloat(STR_String& txt)
{
// returns parsed text into a float
// empty string returns -1
@@ -599,7 +599,7 @@ float CParser::GetFloat(STR_String txt)
return result;
}
-CValue* CParser::GetValue(STR_String txt, bool bFallbackToText)
+CValue* CParser::GetValue(STR_String& txt, bool bFallbackToText)
{
// returns parsed text into a value,
// empty string returns NULL value !
diff --git a/source/gameengine/Expressions/InputParser.h b/source/gameengine/Expressions/InputParser.h
index 3d517222639..810bdc244a8 100644
--- a/source/gameengine/Expressions/InputParser.h
+++ b/source/gameengine/Expressions/InputParser.h
@@ -27,9 +27,9 @@ public:
CParser();
virtual ~CParser();
- float GetFloat(STR_String txt);
- CValue* GetValue(STR_String txt, bool bFallbackToText=false);
- CExpression* ProcessText(STR_String intext);
+ float GetFloat(STR_String& txt);
+ CValue* GetValue(STR_String& txt, bool bFallbackToText=false);
+ CExpression* ProcessText(const char *intext);
void SetContext(CValue* context);
private:
@@ -86,8 +86,8 @@ private:
CValue* m_identifierContext;// context in which identifiers are looked up
- void ScanError(STR_String str);
- CExpression* Error(STR_String str);
+ void ScanError(const char *str);
+ CExpression* Error(const char *str);
void NextCh();
void TermChar(char c);
void DigRep();
diff --git a/source/gameengine/Expressions/IntValue.cpp b/source/gameengine/Expressions/IntValue.cpp
index 74ec9865fec..227518e9439 100644
--- a/source/gameengine/Expressions/IntValue.cpp
+++ b/source/gameengine/Expressions/IntValue.cpp
@@ -54,7 +54,7 @@ effect: constructs a new CIntValue containing cInt innie
-CIntValue::CIntValue(cInt innie,STR_String name,AllocationTYPE alloctype)
+CIntValue::CIntValue(cInt innie,const char *name,AllocationTYPE alloctype)
{
m_int = innie;
SetName(name);
diff --git a/source/gameengine/Expressions/IntValue.h b/source/gameengine/Expressions/IntValue.h
index 0f3a38b274b..06bf1755749 100644
--- a/source/gameengine/Expressions/IntValue.h
+++ b/source/gameengine/Expressions/IntValue.h
@@ -32,7 +32,7 @@ public:
CIntValue();
CIntValue(cInt innie);
CIntValue(cInt innie,
- STR_String name,
+ const char *name,
AllocationTYPE alloctype=CValue::HEAPVALUE);
virtual CValue* Calc(VALUE_OPERATOR op,
diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp
index f4a801a965b..75ae2cb787f 100644
--- a/source/gameengine/Expressions/ListValue.cpp
+++ b/source/gameengine/Expressions/ListValue.cpp
@@ -18,6 +18,7 @@
#include "StringValue.h"
#include "VoidValue.h"
#include <algorithm>
+#include "BoolValue.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -75,7 +76,7 @@ PyObject* listvalue_mapping_subscript(PyObject* self, PyObject* pyindex)
if (PyString_Check(pyindex))
{
- STR_String index(PyString_AsString(pyindex));
+ const char *index = PyString_AsString(pyindex);
CValue *item = ((CListValue*) list)->FindValue(index);
if (item)
{
@@ -394,7 +395,7 @@ void CListValue::ReleaseAndRemoveAll()
-CValue* CListValue::FindValue(const STR_String & name)
+CValue* CListValue::FindValue(const char * name)
{
CValue* resultval = NULL;
int i=0;
@@ -497,13 +498,12 @@ bool CListValue::CheckEqual(CValue* first,CValue* second)
if (eqval==NULL)
return false;
-
- STR_String txt = eqval->GetText();
- eqval->Release();
- if (txt=="TRUE")
+ const STR_String& text = eqval->GetText();
+ if (&text==&CBoolValue::sTrueString)
{
result = true;
}
+ eqval->Release();
return result;
}
diff --git a/source/gameengine/Expressions/ListValue.h b/source/gameengine/Expressions/ListValue.h
index 3d88b5aea9c..ad918cbb925 100644
--- a/source/gameengine/Expressions/ListValue.h
+++ b/source/gameengine/Expressions/ListValue.h
@@ -45,7 +45,7 @@ public:
void SetReleaseOnDestruct(bool bReleaseContents);
bool SearchValue(CValue* val);
- CValue* FindValue(const STR_String & name);
+ CValue* FindValue(const char *name);
void ReleaseAndRemoveAll();
virtual void SetModified(bool bModified);
diff --git a/source/gameengine/Expressions/Makefile b/source/gameengine/Expressions/Makefile
index 6736149bbcd..a1400c4e461 100644
--- a/source/gameengine/Expressions/Makefile
+++ b/source/gameengine/Expressions/Makefile
@@ -41,4 +41,5 @@ CPPFLAGS += -I../../blender/makesdna
CPPFLAGS += -I$(NAN_STRING)/include
CPPFLAGS += -I$(NAN_MOTO)/include
CPPFLAGS += -I../../kernel/gen_system
+CPPFLAGS += -I../../gameengine/Scenegraph
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index 7026db5b8a4..83c0b25df24 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -104,7 +104,7 @@ void PyObjectPlus::py_base_dealloc(PyObject *self) // python wrapper
PyObject_DEL( self );
};
-PyObjectPlus::PyObjectPlus(PyTypeObject *T) // constructor
+PyObjectPlus::PyObjectPlus(PyTypeObject *T) : SG_QList() // constructor
{
MT_assert(T != NULL);
m_proxy= NULL;
diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h
index b7f22404c7a..b69697f3290 100644
--- a/source/gameengine/Expressions/PyObjectPlus.h
+++ b/source/gameengine/Expressions/PyObjectPlus.h
@@ -38,6 +38,7 @@
#include "KX_Python.h"
#include "STR_String.h"
+#include "SG_QList.h"
/*------------------------------
* Python defines
@@ -462,7 +463,18 @@ typedef struct KX_PYATTRIBUTE_DEF {
------------------------------*/
typedef PyTypeObject * PyParentObject; // Define the PyParent Object
-class PyObjectPlus
+// By making SG_QList the ultimate parent for PyObjectPlus objects, it
+// allows to put them in 2 different dynamic lists at the same time
+// The use of these links is interesting because they free of memory allocation
+// but it's very important not to mess up with them. If you decide that
+// the SG_QList or SG_DList component is used for something for a certain class,
+// they cannot can be used for anything else at a parent level!
+// What these lists are and what they are used for must be carefully documented
+// at the level where they are used.
+// DON'T MAKE ANY USE OF THESE LIST AT THIS LEVEL, they are already used
+// at SCA_IActuator, SCA_ISensor, SCA_IController level which rules out the
+// possibility to use them at SCA_ILogicBrick, CValue and PyObjectPlus level.
+class PyObjectPlus : public SG_QList
{ // The PyObjectPlus abstract class
Py_Header; // Always start with Py_Header
diff --git a/source/gameengine/Expressions/SConscript b/source/gameengine/Expressions/SConscript
index 3d855d40623..9d6823e3879 100644
--- a/source/gameengine/Expressions/SConscript
+++ b/source/gameengine/Expressions/SConscript
@@ -3,7 +3,7 @@ Import ('env')
sources = env.Glob('*.cpp')
-incs ='. #source/kernel/gen_system #intern/string #intern/moto/include'
+incs ='. #source/kernel/gen_system #intern/string #intern/moto/include #source/gameengine/Scenegraph'
incs += ' ' + env['BF_PYTHON_INC']
cxxflags = []
diff --git a/source/gameengine/Expressions/StringValue.cpp b/source/gameengine/Expressions/StringValue.cpp
index 857aa97b420..a7033fcf11c 100644
--- a/source/gameengine/Expressions/StringValue.cpp
+++ b/source/gameengine/Expressions/StringValue.cpp
@@ -34,7 +34,7 @@ effect: constructs a new CStringValue
m_strString = "[Illegal String constructor call]";
}
-CStringValue::CStringValue(STR_String txt,STR_String name,AllocationTYPE alloctype)
+CStringValue::CStringValue(const char *txt,const char *name,AllocationTYPE alloctype)
/*
pre:
effect: constructs a new CStringValue containing text txt
diff --git a/source/gameengine/Expressions/StringValue.h b/source/gameengine/Expressions/StringValue.h
index 16575ed7ffa..52f8a580f4d 100644
--- a/source/gameengine/Expressions/StringValue.h
+++ b/source/gameengine/Expressions/StringValue.h
@@ -26,7 +26,7 @@ class CStringValue : public CPropValue
public:
/// Construction / destruction
CStringValue();
- CStringValue (STR_String txt, STR_String name , AllocationTYPE alloctype = CValue::HEAPVALUE);
+ CStringValue (const char *txt, const char *name , AllocationTYPE alloctype = CValue::HEAPVALUE);
virtual ~CStringValue() {
};
diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp
index a811b39d790..83deeef91a3 100644
--- a/source/gameengine/Expressions/Value.cpp
+++ b/source/gameengine/Expressions/Value.cpp
@@ -291,13 +291,17 @@ CValue* CValue::GetProperty(const char *inName)
//
// Get text description of property with name <inName>, returns an empty string if there is no property named <inName>
//
-STR_String CValue::GetPropertyText(const STR_String & inName,const STR_String& deftext)
+const STR_String& CValue::GetPropertyText(const STR_String & inName,const char *deftext)
{
+ const static STR_String sEmpty("");
+
CValue *property = GetProperty(inName);
if (property)
return property->GetText();
+ else if (deftext)
+ return STR_String(deftext);
else
- return deftext;//String::sEmpty;
+ return sEmpty;
}
float CValue::GetPropertyNumber(const STR_String& inName,float defnumber)
@@ -647,7 +651,7 @@ CValue* CValue::ConvertPythonToValue(PyObject* pyobj, const char *error_prefix)
int CValue::py_delattro(PyObject *attr)
{
char *attr_str= PyString_AsString(attr);
- if (RemoveProperty(STR_String(attr_str)))
+ if (RemoveProperty(attr_str))
return 0;
PyErr_Format(PyExc_AttributeError, "attribute \"%s\" dosnt exist", attr_str);
diff --git a/source/gameengine/Expressions/Value.h b/source/gameengine/Expressions/Value.h
index c5c8229ebcf..e5c95df1c5c 100644
--- a/source/gameengine/Expressions/Value.h
+++ b/source/gameengine/Expressions/Value.h
@@ -308,7 +308,7 @@ public:
virtual void SetProperty(const char* name,CValue* ioProperty);
virtual CValue* GetProperty(const char* inName); // Get pointer to a property with name <inName>, returns NULL if there is no property named <inName>
virtual CValue* GetProperty(const STR_String & inName);
- STR_String GetPropertyText(const STR_String & inName,const STR_String& deftext=""); // Get text description of property with name <inName>, returns an empty string if there is no property named <inName>
+ const STR_String& GetPropertyText(const STR_String & inName,const char *deftext=NULL); // Get text description of property with name <inName>, returns an empty string if there is no property named <inName>
float GetPropertyNumber(const STR_String& inName,float defnumber);
virtual bool RemoveProperty(const char *inName); // Remove the property named <inName>, returns true if the property was succesfully removed, false if property was not found or could not be removed
virtual vector<STR_String> GetPropertyNames();
@@ -331,8 +331,8 @@ public:
double* ZeroVector() { return m_sZeroVec; };
virtual double* GetVector3(bool bGetTransformedVec = false);
- virtual STR_String GetName() = 0; // Retrieve the name of the value
- virtual void SetName(STR_String name) = 0; // Set the name of the value
+ virtual STR_String& GetName() = 0; // Retrieve the name of the value
+ virtual void SetName(const char *name) = 0; // Set the name of the value
/** Sets the value to this cvalue.
* @attention this particular function should never be called. Why not abstract? */
virtual void SetValue(CValue* newval);
@@ -420,49 +420,28 @@ public:
#else
CPropValue() :
#endif //NO_EXP_PYTHON_EMBEDDING
- m_pstrNewName(NULL)
+ m_strNewName()
{
}
virtual ~CPropValue()
{
- if (m_pstrNewName)
- {
- delete m_pstrNewName;
- m_pstrNewName = NULL;
- }
}
- virtual void SetName(STR_String name) {
- if (m_pstrNewName)
- {
- delete m_pstrNewName;
- m_pstrNewName = NULL;
- }
- if (name.Length())
- m_pstrNewName = new STR_String(name);
- }
- virtual void ProcessReplica() {
- CValue::ProcessReplica();
- if (m_pstrNewName)
- m_pstrNewName = new STR_String(*m_pstrNewName);
+ virtual void SetName(const char *name) {
+ m_strNewName = name;
}
- virtual STR_String GetName() {
+ virtual STR_String& GetName() {
//STR_String namefromprop = GetPropertyText("Name");
//if (namefromprop.Length() > 0)
// return namefromprop;
-
- if (m_pstrNewName)
- {
- return *m_pstrNewName;
- }
- return STR_String("");
+ return m_strNewName;
}; // name of Value
protected:
- STR_String* m_pstrNewName; // Identification
+ STR_String m_strNewName; // Identification
};
#endif // !defined _VALUEBASECLASS_H
diff --git a/source/gameengine/Expressions/VectorValue.cpp b/source/gameengine/Expressions/VectorValue.cpp
index e8e1d45c356..c58c78e6ebe 100644
--- a/source/gameengine/Expressions/VectorValue.cpp
+++ b/source/gameengine/Expressions/VectorValue.cpp
@@ -48,7 +48,7 @@ CVectorValue::CVectorValue(float x,float y,float z, AllocationTYPE alloctype)
m_vec[KX_Z] = m_transformedvec[KX_Z] = z;
}
-CVectorValue::CVectorValue(double vec[],STR_String name,AllocationTYPE alloctype) {
+CVectorValue::CVectorValue(double vec[],const char *name,AllocationTYPE alloctype) {
SetCustomFlag1(false);//FancyOutput=false;
diff --git a/source/gameengine/Expressions/VectorValue.h b/source/gameengine/Expressions/VectorValue.h
index 99bf0abb11b..19c7dd30076 100644
--- a/source/gameengine/Expressions/VectorValue.h
+++ b/source/gameengine/Expressions/VectorValue.h
@@ -41,7 +41,7 @@ public:
CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
- CVectorValue(double vec[],STR_String name,AllocationTYPE alloctype=CValue::HEAPVALUE);
+ CVectorValue(double vec[],const char *name,AllocationTYPE alloctype=CValue::HEAPVALUE);
CVectorValue() {};
CVectorValue(double vec[],AllocationTYPE alloctype=CValue::HEAPVALUE);