use defines for property name lenghths in the BGE, were using 31,32,64,100.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 16 Jan 2012 05:27:11 +0000 (05:27 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 16 Jan 2012 05:27:11 +0000 (05:27 +0000)
18 files changed:
source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Converter/BL_ShapeActionActuator.cpp
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
source/gameengine/Expressions/PyObjectPlus.h
source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
source/gameengine/GameLogic/SCA_ILogicBrick.h
source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
source/gameengine/GameLogic/SCA_KeyboardSensor.h
source/gameengine/GameLogic/SCA_PropertyActuator.cpp
source/gameengine/GameLogic/SCA_PropertySensor.cpp
source/gameengine/GameLogic/SCA_RandomActuator.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
source/gameengine/Ketsji/KX_ConstraintActuator.cpp
source/gameengine/Ketsji/KX_IpoActuator.cpp
source/gameengine/Ketsji/KX_RaySensor.cpp
source/gameengine/Ketsji/KX_SceneActuator.cpp
source/gameengine/Ketsji/KX_TouchSensor.cpp
source/gameengine/Rasterizer/RAS_TexVert.cpp

index 2aab04987655ba58f824c5cf20865eaabb7d1cd3..c63b32830b005d9e633e43083f54b61604a01e45 100644 (file)
@@ -526,8 +526,8 @@ PyAttributeDef BL_ActionActuator::Attributes[] = {
        KX_PYATTRIBUTE_RO_FUNCTION("channelNames", BL_ActionActuator, pyattr_get_channel_names),
        KX_PYATTRIBUTE_SHORT_RW("priority", 0, 100, false, BL_ActionActuator, m_priority),
        KX_PYATTRIBUTE_RW_FUNCTION("frame", BL_ActionActuator, pyattr_get_frame, pyattr_set_frame),
-       KX_PYATTRIBUTE_STRING_RW("propName", 0, 31, false, BL_ActionActuator, m_propname),
-       KX_PYATTRIBUTE_STRING_RW("framePropName", 0, 31, false, BL_ActionActuator, m_framepropname),
+       KX_PYATTRIBUTE_STRING_RW("propName", 0, MAX_PROP_NAME, false, BL_ActionActuator, m_propname),
+       KX_PYATTRIBUTE_STRING_RW("framePropName", 0, MAX_PROP_NAME, false, BL_ActionActuator, m_framepropname),
        KX_PYATTRIBUTE_RW_FUNCTION("useContinue", BL_ActionActuator, pyattr_get_use_continue, pyattr_set_use_continue),
        KX_PYATTRIBUTE_FLOAT_RW_CHECK("blendTime", 0, MAXFRAMEF, BL_ActionActuator, m_blendframe, CheckBlendTime),
        KX_PYATTRIBUTE_SHORT_RW_CHECK("mode",0,100,false,BL_ActionActuator,m_playtype,CheckType),
index aa62479d420420a63c8e021a968491e4d92f6337..d679d1a57927afdf5d11bdb73287081abf7b9db9 100644 (file)
@@ -519,8 +519,8 @@ PyAttributeDef BL_ShapeActionActuator::Attributes[] = {
        KX_PYATTRIBUTE_RW_FUNCTION("action", BL_ShapeActionActuator, pyattr_get_action, pyattr_set_action),
        KX_PYATTRIBUTE_SHORT_RW("priority", 0, 100, false, BL_ShapeActionActuator, m_priority),
        KX_PYATTRIBUTE_FLOAT_RW_CHECK("frame", 0, MAXFRAMEF, BL_ShapeActionActuator, m_localtime, CheckFrame),
-       KX_PYATTRIBUTE_STRING_RW("propName", 0, 31, false, BL_ShapeActionActuator, m_propname),
-       KX_PYATTRIBUTE_STRING_RW("framePropName", 0, 31, false, BL_ShapeActionActuator, m_framepropname),
+       KX_PYATTRIBUTE_STRING_RW("propName", 0, MAX_PROP_NAME, false, BL_ShapeActionActuator, m_propname),
+       KX_PYATTRIBUTE_STRING_RW("framePropName", 0, MAX_PROP_NAME, false, BL_ShapeActionActuator, m_framepropname),
        KX_PYATTRIBUTE_FLOAT_RW_CHECK("blendTime", 0, MAXFRAMEF, BL_ShapeActionActuator, m_blendframe, CheckBlendTime),
        KX_PYATTRIBUTE_SHORT_RW_CHECK("mode",0,100,false,BL_ShapeActionActuator,m_playtype,CheckType),
        { NULL }        //Sentinel
index 4fe436d634c7080f6a13a9f20b8985bd19c599f5..bed9e5380907eb7dc0735bbaed4d9508033f86f6 100644 (file)
@@ -888,11 +888,11 @@ void      KX_BlenderSceneConverter::TestHandlesPhysicsObjectToAnimationIpo()
                        {
                                //KX_IPhysicsController* physCtrl = gameObj->GetPhysicsController();
                                
+#if 0
                                Object* blenderObject = gameObj->GetBlenderObject();
                                if (blenderObject && blenderObject->ipo)
                                {
                                        // XXX animato
-#if 0
                                        Ipo* ipo = blenderObject->ipo;
                                        
                                        //create the curves, if not existing
@@ -903,17 +903,11 @@ void      KX_BlenderSceneConverter::TestHandlesPhysicsObjectToAnimationIpo()
                                        testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"RotX"));
                                        testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"RotY"));
                                        testhandles_ipocurve(findIpoCurve((IpoCurve *)ipo->curve.first,"RotZ"));
-#endif
                                }
