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

SCA_ORController.cpp

Go to the documentation of this file.
00001 
00006 
00007 #include "SCA_ORController.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_ORController::Trigger(SCA_LogicManager* logicmgr)

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

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