doxygen: prevent GPL license block from being parsed as doxygen comment.
[blender.git] / source / gameengine / GameLogic / SCA_ORController.cpp
1 /*
2  * 'Or' together all inputs
3  *
4  * $Id$
5  *
6  * ***** BEGIN GPL LICENSE BLOCK *****
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23  * All rights reserved.
24  *
25  * The Original Code is: all of this file.
26  *
27  * Contributor(s): none yet.
28  *
29  * ***** END GPL LICENSE BLOCK *****
30  */
31
32 #include "SCA_ORController.h"
33 #include "SCA_ISensor.h"
34 #include "SCA_LogicManager.h"
35 #include "BoolValue.h"
36
37 /* ------------------------------------------------------------------------- */
38 /* Native functions                                                          */
39 /* ------------------------------------------------------------------------- */
40
41 SCA_ORController::SCA_ORController(SCA_IObject* gameobj)
42                 :SCA_IController(gameobj)
43 {
44 }
45
46
47
48 SCA_ORController::~SCA_ORController()
49 {
50 }
51
52
53
54 CValue* SCA_ORController::GetReplica()
55 {
56         CValue* replica = new SCA_ORController(*this);
57         // this will copy properties and so on...
58         replica->ProcessReplica();
59
60         return replica;
61 }
62
63
64 void SCA_ORController::Trigger(SCA_LogicManager* logicmgr)
65 {
66
67         bool sensorresult = false;
68         SCA_ISensor* sensor;
69
70         vector<SCA_ISensor*>::const_iterator is=m_linkedsensors.begin();
71         while ( (!sensorresult) && (!(is==m_linkedsensors.end())) )
72         {
73                 sensor = *is;
74                 if (sensor->GetState()) sensorresult = true;
75                 is++;
76         }
77         
78         for (vector<SCA_IActuator*>::const_iterator i=m_linkedactuators.begin();
79         !(i==m_linkedactuators.end());i++)
80         {
81                 SCA_IActuator* actua = *i;
82                 logicmgr->AddActiveActuator(actua,sensorresult);
83         }
84 }
85
86 #ifdef WITH_PYTHON
87
88 /* ------------------------------------------------------------------------- */
89 /* Python functions                                                          */
90 /* ------------------------------------------------------------------------- */
91
92 /* Integration hooks ------------------------------------------------------- */
93 PyTypeObject SCA_ORController::Type = {
94         PyVarObject_HEAD_INIT(NULL, 0)
95         "SCA_ORController",
96         sizeof(PyObjectPlus_Proxy),
97         0,
98         py_base_dealloc,
99         0,
100         0,
101         0,
102         0,
103         py_base_repr,
104         0,0,0,0,0,0,0,0,0,
105         Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
106         0,0,0,0,0,0,0,
107         Methods,
108         0,
109         0,
110         &SCA_IController::Type,
111         0,0,0,0,0,0,
112         py_base_new
113 };
114
115 PyMethodDef SCA_ORController::Methods[] = {
116         {NULL,NULL} //Sentinel
117 };
118
119 PyAttributeDef SCA_ORController::Attributes[] = {
120         { NULL }        //Sentinel
121 };
122
123 #endif // WITH_PYTHON
124
125 /* eof */