diff options
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Expressions/FloatValue.cpp | 9 | ||||
-rw-r--r-- | source/gameengine/Expressions/IntValue.cpp | 9 | ||||
-rw-r--r-- | source/gameengine/GameLogic/SCA_JoystickSensor.cpp | 2 | ||||
-rw-r--r-- | source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 12 | ||||
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsController.cpp | 30 |
5 files changed, 55 insertions, 7 deletions
diff --git a/source/gameengine/Expressions/FloatValue.cpp b/source/gameengine/Expressions/FloatValue.cpp index b7d7f528155..0f468e328ed 100644 --- a/source/gameengine/Expressions/FloatValue.cpp +++ b/source/gameengine/Expressions/FloatValue.cpp @@ -97,7 +97,7 @@ ret: a new object containing the result of applying operator op to this return new CFloatValue (-m_float); break; case VALUE_NOT_OPERATOR: - return new CErrorValue (op2str(op) + "only allowed on booleans"); + return new CBoolValue (m_float == 0.f); break; case VALUE_AND_OPERATOR: case VALUE_OR_OPERATOR: @@ -160,6 +160,9 @@ ret: a new object containing the result of applying operator op to val and case VALUE_LEQ_OPERATOR: ret = new CBoolValue(((CIntValue *) val)->GetInt() <= m_float); break; + case VALUE_NOT_OPERATOR: + ret = new CBoolValue(m_float == 0); + break; default: ret = new CErrorValue("illegal operator. please send a bug report."); break; @@ -212,7 +215,9 @@ ret: a new object containing the result of applying operator op to val and case VALUE_POS_OPERATOR: ret = new CFloatValue (m_float); break; - + case VALUE_NOT_OPERATOR: + ret = new CBoolValue(m_float == 0); + break; default: ret = new CErrorValue("illegal operator. please send a bug report."); break; diff --git a/source/gameengine/Expressions/IntValue.cpp b/source/gameengine/Expressions/IntValue.cpp index 2cacea98467..fa4c9ad8ac9 100644 --- a/source/gameengine/Expressions/IntValue.cpp +++ b/source/gameengine/Expressions/IntValue.cpp @@ -96,7 +96,7 @@ object and val return new CIntValue (-m_int); break; case VALUE_NOT_OPERATOR: - return new CErrorValue (op2str(op) + "only allowed on booleans"); + return new CBoolValue (m_int == 0); break; case VALUE_AND_OPERATOR: case VALUE_OR_OPERATOR: @@ -170,7 +170,11 @@ CValue* CIntValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *v case VALUE_POS_OPERATOR: ret = new CIntValue (m_int); break; + case VALUE_NOT_OPERATOR: + ret = new CBoolValue(m_int == 0); + break; default: + printf("Found op: %d\n", op); ret = new CErrorValue("illegal operator. please send a bug report."); break; } @@ -215,6 +219,9 @@ CValue* CIntValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *v case VALUE_LEQ_OPERATOR: ret = new CBoolValue(((CFloatValue *) val)->GetFloat() <= m_int); break; + case VALUE_NOT_OPERATOR: + ret = new CBoolValue(m_int == 0); + break; default: ret = new CErrorValue("illegal operator. please send a bug report."); break; diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp index c7e31f75306..3cae3bcf160 100644 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp @@ -367,7 +367,7 @@ PyObject *SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYAT SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); if (self->m_joymode != KX_JOYSENSORMODE_AXIS_SINGLE) { - PyErr_SetString(PyExc_TypeError, "val = sensor.axisSingle: Joystick Sensor, not 'Single Axis' type"); + PyErr_SetString(PyExc_AttributeError, "val = sensor.axisSingle: Joystick Sensor, not 'Single Axis' type"); return NULL; } diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 2c642d4bd04..f1edb71f4fe 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -1031,10 +1031,9 @@ int main(int argc, char** argv) * removal is needed else the system will free an already freed value */ system->removeEventConsumer(&app); - /* nodesystem relies on blendfile data, free it first */ - free_nodesystem(); - BLO_blendfiledata_free(bfd); + /* G.main == bfd->main, it gets referenced in free_nodesystem so we can't have a dangling pointer */ + G.main = NULL; if (python_main) MEM_freeN(python_main); } } while (exitcode == KX_EXIT_REQUEST_RESTART_GAME || exitcode == KX_EXIT_REQUEST_START_OTHER_GAME); @@ -1052,6 +1051,13 @@ int main(int argc, char** argv) } } + /* refer to WM_exit_ext() and free_blender(), + * these are not called in the player but we need to match some of there behavior here, + * if the order of function calls or blenders state isn't matching that of blender proper, + * we may get troubles later on */ + + free_nodesystem(); + // Cleanup RNA_exit(); BLF_exit(); diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index b389347cdb0..0604157a420 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -1587,6 +1587,21 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, if (mf->v4 && vert_tag_array[mf->v4] == false) {vert_tag_array[mf->v4] = true; tot_bt_verts++;} } } + + /* Can happen with ngons */ + if (!tot_bt_verts) { + m_shapeType = PHY_SHAPE_NONE; + m_meshObject = NULL; + m_vertexArray.clear(); + m_polygonIndexArray.clear(); + m_triFaceArray.clear(); + m_triFaceUVcoArray.clear(); + if (free_dm) { + dm->release(dm); + dm = NULL; + } + return false; + } m_vertexArray.resize(tot_bt_verts*3); @@ -1662,6 +1677,21 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, } } + /* Can happen with ngons */ + if (!tot_bt_verts) { + m_shapeType = PHY_SHAPE_NONE; + m_meshObject = NULL; + m_vertexArray.clear(); + m_polygonIndexArray.clear(); + m_triFaceArray.clear(); + m_triFaceUVcoArray.clear(); + if (free_dm) { + dm->release(dm); + dm = NULL; + } + return false; + } + m_vertexArray.resize(tot_bt_verts*3); m_polygonIndexArray.resize(tot_bt_tris); m_triFaceArray.resize(tot_bt_tris*3); |