Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

SCA_ANDController.cpp

Go to the documentation of this file.
00001 
00006 
00007 #include "SCA_ANDController.h"
00008 #include "SCA_ISensor.h"
00009 #include "SCA_LogicManager.h"
00010 #include "BoolValue.h"
00011 
00012 /* ------------------------------------------------------------------------- */
00013 /* Native functions                                                          */
00014 /* ------------------------------------------------------------------------- */
00015 
00016 void SCA_ANDController::Trigger(SCA_LogicManager* logicmgr)

00017 {
00018 
00019         bool sensorresult = true;
00020 
00021         for (vector<SCA_ISensor*>::const_iterator is=m_linkedsensors.begin();
00022         !(is==m_linkedsensors.end());is++)
00023         {
00024                 SCA_ISensor* sensor = *is;
00025                 if (!sensor->IsPositiveTrigger())
00026                 {
00027                         sensorresult = false;
00028                         break;
00029                 }
00030         }
00031         
00032         CValue* newevent = new CBoolValue(sensorresult);
00033 
00034         for (vector<SCA_IActuator*>::const_iterator i=m_linkedactuators.begin();
00035         !(i==m_linkedactuators.end());i++)
00036         {
00037                 SCA_IActuator* actua = *i;//m_linkedactuators.at(i);
00038                 logicmgr->AddActiveActuator(actua,newevent);
00039         }
00040 
00041         // every actuator that needs the event, has a it's own reference to it now so
00042         // release it (so to be clear: if there is no actuator, it's deleted right now)
00043         newevent->Release();
00044 
00045 }
00046 
00047 /* ------------------------------------------------------------------------- */
00048 /* Python functions                                                          */
00049 /* ------------------------------------------------------------------------- */
00050 
00051 /* Integration hooks ------------------------------------------------------- */
00052 PyTypeObject SCA_ANDController::Type = {
00053         PyObject_HEAD_INIT(&PyType_Type)
00054         0,
00055         "SCA_ANDController",
00056         sizeof(SCA_ANDController),
00057         0,
00058         PyDestructor,
00059         0,
00060         __getattr,
00061         __setattr,
00062         0, //&MyPyCompare,
00063         __repr,
00064         0, //&cvalue_as_number,
00065         0,
00066         0,
00067         0,
00068         0
00069 };
00070 
00071 PyParentObject SCA_ANDController::Parents[] = {
00072         &SCA_ANDController::Type,
00073         &SCA_IController::Type,
00074         &SCA_ILogicBrick::Type,
00075         &CValue::Type,
00076         NULL
00077 };
00078 
00079 PyMethodDef SCA_ANDController::Methods[] = {
00080         {NULL,NULL} //Sentinel
00081 };
00082 
00083 PyObject* SCA_ANDController::_getattr(char* attr) {
00084         _getattr_up(SCA_IController);
00085 }
00086 
00087 /* eof */

Generated at Thu Feb 1 13:03:09 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000