+#endif
                        }
-
                }
-               
-       
        }
-
-
-
 }
 
 #ifdef WITH_PYTHON
index b1072dd8336d99eb9e729976f6d9ba9d82f8204d..107ae453c8e7a63776bc37bb0b93a06005b50438 100644 (file)
@@ -54,6 +54,8 @@ extern "C" {
 }
 #endif
 
+#define MAX_PROP_NAME 64
+
 static inline void Py_Fatal(const char *M)
 {
        fprintf(stderr, "%s\n", M);
index 8b0ea2394c83137070d6d7cf64393188452aa758..8b7702228ce609e3ad658ae93a3d0b5ed47a5516 100644 (file)
@@ -150,7 +150,7 @@ PyMethodDef SCA_ActuatorSensor::Methods[] = {
 };
 
 PyAttributeDef SCA_ActuatorSensor::Attributes[] = {
-       KX_PYATTRIBUTE_STRING_RW_CHECK("actuator",0,100,false,SCA_ActuatorSensor,m_checkactname,CheckActuator),
+       KX_PYATTRIBUTE_STRING_RW_CHECK("actuator",0,MAX_PROP_NAME,false,SCA_ActuatorSensor,m_checkactname,CheckActuator),
        { NULL }        //Sentinel
 };
 
index 87b37a8ef393bbb4473d8eeb2755c122661555cc..051bc2aafceb26280e72c470c8f0b0f8da516528 100644 (file)
@@ -133,8 +133,8 @@ public:
 
 
        /* for moving logic bricks between scenes */
-       virtual void            Replace_IScene(SCA_IScene *val) {};
-       virtual void            Replace_NetworkScene(NG_NetworkScene *val) {};
+       virtual void            Replace_IScene(SCA_IScene *val) {}
+       virtual void            Replace_NetworkScene(NG_NetworkScene *val) {}
 
 #ifdef WITH_PYTHON
        // python methods
index 45780735c4970b204baa266407416b568671f7d9..97cd01dff3889a203d59142384a059c4532e22ab 100644 (file)
@@ -479,8 +479,8 @@ PyAttributeDef SCA_KeyboardSensor::Attributes[] = {
        KX_PYATTRIBUTE_INT_RW("key",0,SCA_IInputDevice::KX_ENDKEY,true,SCA_KeyboardSensor,m_hotkey),
        KX_PYATTRIBUTE_SHORT_RW("hold1",0,SCA_IInputDevice::KX_ENDKEY,true,SCA_KeyboardSensor,m_qual),
        KX_PYATTRIBUTE_SHORT_RW("hold2",0,SCA_IInputDevice::KX_ENDKEY,true,SCA_KeyboardSensor,m_qual2),
-       KX_PYATTRIBUTE_STRING_RW("toggleProperty",0,100,false,SCA_KeyboardSensor,m_toggleprop),
-       KX_PYATTRIBUTE_STRING_RW("targetProperty",0,100,false,SCA_KeyboardSensor,m_targetprop),
+       KX_PYATTRIBUTE_STRING_RW("toggleProperty",0,MAX_PROP_NAME,false,SCA_KeyboardSensor,m_toggleprop),
+       KX_PYATTRIBUTE_STRING_RW("targetProperty",0,MAX_PROP_NAME,false,SCA_KeyboardSensor,m_targetprop),
        { NULL }        //Sentinel
 };
 
index e7283978ae14523968aaaa031fd74c466db26746..441c833d3a870b9e508c57cfd0fa3e8dbb7866b8 100644 (file)
@@ -111,7 +111,7 @@ public:
        /* --------------------------------------------------------------------- */
 
        // KeyEvents: 
-       KX_PYMETHOD_DOC_NOARGS(SCA_KeyboardSensor,getEventList); 
+       KX_PYMETHOD_DOC_NOARGS(SCA_KeyboardSensor,getEventList);
        // KeyStatus: 
        KX_PYMETHOD_DOC_O(SCA_KeyboardSensor,getKeyStatus);
        
index 844cf7ae96dca83dbb1c9a9cd3a65448f97a79a2..544b1da76af1b03b3cf7f162ca79b2828505088a 100644 (file)
@@ -257,7 +257,7 @@ PyMethodDef SCA_PropertyActuator::Methods[] = {
 };
 
 PyAttributeDef SCA_PropertyActuator::Attributes[] = {
-       KX_PYATTRIBUTE_STRING_RW_CHECK("propName",0,100,false,SCA_PropertyActuator,m_propname,CheckProperty),
+       KX_PYATTRIBUTE_STRING_RW_CHECK("propName",0,MAX_PROP_NAME,false,SCA_PropertyActuator,m_propname,CheckProperty),
        KX_PYATTRIBUTE_STRING_RW("value",0,100,false,SCA_PropertyActuator,m_exprtxt),
        KX_PYATTRIBUTE_INT_RW("mode", KX_ACT_PROP_NODEF+1, KX_ACT_PROP_MAX-1, false, SCA_PropertyActuator, m_type), /* ATTR_TODO add constents to game logic dict */
        { NULL }        //Sentinel
index e1ee6c75b95a673e18d8a0f414c6d7216f4bada8..8e324bbb0d71c267a0f02e57bcf5177ecb7b7b9f 100644 (file)
@@ -377,7 +377,7 @@ PyMethodDef SCA_PropertySensor::Methods[] = {
 
 PyAttributeDef SCA_PropertySensor::Attributes[] = {
        KX_PYATTRIBUTE_INT_RW_CHECK("mode",KX_PROPSENSOR_NODEF,KX_PROPSENSOR_MAX-1,false,SCA_PropertySensor,m_checktype,modeChange),
-       KX_PYATTRIBUTE_STRING_RW_CHECK("propName",0,100,false,SCA_PropertySensor,m_checkpropname,CheckProperty),
+       KX_PYATTRIBUTE_STRING_RW_CHECK("propName",0,MAX_PROP_NAME,false,SCA_PropertySensor,m_checkpropname,CheckProperty),
        KX_PYATTRIBUTE_STRING_RW_CHECK("value",0,100,false,SCA_PropertySensor,m_checkpropval,validValueForProperty),
        KX_PYATTRIBUTE_STRING_RW_CHECK("min",0,100,false,SCA_PropertySensor,m_checkpropval,validValueForIntervalProperty),
        KX_PYATTRIBUTE_STRING_RW_CHECK("max",0,100,false,SCA_PropertySensor,m_checkpropmaxval,validValueForIntervalProperty),
index 430326cbce083800cb90000acebe66bf29da6108..59925f4404031fd968ec8c6c364a5b6a19f725d4 100644 (file)
@@ -361,7 +361,7 @@ PyAttributeDef SCA_RandomActuator::Attributes[] = {
        KX_PYATTRIBUTE_FLOAT_RO("para1",SCA_RandomActuator,m_parameter1),
        KX_PYATTRIBUTE_FLOAT_RO("para2",SCA_RandomActuator,m_parameter2),
        KX_PYATTRIBUTE_ENUM_RO("distribution",SCA_RandomActuator,m_distribution),
-       KX_PYATTRIBUTE_STRING_RW_CHECK("propName",0,100,false,SCA_RandomActuator,m_propname,CheckProperty),
+       KX_PYATTRIBUTE_STRING_RW_CHECK("propName",0,MAX_PROP_NAME,false,SCA_RandomActuator,m_propname,CheckProperty),
        KX_PYATTRIBUTE_RW_FUNCTION("seed",SCA_RandomActuator,pyattr_get_seed,pyattr_set_seed),
        { NULL }        //Sentinel
 };     
index 5d5f3ff3f87a228cabeee5c2a02259a7ba96fd68..9d5a6907c46df5c9fa5927143beb63fb0c1553b5 100644 (file)
@@ -129,7 +129,7 @@ PyMethodDef KX_NetworkMessageActuator::Methods[] = {
 };
 
 PyAttributeDef KX_NetworkMessageActuator::Attributes[] = {
-       KX_PYATTRIBUTE_STRING_RW("propName", 0, 100, false, KX_NetworkMessageActuator, m_toPropName),
+       KX_PYATTRIBUTE_STRING_RW("propName", 0, MAX_PROP_NAME, false, KX_NetworkMessageActuator, m_toPropName),
        KX_PYATTRIBUTE_STRING_RW("subject", 0, 100, false, KX_NetworkMessageActuator, m_subject),
        KX_PYATTRIBUTE_BOOL_RW("usePropBody", KX_NetworkMessageActuator, m_bPropBody),
        KX_PYATTRIBUTE_STRING_RW("body", 0, 16384, false, KX_NetworkMessageActuator, m_body),
index ea3a64d0d73d890c0bba42a9a17b0c6e73e2f369..da8df24d7047cf710e30818e1c36e54e92c3af11 100644 (file)
@@ -600,7 +600,7 @@ PyAttributeDef KX_ConstraintActuator::Attributes[] = {
        KX_PYATTRIBUTE_FLOAT_ARRAY_RW_CHECK("direction",-FLT_MAX,FLT_MAX,KX_ConstraintActuator,m_refDirection,3,pyattr_check_direction),
        KX_PYATTRIBUTE_INT_RW("option",0,0xFFFF,false,KX_ConstraintActuator,m_option),
        KX_PYATTRIBUTE_INT_RW("time",0,1000,true,KX_ConstraintActuator,m_activeTime),
-       KX_PYATTRIBUTE_STRING_RW("propName",0,32,true,KX_ConstraintActuator,m_property),
+       KX_PYATTRIBUTE_STRING_RW("propName",0,MAX_PROP_NAME,true,KX_ConstraintActuator,m_property),
        KX_PYATTRIBUTE_FLOAT_RW("min",-FLT_MAX,FLT_MAX,KX_ConstraintActuator,m_minimumBound),
        KX_PYATTRIBUTE_FLOAT_RW("distance",-FLT_MAX,FLT_MAX,KX_ConstraintActuator,m_minimumBound),
        KX_PYATTRIBUTE_FLOAT_RW("max",-FLT_MAX,FLT_MAX,KX_ConstraintActuator,m_maximumBound),
index 878bdcedfda091ce990d91db0966617a62d6119d..e0cd9726104a0f950a0bf48f8fd0d71a94ec9152 100644 (file)
@@ -442,8 +442,8 @@ PyMethodDef KX_IpoActuator::Methods[] = {
 PyAttributeDef KX_IpoActuator::Attributes[] = {
        KX_PYATTRIBUTE_RW_FUNCTION("frameStart", KX_IpoActuator, pyattr_get_frame_start, pyattr_set_frame_start),
        KX_PYATTRIBUTE_RW_FUNCTION("frameEnd", KX_IpoActuator, pyattr_get_frame_end, pyattr_set_frame_end),
-       KX_PYATTRIBUTE_STRING_RW("propName", 0, 64, false, KX_IpoActuator, m_propname),
-       KX_PYATTRIBUTE_STRING_RW("framePropName", 0, 64, false, KX_IpoActuator, m_framepropname),
+       KX_PYATTRIBUTE_STRING_RW("propName", 0, MAX_PROP_NAME, false, KX_IpoActuator, m_propname),
+       KX_PYATTRIBUTE_STRING_RW("framePropName", 0, MAX_PROP_NAME, false, KX_IpoActuator, m_framepropname),
        KX_PYATTRIBUTE_INT_RW("mode", KX_ACT_IPO_NODEF+1, KX_ACT_IPO_MAX-1, true, KX_IpoActuator, m_type),
        KX_PYATTRIBUTE_BOOL_RW("useIpoAsForce", KX_IpoActuator, m_ipo_as_force),
        KX_PYATTRIBUTE_BOOL_RW("useIpoAdd", KX_IpoActuator, m_ipo_add),
index 6fa14c94f99da5263b4ad0c4c4ae291fc136f892..0cc0e7318c11163c24b589ba0e5ab89a843908c1 100644 (file)
@@ -352,7 +352,7 @@ PyAttributeDef KX_RaySensor::Attributes[] = {
        KX_PYATTRIBUTE_BOOL_RW("useMaterial", KX_RaySensor, m_bFindMaterial),
        KX_PYATTRIBUTE_BOOL_RW("useXRay", KX_RaySensor, m_bXRay),
        KX_PYATTRIBUTE_FLOAT_RW("range", 0, 10000, KX_RaySensor, m_distance),
-       KX_PYATTRIBUTE_STRING_RW("propName", 0, 100, false, KX_RaySensor, m_propertyname),
+       KX_PYATTRIBUTE_STRING_RW("propName", 0, MAX_PROP_NAME, false, KX_RaySensor, m_propertyname),
        KX_PYATTRIBUTE_INT_RW("axis", 0, 5, true, KX_RaySensor, m_axis),
        KX_PYATTRIBUTE_FLOAT_ARRAY_RO("hitPosition", KX_RaySensor, m_hitPosition, 3),
        KX_PYATTRIBUTE_FLOAT_ARRAY_RO("rayDirection", KX_RaySensor, m_rayDirection, 3),
index 16474437142a7d3eb6c1eb341cf7e18f76db78eb..3370805978422491547f5f98116e1d7aa4eb7715 100644 (file)
@@ -249,7 +249,7 @@ PyMethodDef KX_SceneActuator::Methods[] =
 };
 
 PyAttributeDef KX_SceneActuator::Attributes[] = {
-       KX_PYATTRIBUTE_STRING_RW("scene",0,32,true,KX_SceneActuator,m_nextSceneName),
+       KX_PYATTRIBUTE_STRING_RW("scene",0,MAX_ID_NAME-2,true,KX_SceneActuator,m_nextSceneName),
        KX_PYATTRIBUTE_RW_FUNCTION("camera",KX_SceneActuator,pyattr_get_camera,pyattr_set_camera),
        KX_PYATTRIBUTE_BOOL_RW("useRestart", KX_SceneActuator, m_restart),
        KX_PYATTRIBUTE_INT_RW("mode", KX_SCENE_NODEF+1, KX_SCENE_MAX-1, true, KX_SceneActuator, m_mode),
index aa864349035b2298d3e79bef84e20d16e57dba9e..d7bcf1306a1800639d7681720bc2c4217ef27149 100644 (file)
@@ -321,7 +321,7 @@ PyMethodDef KX_TouchSensor::Methods[] = {
 };
 
 PyAttributeDef KX_TouchSensor::Attributes[] = {
-       KX_PYATTRIBUTE_STRING_RW("propName",0,100,false,KX_TouchSensor,m_touchedpropname),
+       KX_PYATTRIBUTE_STRING_RW("propName",0,MAX_PROP_NAME,false,KX_TouchSensor,m_touchedpropname),
        KX_PYATTRIBUTE_BOOL_RW("useMaterial",KX_TouchSensor,m_bFindMaterial),
        KX_PYATTRIBUTE_BOOL_RW("usePulseCollision",KX_TouchSensor,m_bTouchPulse),
        KX_PYATTRIBUTE_RO_FUNCTION("hitObject", KX_TouchSensor, pyattr_get_object_hit),
index 18a987a332a189e88473d7da06e613c54abf5719..1e8630c72d8f9d90101df29304c8f55c66e1fa79 100644 (file)
@@ -104,7 +104,7 @@ void RAS_TexVert::SetFlag(const short flag)
 
 void RAS_TexVert::SetUnit(const unsigned int u)
 {
-       m_unit = u<=MAX_UNIT?u:MAX_UNIT;
+       m_unit = u <= (unsigned int) MAX_UNIT ? u: (unsigned int)MAX_UNIT;
 }
 
 void RAS_TexVert::SetNormal(const MT_Vector3& normal)