/[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.6 by ksterker, Mon Dec 13 08:50:31 2004 UTC revision 1.7 by ksterker, Tue Mar 8 09:43:36 2005 UTC
# Line 1  Line 1 
1  /*  /*
2     $Id$     $Id$
3    
4     Copyright (C) 2000/2001/2002/2003 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"
31  using events::event;  
32    using events::event;
33  // constructor  using events::event_type;
34  event::event ()  
35  {  // constructor
36      // repeat forever  event::event ()
37      Repeat = -1;  {
38  }      // repeat forever
39        Repeat = -1;
40  // save the state of the script associated with the event      Type = 255;
41  void event::put_state (base::flat & out) const  }
42  {  
43      out.put_uint8 ("etp", Type);  u_int8 event::type ()
44      out.put_sint32 ("erp", Repeat);  {
45  }      if (Type != 255) return Type;
46        return (Type = event_type::get_id (name ()));
47  // load the state of the script associated with the event  }
48  bool event::get_state (base::flat & in)  
49  {  // save the state of the script associated with the event
50      // Note that 'Type' is already read by listener::get_state  void event::put_state (base::flat & out) const
51      // to determine what event subclass to instanciate  {
52      Repeat = in.get_sint32 ("erp");      out.put_string ("etp", name ());
53            out.put_sint32 ("erp", Repeat);
54      return in.success ();  }
55  }  
56    // load the state of the script associated with the event
57    bool event::get_state (base::flat & in)
58    {
59        // Note that 'Type' is already read by listener::get_state
60        // to determine what event subclass to instanciate
61        Repeat = in.get_sint32 ("erp");
62        
63        return in.success ();
64    }

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

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