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:
authorCampbell Barton <ideasman42@gmail.com>2009-05-19 11:16:40 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-05-19 11:16:40 +0400
commit1a16fb1953a566cd57f49683d4711b7052d6b586 (patch)
tree01b9ea221ec4f4ce9942b9bb2d0b642aba78529a /source/gameengine/GameLogic
parent5bd4b25dd1997672e4487f7dcba76e4b74ce814f (diff)
BGE Py API
use PY_SET_ATTR_FAIL and PY_SET_ATTR_SUCCESS return values so the fake subclassing can know if a value failed to be set or if it was missing from the type. (with PY_SET_ATTR_MISSING) Also noticed some other mistakes. - KX_LightObject, setting the type didnt check for an int. - KX_SoundActuator, didnt return an error when assigning an invalid orientation value - KX_GameObject, worldOrientation didnt return an error value.
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_RandomActuator.cpp4
-rw-r--r--source/gameengine/GameLogic/SCA_RandomSensor.cpp4
3 files changed, 6 insertions, 6 deletions
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index abb3b36b91e..d58259457e6 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -563,14 +563,14 @@ int SCA_PythonController::pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_D
if (scriptArg==NULL) {
PyErr_SetString(PyExc_TypeError, "controller.script = string: Python Controller, expected a string script text");
- return -1;
+ return PY_SET_ATTR_FAIL;
}
/* set scripttext sets m_bModified to true,
so next time the script is needed, a reparse into byte code is done */
self->SetScriptText(scriptArg);
- return 0;
+ return PY_SET_ATTR_SUCCESS;
}
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
index ff957d8350e..1bc4487b5bf 100644
--- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
@@ -387,10 +387,10 @@ int SCA_RandomActuator::pyattr_set_seed(void *self, const struct KX_PYATTRIBUTE_
if (PyInt_Check(value)) {
int ival = PyInt_AsLong(value);
act->m_base->SetSeed(ival);
- return 0;
+ return PY_SET_ATTR_SUCCESS;
} else {
PyErr_SetString(PyExc_TypeError, "actuator.seed = int: Random Actuator, expected an integer");
- return 1;
+ return PY_SET_ATTR_FAIL;
}
}
diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.cpp b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
index 1581a29480e..3c04173d10e 100644
--- a/source/gameengine/GameLogic/SCA_RandomSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomSensor.cpp
@@ -236,10 +236,10 @@ int SCA_RandomSensor::pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *at
SCA_RandomSensor* self= static_cast<SCA_RandomSensor*>(self_v);
if (!PyInt_Check(value)) {
PyErr_SetString(PyExc_TypeError, "sensor.seed = int: Random Sensor, expected an integer");
- return -1;
+ return PY_SET_ATTR_FAIL;
}
self->m_basegenerator->SetSeed(PyInt_AsLong(value));
- return 0;
+ return PY_SET_ATTR_SUCCESS;
}
/* eof */