# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

logic_event.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef LOGIC_EVENT_H
00027 #define LOGIC_EVENT_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/misc/stream.h"
00031 #include "nel/misc/entity_id.h"
00032 #include "nel/misc/o_xml.h"
00033 #include "nel/misc/i_xml.h"
00034 
00035 //#include "game_share/sid.h"
00036 
00037 
00038 namespace NLLOGIC
00039 {
00040 
00041 class CLogicStateMachine;
00042 
00043 
00051 class CLogicEventMessage
00052 {
00053 public:
00054         
00056         bool ToSend;
00057 
00059         bool Sent;
00060 
00062         std::string Destination;
00063 
00065         NLMISC::CEntityId DestinationId;
00066 
00068         std::string MessageId;
00069 
00071         std::string Arguments;
00072 
00076         CLogicEventMessage()
00077         {
00078                 ToSend = false;
00079                 Sent = false;
00080                 Destination = "no_destination";
00081                 MessageId = "no_id";
00082                 DestinationId.setType( 0xfe );
00083                 DestinationId.setCreatorId( 0 );
00084                 DestinationId.setDynamicId( 0 );
00085                 Arguments = "no_arguments";
00086         }
00087 
00091         //void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
00092 
00093         void write (xmlNodePtr node, const char *subName = "") const;
00094         void read (xmlNodePtr node, const char *subName = "");
00095 };
00096 
00097 
00105 class CLogicEventAction
00106 {
00107 public:
00108         
00110         bool IsStateChange;
00111 
00113         std::string StateChange;
00114 
00116         CLogicEventMessage EventMessage;
00117 
00121         CLogicEventAction()
00122         {
00123                 IsStateChange = false;
00124         }
00125 
00129         void enableSendMessage();
00130 
00134         //void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
00135 
00136         void write (xmlNodePtr node) const;
00137         void read (xmlNodePtr node);
00138 };
00139 
00140 
00141 
00149 class CLogicEvent
00150 {
00152         CLogicStateMachine * _LogicStateMachine;
00153 
00154 public:
00155         
00157         std::string ConditionName;
00158         
00160         CLogicEventAction EventAction;
00161 
00165         CLogicEvent()
00166         {
00167                 _LogicStateMachine = 0;
00168                 ConditionName = "no_condition";
00169         }
00170 
00174         void reset();
00175 
00181         void setLogicStateMachine( CLogicStateMachine * logicStateMachine );
00182 
00188         bool testCondition();
00189 
00193         //void serial(class NLMISC::IStream &f) throw(NLMISC::EStream);
00194 
00195         void write (xmlNodePtr node) const;
00196         void read (xmlNodePtr node);
00197 };
00198 
00199 } // NLLOGIC
00200 
00201 #endif //LOGIC_EVENT
00202 
00203 
00204