Blender  V2.59
KX_SCA_EndObjectActuator.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: KX_SCA_EndObjectActuator.cpp 35171 2011-02-25 13:35:59Z jesterking $
00003  * ***** BEGIN GPL LICENSE BLOCK *****
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software Foundation,
00017  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018  *
00019  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00020  * All rights reserved.
00021  *
00022  * The Original Code is: all of this file.
00023  *
00024  * Contributor(s): none yet.
00025  *
00026  * ***** END GPL LICENSE BLOCK *****
00027  */
00028 
00034 //
00035 
00036 // Remove the actuator's parent when triggered
00037 //
00038 // Previously existed as:
00039 // \source\gameengine\GameLogic\SCA_EndObjectActuator.cpp
00040 // Please look here for revision history.
00041 
00042 #include "SCA_IActuator.h"
00043 #include "KX_SCA_EndObjectActuator.h"
00044 #include "SCA_IScene.h"
00045 
00046 KX_SCA_EndObjectActuator::KX_SCA_EndObjectActuator(SCA_IObject *gameobj,
00047                                                                                                    SCA_IScene* scene):
00048         SCA_IActuator(gameobj, KX_ACT_END_OBJECT),
00049         m_scene(scene)
00050 {
00051     // intentionally empty 
00052 } /* End of constructor */
00053 
00054 
00055 
00056 KX_SCA_EndObjectActuator::~KX_SCA_EndObjectActuator()
00057 { 
00058         // there's nothing to be done here, really....
00059 } /* end of destructor */
00060 
00061 
00062 
00063 bool KX_SCA_EndObjectActuator::Update()
00064 {
00065         // bool result = false; /*unused*/
00066         bool bNegativeEvent = IsNegativeEvent();
00067         RemoveAllEvents();
00068 
00069         if (bNegativeEvent)
00070                 return false; // do nothing on negative events
00071         m_scene->DelayedRemoveObject(GetParent());
00072         
00073         return false;
00074 }
00075 
00076 
00077 
00078 CValue* KX_SCA_EndObjectActuator::GetReplica()
00079 {
00080         KX_SCA_EndObjectActuator* replica = 
00081                 new KX_SCA_EndObjectActuator(*this);
00082         if (replica == NULL) return NULL;
00083 
00084         replica->ProcessReplica();
00085         return replica;
00086 };
00087 
00088 #ifdef WITH_PYTHON
00089 
00090 /* ------------------------------------------------------------------------- */
00091 /* Python functions : integration hooks                                      */
00092 /* ------------------------------------------------------------------------- */
00093 
00094 PyTypeObject KX_SCA_EndObjectActuator::Type = {
00095         PyVarObject_HEAD_INIT(NULL, 0)
00096         "KX_SCA_EndObjectActuator",
00097         sizeof(PyObjectPlus_Proxy),
00098         0,
00099         py_base_dealloc,
00100         0,
00101         0,
00102         0,
00103         0,
00104         py_base_repr,
00105         0,0,0,0,0,0,0,0,0,
00106         Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
00107         0,0,0,0,0,0,0,
00108         Methods,
00109         0,
00110         0,
00111         &SCA_IActuator::Type,
00112         0,0,0,0,0,0,
00113         py_base_new
00114 };
00115 
00116 PyMethodDef KX_SCA_EndObjectActuator::Methods[] = {
00117   {NULL,NULL} //Sentinel
00118 };
00119 
00120 PyAttributeDef KX_SCA_EndObjectActuator::Attributes[] = {
00121         { NULL }        //Sentinel
00122 };
00123 
00124 #endif // WITH_PYTHON
00125 
00126 /* eof */