optionally use guarded alloc for tiles compositor, also replace allocation functions...
[blender.git] / source / gameengine / GameLogic / SCA_AlwaysSensor.cpp
1 /*
2  * Always trigger
3  *
4  *
5  * ***** BEGIN GPL LICENSE BLOCK *****
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
22  * All rights reserved.
23  *
24  * The Original Code is: all of this file.
25  *
26  * Contributor(s): none yet.
27  *
28  * ***** END GPL LICENSE BLOCK *****
29  */
30
31 /** \file gameengine/GameLogic/SCA_AlwaysSensor.cpp
32  *  \ingroup gamelogic
33  */
34
35
36 #if defined(WIN32) && !defined(FREE_WINDOWS)
37 // This warning tells us about truncation of __long__ stl-generated names.
38 // It can occasionally cause DevStudio to have internal compiler warnings.
39 #pragma warning( disable : 4786 )     
40 #endif
41
42 #include "SCA_AlwaysSensor.h"
43 #include "SCA_LogicManager.h"
44 #include "SCA_EventManager.h"
45
46 /* ------------------------------------------------------------------------- */
47 /* Native functions                                                          */
48 /* ------------------------------------------------------------------------- */
49
50 SCA_AlwaysSensor::SCA_AlwaysSensor(class SCA_EventManager* eventmgr,
51                                                                  SCA_IObject* gameobj)
52         : SCA_ISensor(gameobj,eventmgr)
53 {
54         //SetDrawColor(255,0,0);
55         Init();
56 }
57
58 void SCA_AlwaysSensor::Init()
59 {
60         m_alwaysresult = true;
61 }
62
63 SCA_AlwaysSensor::~SCA_AlwaysSensor()
64 {
65         /* intentionally empty */
66 }
67
68
69
70 CValue* SCA_AlwaysSensor::GetReplica()
71 {
72         CValue* replica = new SCA_AlwaysSensor(*this);//m_float,GetName());
73         // this will copy properties and so on...
74         replica->ProcessReplica();
75
76         return replica;
77 }
78
79
80
81 bool SCA_AlwaysSensor::IsPositiveTrigger()
82
83         return (m_invert ? false : true);
84 }
85
86
87
88 bool SCA_AlwaysSensor::Evaluate()
89 {
90         /* Nice! :) */
91                 //return true;
92         /* even nicer ;) */
93                 //return false;
94         
95         /* nicest ! */
96         bool result = m_alwaysresult;
97         m_alwaysresult = false;
98         return result;
99 }
100
101 #ifdef WITH_PYTHON
102
103 /* ------------------------------------------------------------------------- */
104 /* Python functions                                                          */
105 /* ------------------------------------------------------------------------- */
106
107 /* Integration hooks ------------------------------------------------------- */
108 PyTypeObject SCA_AlwaysSensor::Type = {
109         PyVarObject_HEAD_INIT(NULL, 0)
110         "SCA_AlwaysSensor",
111         sizeof(PyObjectPlus_Proxy),
112         0,
113         py_base_dealloc,
114         0,
115         0,
116         0,
117         0,
118         py_base_repr,
119         0,0,0,0,0,0,0,0,0,
120         Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
121         0,0,0,0,0,0,0,
122         Methods,
123         0,
124         0,
125         &SCA_ISensor::Type,
126         0,0,0,0,0,0,
127         py_base_new
128 };
129
130 PyMethodDef SCA_AlwaysSensor::Methods[] = {
131         {NULL,NULL} //Sentinel
132 };
133
134 PyAttributeDef SCA_AlwaysSensor::Attributes[] = {
135         { NULL }        //Sentinel
136 };
137
138 #endif
139
140 /* eof */