/[adonthell]/adonthell/src/event/event.cc
ViewVC logotype

Diff of /adonthell/src/event/event.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by ksterker, Tue Mar 8 09:43:36 2005 UTC revision 1.8 by ksterker, Fri Jun 3 17:29:13 2005 UTC
# Line 1  Line 1 
1  /*  /*
2     $Id$     $Id$
3    
4     Copyright (C) 2000/2001/2002/2003/2005 Kai Sterker <kaisterker@linuxgames.com>     Copyright (C) 2000/2001/2002/2003/2005 Kai Sterker <kaisterker@linuxgames.com>
5     Part of the Adonthell Project http://adonthell.linuxgames.com     Part of the Adonthell Project http://adonthell.linuxgames.com
6    
7     Adonthell is free software; you can redistribute it and/or modify     Adonthell is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation; either version 2 of the License, or     the Free Software Foundation; either version 2 of the License, or
10     (at your option) any later version.     (at your option) any later version.
11    
12     Adonthell is distributed in the hope that it will be useful,     Adonthell is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.     GNU General Public License for more details.
16    
17     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License
18     along with Adonthell; if not, write to the Free Software     along with Adonthell; if not, write to the Free Software
19     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */  */
21    
22  /**  /**
23   * @file        event/event.cc   * @file        event/event.cc
24   * @author      Kai Sterker <kaisterker@linuxgames.com>   * @author      Kai Sterker <kaisterker@linuxgames.com>
25   *   *
26   * @brief       Defines the base event class.   * @brief       Defines the base event class.
27   */   */
28    
29  #include "event/event.h"  #include "event/event.h"
30  #include "event/types.h"  #include "event/types.h"
31    
32  using events::event;  using events::event;
33  using events::event_type;  using events::event_type;
34    
35  // constructor  // constructor
36  event::event ()  event::event ()
37  {  {
38      // repeat forever      // repeat forever
39      Repeat = -1;      Repeat = -1;
40      Type = 255;      Type = 255;
41  }  }
42    
43  u_int8 event::type ()  u_int8 event::type ()
44  {  {
45      if (Type != 255) return Type;      if (Type != 255) return Type;
46      return (Type = event_type::get_id (name ()));      return (Type = event_type::get_id (name ()));
47  }  }
48    
49  // save the state of the script associated with the event  // save the state of the script associated with the event
50  void event::put_state (base::flat & out) const  void event::put_state (base::flat & out) const
51  {  {
52      out.put_string ("etp", name ());      out.put_string ("etp", name ());
53      out.put_sint32 ("erp", Repeat);      out.put_sint32 ("erp", Repeat);
54  }  }
55    
56  // load the state of the script associated with the event  // load the state of the script associated with the event
57  bool event::get_state (base::flat & in)  bool event::get_state (base::flat & in)
58  {  {
59      // Note that 'Type' is already read by listener::get_state      // Note that 'Type' is already read by listener::get_state
60      // to determine what event subclass to instanciate      // to determine what event subclass to instanciate
61      Repeat = in.get_sint32 ("erp");      Repeat = in.get_sint32 ("erp");
62            
63      return in.success ();      return in.success ();
64  }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26