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:
Diffstat (limited to 'source/gameengine/Expressions/intern')
-rw-r--r--source/gameengine/Expressions/intern/BoolValue.cpp4
-rw-r--r--source/gameengine/Expressions/intern/ConstExpr.cpp4
-rw-r--r--source/gameengine/Expressions/intern/EmptyValue.cpp6
-rw-r--r--source/gameengine/Expressions/intern/ErrorValue.cpp4
-rw-r--r--source/gameengine/Expressions/intern/Expression.cpp6
-rw-r--r--source/gameengine/Expressions/intern/FloatValue.cpp10
-rw-r--r--source/gameengine/Expressions/intern/IdentifierExpr.cpp2
-rw-r--r--source/gameengine/Expressions/intern/IfExpr.cpp4
-rw-r--r--source/gameengine/Expressions/intern/InputParser.cpp38
-rw-r--r--source/gameengine/Expressions/intern/IntValue.cpp16
-rw-r--r--source/gameengine/Expressions/intern/ListValue.cpp56
-rw-r--r--source/gameengine/Expressions/intern/Operator1Expr.cpp12
-rw-r--r--source/gameengine/Expressions/intern/Operator2Expr.cpp40
-rw-r--r--source/gameengine/Expressions/intern/PyObjectPlus.cpp84
-rw-r--r--source/gameengine/Expressions/intern/StringValue.cpp12
-rw-r--r--source/gameengine/Expressions/intern/Value.cpp28
-rw-r--r--source/gameengine/Expressions/intern/VectorValue.cpp42
17 files changed, 184 insertions, 184 deletions
diff --git a/source/gameengine/Expressions/intern/BoolValue.cpp b/source/gameengine/Expressions/intern/BoolValue.cpp
index 1523a9212ba..6d29a07aada 100644
--- a/source/gameengine/Expressions/intern/BoolValue.cpp
+++ b/source/gameengine/Expressions/intern/BoolValue.cpp
@@ -103,7 +103,7 @@ this object
*/
{
CValue *ret;
-
+
switch (dtype) {
case VALUE_EMPTY_TYPE:
case VALUE_BOOL_TYPE:
@@ -204,7 +204,7 @@ CValue* CBoolValue::GetReplica()
{
CBoolValue* replica = new CBoolValue(*this);
replica->ProcessReplica();
-
+
return replica;
}
diff --git a/source/gameengine/Expressions/intern/ConstExpr.cpp b/source/gameengine/Expressions/intern/ConstExpr.cpp
index 597427ecfe5..f7853d2dfac 100644
--- a/source/gameengine/Expressions/intern/ConstExpr.cpp
+++ b/source/gameengine/Expressions/intern/ConstExpr.cpp
@@ -30,7 +30,7 @@ CConstExpr::CConstExpr()
-CConstExpr::CConstExpr(CValue* constval)
+CConstExpr::CConstExpr(CValue* constval)
/*
pre:
effect: constructs a CConstExpr cointing the value constval
@@ -73,7 +73,7 @@ ret: a new object containing the value of the stored CValue
void CConstExpr::ClearModified()
-{
+{
if (m_value)
{
m_value->SetModified(false);
diff --git a/source/gameengine/Expressions/intern/EmptyValue.cpp b/source/gameengine/Expressions/intern/EmptyValue.cpp
index 9227626777d..5083b50668f 100644
--- a/source/gameengine/Expressions/intern/EmptyValue.cpp
+++ b/source/gameengine/Expressions/intern/EmptyValue.cpp
@@ -58,7 +58,7 @@ CValue *CEmptyValue::Calc(VALUE_OPERATOR op, CValue *val)
*/
{
return val->CalcFinal(VALUE_EMPTY_TYPE, op, this);
-
+
}
@@ -107,7 +107,7 @@ bool CEmptyValue::IsInside(CValue* testpoint,bool bBorderInclude)
double* CEmptyValue::GetVector3(bool bGetTransformedVec)
-{
+{
assertd(false); // don't get vector from me
return ZeroVector();
}
@@ -125,7 +125,7 @@ const STR_String & CEmptyValue::GetText()
CValue* CEmptyValue::GetReplica()
-{
+{
CEmptyValue* replica = new CEmptyValue(*this);
replica->ProcessReplica();
return replica;
diff --git a/source/gameengine/Expressions/intern/ErrorValue.cpp b/source/gameengine/Expressions/intern/ErrorValue.cpp
index c03ceb88073..502608a6dcf 100644
--- a/source/gameengine/Expressions/intern/ErrorValue.cpp
+++ b/source/gameengine/Expressions/intern/ErrorValue.cpp
@@ -82,7 +82,7 @@ ret: a new object containing the result of applying operator op to this
break;
}
}
-
+
return errorval;
}
@@ -122,7 +122,7 @@ const STR_String & CErrorValue::GetText()
CValue* CErrorValue::GetReplica()
-{
+{
// who would want a copy of an error ?
trace ("Error: ErrorValue::GetReplica() not implemented yet");
assertd(false);
diff --git a/source/gameengine/Expressions/intern/Expression.cpp b/source/gameengine/Expressions/intern/Expression.cpp
index 6a98a15aa12..4eab64ab249 100644
--- a/source/gameengine/Expressions/intern/Expression.cpp
+++ b/source/gameengine/Expressions/intern/Expression.cpp
@@ -50,21 +50,21 @@ CBrokenLinkInfo::~CBrokenLinkInfo()
void CBrokenLinkInfo::RestoreLink()
{
-
+
assertd(m_pExpr);
if (m_pExpr)
{
if (!m_bRestored) {
m_bRestored=true;
-
+
}
if (*m_pmemExpr)
{
(*m_pmemExpr)->Release();
}
*m_pmemExpr = m_pExpr;
-
+
// m_pExpr=NULL;
}
}
diff --git a/source/gameengine/Expressions/intern/FloatValue.cpp b/source/gameengine/Expressions/intern/FloatValue.cpp
index 0f86a429d81..814d3d3b908 100644
--- a/source/gameengine/Expressions/intern/FloatValue.cpp
+++ b/source/gameengine/Expressions/intern/FloatValue.cpp
@@ -55,7 +55,7 @@ pre:
effect: constructs a new CFloatValue containing value fl
*/
{
-
+
m_float = fl;
SetName(name);
if (alloctype==CValue::STACKVALUE)
@@ -119,7 +119,7 @@ ret: a new object containing the result of applying operator op to val and
*/
{
CValue *ret;
-
+
switch (dtype) {
case VALUE_INT_TYPE:
{
@@ -293,8 +293,8 @@ int CFloatValue::GetValueType()
void CFloatValue::SetValue(CValue* newval)
-{
- m_float = (float)newval->GetNumber();
+{
+ m_float = (float)newval->GetNumber();
SetModified(true);
}
@@ -312,7 +312,7 @@ const STR_String & CFloatValue::GetText()
CValue* CFloatValue::GetReplica()
-{
+{
CFloatValue* replica = new CFloatValue(*this);
replica->m_pstrRep = NULL; /* should be in CFloatValue::ProcessReplica() but its not defined, no matter */
replica->ProcessReplica();
diff --git a/source/gameengine/Expressions/intern/IdentifierExpr.cpp b/source/gameengine/Expressions/intern/IdentifierExpr.cpp
index 8fbbf41cd63..3a1342815af 100644
--- a/source/gameengine/Expressions/intern/IdentifierExpr.cpp
+++ b/source/gameengine/Expressions/intern/IdentifierExpr.cpp
@@ -90,7 +90,7 @@ CExpression* CIdentifierExpr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlin
-void CIdentifierExpr::ClearModified()
+void CIdentifierExpr::ClearModified()
{
assertd(false); // not implemented yet
}
diff --git a/source/gameengine/Expressions/intern/IfExpr.cpp b/source/gameengine/Expressions/intern/IfExpr.cpp
index b4e2fe7315b..549f53749d6 100644
--- a/source/gameengine/Expressions/intern/IfExpr.cpp
+++ b/source/gameengine/Expressions/intern/IfExpr.cpp
@@ -104,10 +104,10 @@ bool CIfExpr::IsInside(float x,float y,float z,bool bBorderInclude)
assertd(false);
return false;
}
-
-bool CIfExpr::NeedsRecalculated()
+
+bool CIfExpr::NeedsRecalculated()
{
return (m_guard->NeedsRecalculated() ||
m_e1->NeedsRecalculated() ||
diff --git a/source/gameengine/Expressions/intern/InputParser.cpp b/source/gameengine/Expressions/intern/InputParser.cpp
index 583d8da63cb..1f5f9800a33 100644
--- a/source/gameengine/Expressions/intern/InputParser.cpp
+++ b/source/gameengine/Expressions/intern/InputParser.cpp
@@ -33,7 +33,7 @@
#include "EXP_IdentifierExpr.h"
// this is disable at the moment, I expected a memleak from it, but the error-cleanup was the reason
-// well, looks we don't need it anyway, until maybe the Curved Surfaces are integrated into CSG
+// well, looks we don't need it anyway, until maybe the Curved Surfaces are integrated into CSG
// cool things like (IF(LOD==1,CCurvedValue,IF(LOD==2,CCurvedValue2)) etc...
#include "EXP_IfExpr.h"
@@ -185,7 +185,7 @@ void CParser::NextSym()
// sets the global variable constkind to the kind of operator
// if it is a reference to a cell
// sets the global variable cellcoord to the kind of operator
-
+
errmsg = NULL;
while (ch == ' ' || ch == 0x9)
NextCh();
@@ -303,7 +303,7 @@ void CParser::NextSym()
} else if (((ch >= 'a') && (ch <= 'z'))
|| ((ch >= 'A') && (ch <= 'Z')))
{ // reserved word?
-
+
start = chcount;
CharRep();
GrabString(start);
@@ -421,7 +421,7 @@ CExpression *CParser::Ex(int i)
// returns an CExpression, containing the parsed input
CExpression *e1 = NULL, *e2 = NULL;
int opkind2;
-
+
if (i < NUM_PRIORITY) {
e1 = Ex(i + 1);
while ((sym == opsym) && (Priority(opkind) == i)) {
@@ -522,7 +522,7 @@ CExpression *CParser::Ex(int i)
{
e1 = new CIdentifierExpr(const_as_string,m_identifierContext);
NextSym();
-
+
break;
}
case errorsym:
@@ -536,7 +536,7 @@ CExpression *CParser::Ex(int i)
errmsgval->Release();
//e1 = Error(errmsg->Calculate()->GetText());//new CConstExpr(errmsg->Calculate());
-
+
if ( !(errmsg->Release()) )
{
errmsg=NULL;
@@ -569,19 +569,19 @@ CExpression *CParser::Expr()
CExpression* CParser::ProcessText
(const char *intext) {
-
+
// and parses the string in intext and returns it.
-
-
+
+
CExpression* expr;
text = intext;
-
-
+
+
chcount = 0;
if (text.Length() == 0) {
return NULL;
}
-
+
ch = text[0];
/* if (ch != '=') {
* expr = new CConstExpr(new CStringValue(text));
@@ -599,7 +599,7 @@ CExpression* CParser::ProcessText
}
if (errmsg)
errmsg->Release();
-
+
return expr;
}
@@ -609,7 +609,7 @@ float CParser::GetFloat(STR_String& txt)
{
// returns parsed text into a float
// empty string returns -1
-
+
// AfxMessageBox("parsed string="+txt);
CValue* val=NULL;
float result=-1;
@@ -619,9 +619,9 @@ float CParser::GetFloat(STR_String& txt)
if (expr) {
val = expr->Calculate();
result=(float)val->GetNumber();
-
-
-
+
+
+
val->Release();
expr->Release();
}
@@ -632,10 +632,10 @@ float CParser::GetFloat(STR_String& txt)
CValue* CParser::GetValue(STR_String& txt, bool bFallbackToText)
{
- // returns parsed text into a value,
+ // returns parsed text into a value,
// empty string returns NULL value !
// if bFallbackToText then unparsed stuff is put into text
-
+
CValue* result=NULL;
CExpression* expr = ProcessText(txt);
if (expr) {
diff --git a/source/gameengine/Expressions/intern/IntValue.cpp b/source/gameengine/Expressions/intern/IntValue.cpp
index 7b2e841f13f..3315b3a3e3c 100644
--- a/source/gameengine/Expressions/intern/IntValue.cpp
+++ b/source/gameengine/Expressions/intern/IntValue.cpp
@@ -34,7 +34,7 @@ pre: false
effect: constructs a new CIntValue
*/
{
-
+
#ifdef DEBUG_
m_textval = "Int illegal constructor";
#endif
@@ -59,13 +59,13 @@ CIntValue::CIntValue(cInt innie,const char *name,AllocationTYPE alloctype)
{
m_int = innie;
SetName(name);
-
+
if (alloctype==CValue::STACKVALUE)
{
CValue::DisableRefCount();
}
m_pstrRep=NULL;
-
+
}
@@ -118,7 +118,7 @@ object and val
CValue* CIntValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val)
{
CValue *ret;
-
+
switch (dtype) {
case VALUE_EMPTY_TYPE:
case VALUE_INT_TYPE:
@@ -312,7 +312,7 @@ const STR_String & CIntValue::GetText()
if (!m_pstrRep)
m_pstrRep=new STR_String();
m_pstrRep->Format("%lld",m_int);
-
+
return *m_pstrRep;
}
@@ -323,15 +323,15 @@ CValue* CIntValue::GetReplica()
CIntValue* replica = new CIntValue(*this);
replica->ProcessReplica();
replica->m_pstrRep = NULL;
-
+
return replica;
}
void CIntValue::SetValue(CValue* newval)
-{
- m_int = (cInt)newval->GetNumber();
+{
+ m_int = (cInt)newval->GetNumber();
SetModified(true);
}
diff --git a/source/gameengine/Expressions/intern/ListValue.cpp b/source/gameengine/Expressions/intern/ListValue.cpp
index 557ce7be300..ce45c6cf8f5 100644
--- a/source/gameengine/Expressions/intern/ListValue.cpp
+++ b/source/gameengine/Expressions/intern/ListValue.cpp
@@ -290,7 +290,7 @@ static Py_ssize_t listvalue_bufferlen(PyObject *self)
CListValue *list= static_cast<CListValue *>(BGE_PROXY_REF(self));
if (list==NULL)
return 0;
-
+
return (Py_ssize_t)list->GetCount();
}
@@ -298,24 +298,24 @@ static PyObject *listvalue_buffer_item(PyObject *self, Py_ssize_t index)
{
CListValue *list= static_cast<CListValue *>(BGE_PROXY_REF(self));
CValue *cval;
-
+
if (list==NULL) {
PyErr_SetString(PyExc_SystemError, "val = CList[i], " BGE_PROXY_ERROR_MSG);
return NULL;
}
-
+
int count = list->GetCount();
-
+
if (index < 0)
index = count+index;
-
+
if (index < 0 || index >= count) {
PyErr_SetString(PyExc_IndexError, "CList[i]: Python ListIndex out of range in CValueList");
return NULL;
}
-
+
cval= list->GetValue(index);
-
+
PyObject *pyobj = cval->ConvertValueToPython();
if (pyobj)
return pyobj;
@@ -360,7 +360,7 @@ static PyObject *listvalue_mapping_subscript(PyObject *self, PyObject *key)
PyErr_SetString(PyExc_SystemError, "value = CList[i], " BGE_PROXY_ERROR_MSG);
return NULL;
}
-
+
if (PyUnicode_Check(key)) {
CValue *item = ((CListValue*) list)->FindValue(_PyUnicode_AsString(key));
if (item) {
@@ -403,37 +403,37 @@ static PyObject *listvalue_buffer_concat(PyObject *self, PyObject *other)
{
CListValue *listval= static_cast<CListValue *>(BGE_PROXY_REF(self));
Py_ssize_t i, numitems, numitems_orig;
-
+
if (listval==NULL) {
PyErr_SetString(PyExc_SystemError, "CList+other, " BGE_PROXY_ERROR_MSG);
return NULL;
}
-
+
numitems_orig= listval->GetCount();
-
+
// for now, we support CListValue concatenated with items
// and CListValue concatenated to Python Lists
// and CListValue concatenated with another CListValue
-
+
/* Shallow copy, don't use listval->GetReplica(), it will screw up with KX_GameObjects */
CListValue* listval_new = new CListValue();
-
+
if (PyList_Check(other))
{
CValue* listitemval;
bool error = false;
-
+
numitems = PyList_GET_SIZE(other);
-
+
/* copy the first part of the list */
listval_new->Resize(numitems_orig + numitems);
for (i=0;i<numitems_orig;i++)
listval_new->SetValue(i, listval->GetValue(i)->AddRef());
-
+
for (i=0;i<numitems;i++)
{
listitemval = listval->ConvertPythonToValue(PyList_GET_ITEM(other, i), true, "cList + pyList: CListValue, ");
-
+
if (listitemval) {
listval_new->SetValue(i+numitems_orig, listitemval);
} else {
@@ -441,13 +441,13 @@ static PyObject *listvalue_buffer_concat(PyObject *self, PyObject *other)
break;
}
}
-
+
if (error) {
listval_new->Resize(numitems_orig+i); /* resize so we don't try release NULL pointers */
listval_new->Release();
- return NULL; /* ConvertPythonToValue above sets the error */
+ return NULL; /* ConvertPythonToValue above sets the error */
}
-
+
}
else if (PyObject_TypeCheck(other, &CListValue::Type)) {
// add items from otherlist to this list
@@ -457,18 +457,18 @@ static PyObject *listvalue_buffer_concat(PyObject *self, PyObject *other)
PyErr_SetString(PyExc_SystemError, "CList+other, " BGE_PROXY_ERROR_MSG);
return NULL;
}
-
+
numitems = otherval->GetCount();
-
+
/* copy the first part of the list */
listval_new->Resize(numitems_orig + numitems); /* resize so we don't try release NULL pointers */
for (i=0;i<numitems_orig;i++)
listval_new->SetValue(i, listval->GetValue(i)->AddRef());
-
+
/* now copy the other part of the list */
for (i=0;i<numitems;i++)
listval_new->SetValue(i+numitems_orig, otherval->GetValue(i)->AddRef());
-
+
}
return listval_new->NewProxy(true); /* python owns this list */
}
@@ -476,12 +476,12 @@ static PyObject *listvalue_buffer_concat(PyObject *self, PyObject *other)
static int listvalue_buffer_contains(PyObject *self_v, PyObject *value)
{
CListValue *self = static_cast<CListValue *>(BGE_PROXY_REF(self_v));
-
+
if (self == NULL) {
PyErr_SetString(PyExc_SystemError, "val in CList, " BGE_PROXY_ERROR_MSG);
return -1;
}
-
+
if (PyUnicode_Check(value)) {
if (self->FindValue((const char *)_PyUnicode_AsString(value))) {
return 1;
@@ -492,9 +492,9 @@ static int listvalue_buffer_contains(PyObject *self_v, PyObject *value)
for (int i=0; i < self->GetCount(); i++)
if (self->GetValue(i) == item) // Com
return 1;
-
+
} // not using CheckEqual
-
+
return 0;
}
diff --git a/source/gameengine/Expressions/intern/Operator1Expr.cpp b/source/gameengine/Expressions/intern/Operator1Expr.cpp
index add0376f487..11bb2c06caf 100644
--- a/source/gameengine/Expressions/intern/Operator1Expr.cpp
+++ b/source/gameengine/Expressions/intern/Operator1Expr.cpp
@@ -63,7 +63,7 @@ ret: a new object containing the result of applying the operator m_op to the
ret = empty->Calc(m_op, temp);
empty->Release();
temp->Release();
-
+
return ret;
}
@@ -74,10 +74,10 @@ bool COperator1Expr::IsInside(float x, float y, float z,bool bBorderInclude)
bool result = true;
switch (m_op)
{
-
+
case VALUE_ADD_OPERATOR:
{
-
+
if (m_lhs)
{
result = result || m_lhs->IsInside(x,y,z,bBorderInclude);
@@ -116,7 +116,7 @@ CExpression* COperator1Expr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlink
// changed
//numchanges++;
newlhs->AddRef();
-
+
//m_lhs->Release();
brokenlinks.push_back(new CBrokenLinkInfo(&m_lhs,m_lhs));
@@ -129,7 +129,7 @@ CExpression* COperator1Expr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlink
return Release();
}
-
+
}
void COperator1Expr::BroadcastOperators(VALUE_OPERATOR op)
@@ -145,7 +145,7 @@ bool COperator1Expr::MergeExpression(CExpression *otherexpr)
{
if (m_lhs)
return m_lhs->MergeExpression(otherexpr);
-
+
assertd(false); // should not get here, expression is not compatible for merge
return false;
}
diff --git a/source/gameengine/Expressions/intern/Operator2Expr.cpp b/source/gameengine/Expressions/intern/Operator2Expr.cpp
index 0a7f30b8cc8..aaf6f49943d 100644
--- a/source/gameengine/Expressions/intern/Operator2Expr.cpp
+++ b/source/gameengine/Expressions/intern/Operator2Expr.cpp
@@ -28,7 +28,7 @@
//////////////////////////////////////////////////////////////////////
COperator2Expr::COperator2Expr(VALUE_OPERATOR op, CExpression *lhs, CExpression *rhs)
-:
+:
m_rhs(rhs),
m_lhs(lhs),
m_cached_calculate(NULL),
@@ -51,7 +51,7 @@ pre:
effect: constucts an empty COperator2Expr
*/
{
-
+
}
COperator2Expr::~COperator2Expr()
@@ -66,7 +66,7 @@ effect: deletes the object
m_rhs->Release();
if (m_cached_calculate)
m_cached_calculate->Release();
-
+
}
CValue* COperator2Expr::Calculate()
/*
@@ -75,11 +75,11 @@ ret: a new object containing the result of applying operator m_op to m_lhs
and m_rhs
*/
{
-
+
bool leftmodified,rightmodified;
leftmodified = m_lhs->NeedsRecalculated();
rightmodified = m_rhs->NeedsRecalculated();
-
+
// if no modifications on both left and right subtree, and result is already calculated
// then just return cached result...
if (!leftmodified && !rightmodified && (m_cached_calculate))
@@ -87,30 +87,30 @@ and m_rhs
// not modified, just return m_cached_calculate
} else {
// if not yet calculated, or modified...
-
-
+
+
if (m_cached_calculate) {
m_cached_calculate->Release();
m_cached_calculate=NULL;
}
-
+
CValue* ffleft = m_lhs->Calculate();
CValue* ffright = m_rhs->Calculate();
-
+
ffleft->SetOwnerExpression(this);//->m_pOwnerExpression=this;
ffright->SetOwnerExpression(this);//->m_pOwnerExpression=this;
-
+
m_cached_calculate = ffleft->Calc(m_op,ffright);
-
+
//if (m_cached_calculate)
// m_cached_calculate->Action(CValue::SETOWNEREXPR,&CVoidValue(this,false,CValue::STACKVALUE));
ffleft->Release();
ffright->Release();
}
-
+
return m_cached_calculate->AddRef();
-
+
}
#if 0
@@ -118,7 +118,7 @@ bool COperator2Expr::IsInside(float x, float y, float z,bool bBorderInclude)
{
bool inside;
inside = false;
-
+
switch (m_op) {
case VALUE_ADD_OPERATOR:
{
@@ -164,7 +164,7 @@ bool COperator2Expr::IsInside(float x, float y, float z,bool bBorderInclude)
// not yet implemented, only add or sub csg operations
}
}
-
+
return inside;
}
@@ -193,7 +193,7 @@ bool COperator2Expr::NeedsRecalculated()
return m_lhs->NeedsRecalculated();
//modleft = m_lhs->NeedsRecalculated();
//return (modleft || modright);
-
+
}
@@ -213,7 +213,7 @@ CExpression* COperator2Expr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlink
/*
if (m_cached_calculate)
m_cached_calculate->Action(CValue::REFRESH_CACHE);
-
+
CExpression* newlhs = m_lhs->CheckLink(brokenlinks);
CExpression* newrhs = m_rhs->CheckLink(brokenlinks);
@@ -235,11 +235,11 @@ CExpression* COperator2Expr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlink
if (m_lhs && m_rhs) {
return this;
}
-
+
AddRef();
- if (m_lhs)
+ if (m_lhs)
return Release(m_lhs->AddRef());
-
+
if (m_rhs)
return Release(m_rhs->AddRef());
/
diff --git a/source/gameengine/Expressions/intern/PyObjectPlus.cpp b/source/gameengine/Expressions/intern/PyObjectPlus.cpp
index 1e4a59aeb5c..317faac7fa9 100644
--- a/source/gameengine/Expressions/intern/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/intern/PyObjectPlus.cpp
@@ -38,9 +38,9 @@
* Derived from work by
* David Redish
* graduate student
- * Computer Science Department
+ * Computer Science Department
* Carnegie Mellon University (CMU)
- * Center for the Neural Basis of Cognition (CNBC)
+ * Center for the Neural Basis of Cognition (CNBC)
* http://www.python.org/doc/PyCPP.html
*
* ----------------------------- */
@@ -141,7 +141,7 @@ PyObject *PyObjectPlus::py_base_repr(PyObject *self) // This should be the ent
PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG);
return NULL;
}
- return self_plus->py_repr();
+ return self_plus->py_repr();
}
@@ -420,7 +420,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
return PyFloat_FromDouble(*val);
} else {
// vector, verify size
- if (attrdef->m_size != attrdef->m_imax*sizeof(float))
+ if (attrdef->m_size != attrdef->m_imax*sizeof(float))
{
return NULL;
}
@@ -437,7 +437,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
}
} else {
// matrix case
- if (attrdef->m_size != attrdef->m_imax*attrdef->m_imin*sizeof(float))
+ if (attrdef->m_size != attrdef->m_imax*attrdef->m_imin*sizeof(float))
{
return NULL;
}
@@ -530,11 +530,11 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
size_t bufferSize = 0;
PyObject *item = NULL; // to store object that must be dereferenced in case of error
PyObject *list = NULL; // to store object that must be dereferenced in case of error
-
+
ptr += attrdef->m_offset;
if (attrdef->m_length > 1)
{
- if (!PySequence_Check(value))
+ if (!PySequence_Check(value))
{
PyErr_Format(PyExc_TypeError, "expected a sequence for attribute \"%s\"", attrdef->m_name);
return PY_SET_ATTR_FAIL;
@@ -544,10 +544,10 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
PyErr_Format(PyExc_TypeError, "incorrect number of elements in sequence for attribute \"%s\"", attrdef->m_name);
return PY_SET_ATTR_FAIL;
}
- switch (attrdef->m_type)
+ switch (attrdef->m_type)
{
case KX_PYATTRIBUTE_TYPE_FUNCTION:
- if (attrdef->m_setFunction == NULL)
+ if (attrdef->m_setFunction == NULL)
{
PyErr_Format(PyExc_AttributeError, "function attribute without function for attribute \"%s\", report to blender.org", attrdef->m_name);
return PY_SET_ATTR_FAIL;
@@ -582,16 +582,16 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
for (int i=0; i<attrdef->m_length; i++)
{
item = PySequence_GetItem(value, i); /* new ref */
- switch (attrdef->m_type)
+ switch (attrdef->m_type)
{
case KX_PYATTRIBUTE_TYPE_BOOL:
{
bool *var = reinterpret_cast<bool*>(ptr);
ptr += sizeof(bool);
- if (PyLong_Check(item))
+ if (PyLong_Check(item))
{
*var = (PyLong_AsLong(item) != 0);
- }
+ }
else if (PyBool_Check(item))
{
*var = (item == Py_True);
@@ -607,7 +607,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
{
short int *var = reinterpret_cast<short int*>(ptr);
ptr += sizeof(short int);
- if (PyLong_Check(item))
+ if (PyLong_Check(item))
{
int val = PyLong_AsLong(item);
if (attrdef->m_clamp)
@@ -643,7 +643,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
{
int *var = reinterpret_cast<int*>(ptr);
ptr += sizeof(int);
- if (PyLong_Check(item))
+ if (PyLong_Check(item))
{
int val = PyLong_AsLong(item);
if (attrdef->m_clamp)
@@ -709,7 +709,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
// if the checing function didnt set an error then set a generic one here so we don't set an error with no exception
if (PyErr_Occurred()==0)
PyErr_Format(PyExc_AttributeError, "type check error for attribute \"%s\", reasion unknown", attrdef->m_name);
-
+
// post check returned an error, restore values
UNDO_AND_ERROR:
if (undoBuffer)
@@ -741,7 +741,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
{
// post check function is provided, prepare undo buffer
sourceBuffer = ptr;
- switch (attrdef->m_type)
+ switch (attrdef->m_type)
{
case KX_PYATTRIBUTE_TYPE_BOOL:
bufferSize = sizeof(bool);
@@ -785,16 +785,16 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
}
}
}
-
- switch (attrdef->m_type)
+
+ switch (attrdef->m_type)
{
case KX_PYATTRIBUTE_TYPE_BOOL:
{
bool *var = reinterpret_cast<bool*>(ptr);
- if (PyLong_Check(value))
+ if (PyLong_Check(value))
{
*var = (PyLong_AsLong(value) != 0);
- }
+ }
else if (PyBool_Check(value))
{
*var = (value == Py_True);
@@ -809,10 +809,10 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
case KX_PYATTRIBUTE_TYPE_FLAG:
{
bool bval;
- if (PyLong_Check(value))
+ if (PyLong_Check(value))
{
bval = (PyLong_AsLong(value) != 0);
- }
+ }
else if (PyBool_Check(value))
{
bval = (value == Py_True);
@@ -852,7 +852,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
case KX_PYATTRIBUTE_TYPE_SHORT:
{
short int *var = reinterpret_cast<short int*>(ptr);
- if (PyLong_Check(value))
+ if (PyLong_Check(value))
{
int val = PyLong_AsLong(value);
if (attrdef->m_clamp)
@@ -887,7 +887,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
case KX_PYATTRIBUTE_TYPE_INT:
{
int *var = reinterpret_cast<int*>(ptr);
- if (PyLong_Check(value))
+ if (PyLong_Check(value))
{
int val = PyLong_AsLong(value);
if (attrdef->m_clamp)
@@ -914,14 +914,14 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
case KX_PYATTRIBUTE_TYPE_FLOAT:
{
float *var = reinterpret_cast<float*>(ptr);
- if (attrdef->m_imin != 0)
+ if (attrdef->m_imin != 0)
{
- if (attrdef->m_size != attrdef->m_imin*attrdef->m_imax*sizeof(float))
+ if (attrdef->m_size != attrdef->m_imin*attrdef->m_imax*sizeof(float))
{
PyErr_Format(PyExc_TypeError, "internal error: incorrect field size for attribute \"%s\"", attrdef->m_name);
goto FREE_AND_ERROR;
}
- if (!PySequence_Check(value) || PySequence_Size(value) != attrdef->m_imin)
+ if (!PySequence_Check(value) || PySequence_Size(value) != attrdef->m_imin)
{
PyErr_Format(PyExc_TypeError, "expected a sequence of [%d][%d] floats for attribute \"%s\"", attrdef->m_imin, attrdef->m_imax, attrdef->m_name);
goto FREE_AND_ERROR;
@@ -929,7 +929,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
for (int i=0; i<attrdef->m_imin; i++)
{
PyObject *list = PySequence_GetItem(value, i); /* new ref */
- if (!PySequence_Check(list) || PySequence_Size(list) != attrdef->m_imax)
+ if (!PySequence_Check(list) || PySequence_Size(list) != attrdef->m_imax)
{
PyErr_Format(PyExc_TypeError, "expected a sequence of [%d][%d] floats for attribute \"%s\"", attrdef->m_imin, attrdef->m_imax, attrdef->m_name);
goto RESTORE_AND_ERROR;
@@ -949,15 +949,15 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
Py_DECREF(list);
list = NULL;
}
- }
- else if (attrdef->m_imax != 0)
+ }
+ else if (attrdef->m_imax != 0)
{
- if (attrdef->m_size != attrdef->m_imax*sizeof(float))
+ if (attrdef->m_size != attrdef->m_imax*sizeof(float))
{
PyErr_Format(PyExc_TypeError, "internal error: incorrect field size for attribute \"%s\"", attrdef->m_name);
goto FREE_AND_ERROR;
}
- if (!PySequence_Check(value) || PySequence_Size(value) != attrdef->m_imax)
+ if (!PySequence_Check(value) || PySequence_Size(value) != attrdef->m_imax)
{
PyErr_Format(PyExc_TypeError, "expected a sequence of [%d] floats for attribute \"%s\"", attrdef->m_imax, attrdef->m_name);
goto FREE_AND_ERROR;
@@ -973,7 +973,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
item = NULL;
++var;
}
- }
+ }
else
{
if (!py_check_attr_float(var, value, attrdef))
@@ -983,7 +983,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
}
case KX_PYATTRIBUTE_TYPE_VECTOR:
{
- if (!PySequence_Check(value) || PySequence_Size(value) != 3)
+ if (!PySequence_Check(value) || PySequence_Size(value) != 3)
{
PyErr_Format(PyExc_TypeError, "expected a sequence of 3 floats for attribute \"%s\"", attrdef->m_name);
goto FREE_AND_ERROR;
@@ -1018,7 +1018,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
}
case KX_PYATTRIBUTE_TYPE_CHAR:
{
- if (PyUnicode_Check(value))
+ if (PyUnicode_Check(value))
{
Py_ssize_t val_size;
const char *val = _PyUnicode_AsStringAndSize(value, &val_size);
@@ -1035,7 +1035,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
case KX_PYATTRIBUTE_TYPE_STRING:
{
STR_String *var = reinterpret_cast<STR_String*>(ptr);
- if (PyUnicode_Check(value))
+ if (PyUnicode_Check(value))
{
Py_ssize_t val_len;
const char *val = _PyUnicode_AsStringAndSize(value, &val_len); /* XXX, should be 'const' but we do a silly trick to have a shorter string */
@@ -1134,7 +1134,7 @@ PyObject *PyObjectPlus::GetProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v
}
//PyObject_Print(self->m_proxy, stdout, 0);
//printf("ref %d\n", self->m_proxy->ob_refcnt);
-
+
BGE_PROXY_REF(self->m_proxy) = self; /* Its possible this was set to NULL, so set it back here */
BGE_PROXY_PTR(self->m_proxy) = ptr;
Py_INCREF(self->m_proxy); /* we own one, thos ones fore the return */
@@ -1143,13 +1143,13 @@ PyObject *PyObjectPlus::GetProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v
PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, void *ptr, bool py_owns)
{
- if (!self)
+ if (!self)
{
// in case of proxy without reference to game object
PyObject *proxy = reinterpret_cast<PyObject *>PyObject_NEW( PyObjectPlus_Proxy, tp);
BGE_PROXY_PYREF(proxy) = false;
BGE_PROXY_PYOWNS(proxy) = py_owns;
- BGE_PROXY_REF(proxy) = NULL;
+ BGE_PROXY_REF(proxy) = NULL;
BGE_PROXY_PTR(proxy) = ptr;
#ifdef USE_WEAKREFS
BGE_PROXY_WKREF(proxy) = NULL;
@@ -1168,9 +1168,9 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v
Py_INCREF(self->m_proxy);
return self->m_proxy;
}
-
+
}
-
+
GetProxyPlus_Ext(self, tp, ptr);
if (py_owns) {
BGE_PROXY_PYOWNS(self->m_proxy) = py_owns;
@@ -1204,7 +1204,7 @@ void PyObjectPlus::ClearDeprecationWarning()
{
WarnLink *wlink_next;
WarnLink *wlink = GetDeprecationWarningLinkFirst();
-
+
while (wlink) {
wlink->warn_done= false; /* no need to NULL the link, its cleared before adding to the list next time round */
wlink_next= reinterpret_cast<WarnLink *>(wlink->link);
diff --git a/source/gameengine/Expressions/intern/StringValue.cpp b/source/gameengine/Expressions/intern/StringValue.cpp
index ddf61dc441c..8b979b2af0c 100644
--- a/source/gameengine/Expressions/intern/StringValue.cpp
+++ b/source/gameengine/Expressions/intern/StringValue.cpp
@@ -41,14 +41,14 @@ CStringValue::CStringValue(const char *txt,const char *name,AllocationTYPE alloc
{
m_strString = txt;
SetName(name);
-
+
if (alloctype==CValue::STACKVALUE)
{
CValue::DisableRefCount();
-
+
}
-
-
+
+
}
@@ -71,7 +71,7 @@ CValue* CStringValue::Calc(VALUE_OPERATOR op, CValue *val)
CValue* CStringValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val)
{
CValue *ret;
-
+
if (op == VALUE_ADD_OPERATOR) {
if (dtype == VALUE_ERROR_TYPE)
ret = new CErrorValue(val->GetText() + op2str(op) + GetText());
@@ -138,7 +138,7 @@ bool CStringValue::IsEqual(const STR_String & other)
}
CValue* CStringValue::GetReplica()
-{
+{
CStringValue* replica = new CStringValue(*this);
replica->ProcessReplica();
return replica;
diff --git a/source/gameengine/Expressions/intern/Value.cpp b/source/gameengine/Expressions/intern/Value.cpp
index f8796a76e76..9b42bdb7bff 100644
--- a/source/gameengine/Expressions/intern/Value.cpp
+++ b/source/gameengine/Expressions/intern/Value.cpp
@@ -70,7 +70,7 @@ PyMethodDef CValue::Methods[] = {
/*#define CVALUE_DEBUG*/
#ifdef CVALUE_DEBUG
int gRefCount;
-struct SmartCValueRef
+struct SmartCValueRef
{
CValue *m_ref;
int m_count;
@@ -92,7 +92,7 @@ std::vector<SmartCValueRef> gRefList;
CValue::CValue()
: PyObjectPlus(),
-
+
m_pNamedPropertyArray(NULL),
m_refcount(1)
/*
@@ -148,7 +148,7 @@ STR_String CValue::op2str(VALUE_OPERATOR op)
{
//pre:
//ret: the stringrepresentation of operator op
-
+
STR_String opmsg;
switch (op) {
case VALUE_MOD_OPERATOR:
@@ -225,7 +225,7 @@ void CValue::SetProperty(const STR_String & name,CValue* ioProperty)
else { // Make sure we have a property array
m_pNamedPropertyArray = new std::map<STR_String,CValue *>;
}
-
+
// Add property at end of array
(*m_pNamedPropertyArray)[name] = ioProperty->AddRef();//->Add(ioProperty);
}
@@ -247,7 +247,7 @@ void CValue::SetProperty(const char* name,CValue* ioProperty)
else { // Make sure we have a property array
m_pNamedPropertyArray = new std::map<STR_String,CValue *>;
}
-
+
// Add property at end of array
(*m_pNamedPropertyArray)[name] = ioProperty->AddRef();//->Add(ioProperty);
}
@@ -293,7 +293,7 @@ float CValue::GetPropertyNumber(const STR_String& inName,float defnumber)
{
CValue *property = GetProperty(inName);
if (property)
- return property->GetNumber();
+ return property->GetNumber();
else
return defnumber;
}
@@ -316,7 +316,7 @@ bool CValue::RemoveProperty(const char *inName)
return true;
}
}
-
+
return false;
}
@@ -328,7 +328,7 @@ vector<STR_String> CValue::GetPropertyNames()
vector<STR_String> result;
if (!m_pNamedPropertyArray) return result;
result.reserve(m_pNamedPropertyArray->size());
-
+
std::map<STR_String,CValue*>::iterator it;
for (it= m_pNamedPropertyArray->begin(); (it != m_pNamedPropertyArray->end()); it++)
{
@@ -369,7 +369,7 @@ void CValue::SetPropertiesModified(bool inModified)
{
if (!m_pNamedPropertyArray) return;
std::map<STR_String,CValue*>::iterator it;
-
+
for (it= m_pNamedPropertyArray->begin();(it != m_pNamedPropertyArray->end()); it++)
((*it).second)->SetModified(inModified);
}
@@ -383,11 +383,11 @@ bool CValue::IsAnyPropertyModified()
{
if (!m_pNamedPropertyArray) return false;
std::map<STR_String,CValue*>::iterator it;
-
+
for (it= m_pNamedPropertyArray->begin();(it != m_pNamedPropertyArray->end()); it++)
if (((*it).second)->IsModified())
return true;
-
+
return false;
}
@@ -471,7 +471,7 @@ void CValue::DisableRefCount()
void CValue::ProcessReplica() /* was AddDataToReplica in 2.48 */
{
m_refcount = 1;
-
+
#ifdef DEBUG
//gRefCountValue++;
#endif
@@ -518,7 +518,7 @@ CValue* CValue::FindIdentifier(const STR_String& identifiername)
if (tempresult)
{
result=tempresult->FindIdentifier(rightstring);
- }
+ }
} else
{
result = GetProperty(identifiername);
@@ -666,7 +666,7 @@ void CValue::SetColorOperator(VALUE_OPERATOR op)
/* intentionally empty */
}
void CValue::SetValue(CValue* newval)
-{
+{
// no one should get here
assertd(newval->GetNumber() == 10121969);
}
diff --git a/source/gameengine/Expressions/intern/VectorValue.cpp b/source/gameengine/Expressions/intern/VectorValue.cpp
index a3d44116317..dcb1f11ad1a 100644
--- a/source/gameengine/Expressions/intern/VectorValue.cpp
+++ b/source/gameengine/Expressions/intern/VectorValue.cpp
@@ -36,51 +36,51 @@
CVectorValue::CVectorValue(float x,float y,float z, AllocationTYPE alloctype)
{
SetCustomFlag1(false);//FancyOutput=false;
-
+
if (alloctype == STACKVALUE)
{
CValue::DisableRefCount();
};
-
+
m_vec[KX_X] = m_transformedvec[KX_X] = x;
m_vec[KX_Y] = m_transformedvec[KX_Y] = y;
m_vec[KX_Z] = m_transformedvec[KX_Z] = z;
-
+
}
CVectorValue::CVectorValue(double vec[3], const char *name,AllocationTYPE alloctype)
{
-
+
SetCustomFlag1(false);//FancyOutput=false;
-
+
m_vec[KX_X] = m_transformedvec[KX_X] = vec[KX_X];
m_vec[KX_Y] = m_transformedvec[KX_Y] = vec[KX_Y];
m_vec[KX_Z] = m_transformedvec[KX_Z] = vec[KX_Z];
-
+
if (alloctype == STACKVALUE)
{
CValue::DisableRefCount();
-
+
}
-
+
SetName(name);
}
CVectorValue::CVectorValue(double vec[3], AllocationTYPE alloctype)
{
-
+
SetCustomFlag1(false);//FancyOutput=false;
-
+
m_vec[KX_X] = m_transformedvec[KX_X] = vec[KX_X];
m_vec[KX_Y] = m_transformedvec[KX_Y] = vec[KX_Y];
m_vec[KX_Z] = m_transformedvec[KX_Z] = vec[KX_Z];
-
+
if (alloctype == STACKVALUE)
{
CValue::DisableRefCount();
-
+
}
-
-
+
+
}
CVectorValue::~CVectorValue()
{
@@ -95,7 +95,7 @@ CVectorValue::~CVectorValue()
CValue* CVectorValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val)
{
CValue *ret = NULL;
-
+
switch (op) {
case VALUE_ADD_OPERATOR:
{
@@ -122,7 +122,7 @@ CValue* CVectorValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue
{
switch (dtype)
{
-
+
case VALUE_EMPTY_TYPE:
case VALUE_VECTOR_TYPE:
{
@@ -152,7 +152,7 @@ CValue* CVectorValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue
ret = new CErrorValue(val->GetText() + op2str(op) + GetText());
}
-
+
return ret;
}
@@ -174,7 +174,7 @@ double* CVectorValue::GetVector3(bool bGetTransformedVec)
{
if (bGetTransformedVec)
return m_transformedvec;
- // else
+ // else
return m_vec;
}
@@ -187,19 +187,19 @@ void CVectorValue::SetVector(double newvec[])
m_vec[KX_X] = m_transformedvec[KX_X] = newvec[KX_X];
m_vec[KX_Y] = m_transformedvec[KX_Y] = newvec[KX_Y];
m_vec[KX_Z] = m_transformedvec[KX_Z] = newvec[KX_Z];
-
+
SetModified(true);
}
void CVectorValue::SetValue(CValue *newval)
{
-
+
double* newvec = ((CVectorValue*)newval)->GetVector3();
m_vec[KX_X] = m_transformedvec[KX_X] = newvec[KX_X];
m_vec[KX_Y] = m_transformedvec[KX_Y] = newvec[KX_Y];
m_vec[KX_Z] = m_transformedvec[KX_Z] = newvec[KX_Z];
-
+
SetModified(true);
}