adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-commits] CVS: adonthell/src event_handler.cc,1.1,1.2 event_ha


From: Kai Sterker <address@hidden>
Subject: [Adonthell-commits] CVS: adonthell/src event_handler.cc,1.1,1.2 event_handler.h,1.1,1.2 event_handler_base.h,1.1,1.2 event_list.cc,1.1,1.2 event_list.h,1.1,1.2 gamedate.cc,1.1,1.2 gamedate.h,1.1,1.2 map_event.cc,NONE,1.1 map_event.h,NONE,1.1 map_event_handler.cc,NONE,1.1 map_event_handler.h,NONE,1.1 time_event.cc,1.1,1.2 time_event.h,1.1,1.2 time_event_handler.cc,1.1,1.2 time_event_handler.h,1.1,1.2 Makefile.am,1.93,1.94 adonthell.cc,1.7,1.8 event.cc,1.13,1.14 event.h,1.26,1.27 gamedata.cc,1.19,1.20 gametime.cc,1.10,1.11 gametime.h,1.11,1.12 landmap.cc,1.19,1.20 landmap.h,1.24,1.25 main.cc,1.49,1.50 mapcharacter.cc,1.40,1.41 py_adonthell.i,1.32,1.33
Date: Fri, 09 Aug 2002 16:01:28 -0400

Update of /cvsroot/adonthell/adonthell/src
In directory subversions:/tmp/cvs-serv13386

Modified Files:
        Makefile.am adonthell.cc event.cc event.h gamedata.cc 
        gametime.cc gametime.h landmap.cc landmap.h main.cc 
        mapcharacter.cc py_adonthell.i 
Added Files:
        event_handler.cc event_handler.h event_handler_base.h 
        event_list.cc event_list.h gamedate.cc gamedate.h map_event.cc 
        map_event.h map_event_handler.cc map_event_handler.h 
        time_event.cc time_event.h time_event_handler.cc 
        time_event_handler.h 
Log Message:
PORTED v0.4 event system back to v0.3
ADDED gamedate stuff to v0.3









***** Error reading new file: [Errno 2] No such file or directory: 
'map_event.cc'
***** Error reading new file: [Errno 2] No such file or directory: 'map_event.h'
***** Error reading new file: [Errno 2] No such file or directory: 
'map_event_handler.cc'
***** Error reading new file: [Errno 2] No such file or directory: 
'map_event_handler.h'




Index: Makefile.am
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Makefile.am,v
retrieving revision 1.93
retrieving revision 1.94
diff -C2 -r1.93 -r1.94
*** Makefile.am 30 Jun 2002 19:11:08 -0000      1.93
--- Makefile.am 9 Aug 2002 20:01:26 -0000       1.94
***************
*** 18,42 ****
  
  libadonthell_a_SOURCES = adonthell.cc animation.cc audio.cc \
! character_base.cc character.cc gamedata.cc data_screen.cc dialog.cc \
! dialog_screen.cc drawable.cc drawing_area.cc event.cc fileops.cc game.cc \
! gametime.cc image.cc input.cc landmap.cc lex.prefs.cc \
! mapsquare_walkable.cc mapcharacter.cc \
! mapsquare.cc mapobject.cc mapview.cc nls.cc path.cc pnm.cc prefs.cc \
! py_callback.cc python_class.cc py_adonthell_wrap.cc py_object.cc quest.cc \
! screen.cc surface.cc storage.cc text_bubble.cc win_background.cc win_base.cc 
win_border.cc \
! win_container.cc win_font.cc win_keys.cc\
! win_manager.cc win_scrollbar.cc win_scroll.cc win_select.cc win_theme.cc \
! label.cc  label_input.cc win_event.cc yarg.cc \
! adonthell.h animation.h audio.h callback.h py_callback.h \
! character_base.h character.h gamedata.h data_screen.h dialog.h 
dialog_screen.h \
! drawable.h drawing_area.h event.h fileops.h game.h gametime.h gettext.h 
getopt.h image.h input.h inventory.h \
! item.h landmap.h mapsquare.h mapsquare_walkable.h nls.h mapcharacter.h 
mapobject.h mapview.h \
! path.h pnm.h prefs.h python_class.h py_object.h quest.h screen.h surface.h 
storage.h \
! types.h text_bubble.h win_background.h win_base.h win_border.h 
win_container.h \
! str_hash.h win_font.h win_image.h win_label.h win_mapview.h label.h 
label_input.h \
! win_scrollbar.h win_scroll.h win_select.h win_theme.h win_keys.h win_event.h 
win_types.h \
! win_write.h win_manager.h win_object.h window.h win_wrappers.h yarg.h \
! mixer.c music.c music_cmd.c music_cmd.h music_ogg.c music_ogg.h wave.h \
! wavestream.c wavestream.h SDL_mixer.h
  
  libadonthell_LDADD = $(SDL_LIBS) $(OGG_LIBS) $(PY_LIBS)
--- 18,46 ----
  
  libadonthell_a_SOURCES = adonthell.cc animation.cc audio.cc \
! character_base.cc character.cc data_screen.cc dialog.cc dialog_screen.cc \
! drawable.cc drawing_area.cc event.cc event_handler.cc event_list.cc \
! fileops.cc game.cc gamedata.cc gamedate.cc gametime.cc image.cc input.cc \
! label.cc label_input.cc landmap.cc lex.prefs.cc map_event.cc \
! map_event_handler.cc mapsquare_walkable.cc mapcharacter.cc mapsquare.cc \
! mapobject.cc mapview.cc nls.cc path.cc pnm.cc prefs.cc py_callback.cc \
! python_class.cc py_adonthell_wrap.cc py_object.cc quest.cc screen.cc \
! surface.cc storage.cc text_bubble.cc time_event.cc time_event_handler.cc \
! win_background.cc win_base.cc win_border.cc win_container.cc win_font.cc \
! win_keys.cc win_manager.cc win_scrollbar.cc win_scroll.cc win_select.cc \
! win_theme.cc win_event.cc yarg.cc \
! adonthell.h animation.h audio.h callback.h py_callback.h character_base.h \
! character.h gamedata.h data_screen.h dialog.h dialog_screen.h drawable.h \
! drawing_area.h event.h event_handler.h event_handler_base.h event_list.h \
! fileops.h game.h gamedate.h gametime.h gettext.h getopt.h image.h input.h \
! inventory.h item.h landmap.h map_event.h map_event_handler.h mapsquare.h \
! mapsquare_walkable.h nls.h mapcharacter.h mapobject.h mapview.h path.h \
! pnm.h prefs.h python_class.h py_object.h quest.h screen.h surface.h storage.h 
\
! types.h text_bubble.h time_event.h time_event_handler.h win_background.h \
! win_base.h win_border.h win_container.h str_hash.h win_font.h win_image.h \
! win_label.h win_mapview.h label.h label_input.h win_scrollbar.h win_scroll.h \
! win_select.h win_theme.h win_keys.h win_event.h win_types.h win_write.h \
! win_manager.h win_object.h window.h win_wrappers.h yarg.h mixer.c music.c \
! music_cmd.c music_cmd.h music_ogg.c music_ogg.h wave.h wavestream.c \
! wavestream.h SDL_mixer.h
  
  libadonthell_LDADD = $(SDL_LIBS) $(OGG_LIBS) $(PY_LIBS)

Index: adonthell.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/adonthell.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** adonthell.cc        26 May 2002 09:27:27 -0000      1.7
--- adonthell.cc        9 Aug 2002 20:01:26 -0000       1.8
***************
*** 24,27 ****
--- 24,28 ----
  #include "win_manager.h"
  #include "gametime.h"
+ #include "gamedate.h"
  #include "adonthell.h"
  #include "audio.h"
***************
*** 65,71 ****
          screen::show ();
      
!         // update the game clock and perform operations to keep the 
!         // game's speed constant
          gametime::update ();
      }
  
--- 66,74 ----
          screen::show ();
      
!         // perform operations to keep the game's speed constant
          gametime::update ();
+         
+         // update the internal clock
+         gamedate::update ();
      }
  

Index: event.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/event.cc,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** event.cc    28 Jun 2002 12:15:20 -0000      1.13
--- event.cc    9 Aug 2002 20:01:26 -0000       1.14
***************
*** 2,6 ****
     $Id$
  
!    Copyright (C) 2000/2001 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
--- 2,6 ----
     $Id$
  
!    Copyright (C) 2000/2001/2002 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
***************
*** 18,210 ****
   * @author Kai Sterker <address@hidden>
   * 
!  * @brief  Defines the event_list, event and event_handler class.
!  * 
   * 
   */
  
- #include <algorithm>
- 
- #include "fileops.h"
- #include "python_class.h"
  #include "event.h"
  
! // Array with callbacks to return a newly instanciated event
! new_event event_list::instanciate_event[MAX_EVENT];
! 
! 
! event_list::~event_list ()
! {
!     clear (); 
! }
! 
! // Unregisters and deletes all events.
! void event_list::clear () 
! {
!     event *e;
!     
!     while (!events.empty ())
!     {
!         e = events.back ();
!         events.pop_back ();
!         event_handler::remove_event (e);
!         delete e;    
!     }    
! }
! 
! // Adds an event to the list and register it with the event_handler.
! void event_list::add_event (event* ev)
  {
!     events.push_back (ev);
!     event_handler::register_event (ev); 
  }
  
! // Register an event for loading
! void event_list::register_event (u_int8 type, new_event e)
  {
!     if (type < MAX_EVENT)
!         instanciate_event[type] = e;
  }
  
! // Save an event_list to file
! void event_list::save (ogzstream& out) const
  {
!     vector <event *>::iterator i;
!     u_int32 nbr_events = events.size ();
      
!     nbr_events >> out; 
! 
!     for (i = events.begin (); i != events.end (); i++)
!         (*i)->save (out); 
  }
  
! // Loads an event_list from file
! bool event_list::load (igzstream& in)
  {
!     u_int32 nbr_events;
!     u_int8 type;
! 
!     nbr_events << in;
      
!     while (nbr_events--) 
!     {
!         event * e = NULL;
!         type << in;
!         
!         // Instanciate an event of the given type
!         if (type < MAX_EVENT && instanciate_event[type] != NULL)
!             e = instanciate_event[type]();
!  
!         // try to load it, ...
!         if (e != NULL && e->load (in))
!             add_event (e);
          
!         // ... otherwise fail.
!         else
!         {
!             fprintf (stderr, "Could not load event #%i. Aborting ...\n", 
type);
!             return false;
!         }    
      }
      
!     return true;
  }
  
! event::event () 
  {
!     script_args = NULL; 
  }
  
! event::~event ()
  {
! }
  
! void event::set_script (string filename, PyObject * args)
! {
!     if (filename == "") 
!     {
!         script.clear ();
!         Py_XDECREF (script_args);
!         script_args = NULL; 
!     }
!     else 
!     {
!         Py_XINCREF (args);
!         script_args = args; 
!         u_int16 argssize = args == NULL ? 1 : PyTuple_Size (args) + 1; 
!         PyObject * theargs;
!         
!         theargs = PyTuple_New (argssize);
!         
!         // We can pass_instance directly 'cause PyTuple_SetItem steals a
!         // reference to the result of pass_instance.
!         PyTuple_SetItem (theargs, 0, python::pass_instance (this, "event"));
!         for (u_int16 i = 1; i < argssize; i++)
!         {
!             PyObject * intref = PyTuple_GetItem (args, i - 1);
!             Py_INCREF (intref); 
!             PyTuple_SetItem (theargs, i, intref); 
!         }
!         script.create_instance (EVENTS_DIR + filename, filename, theargs);
!         Py_DECREF (theargs);
!     }
!     script_file_ = filename;
  }
  
! void event::put_script_state (ogzstream & file) const
  {
!     script_file () >> file;
!     if (script_args) 
      {
!         true >> file; 
!         python::put_tuple (script_args, file);
      }
!     else false >> file; 
! }
! 
! void event::get_script_state (igzstream & file) 
! {
!     string t;
!     bool bo;
!     
!     PyObject * args = NULL; 
!     t << file;
!     bo << file; 
!     if (bo) args = python::get_tuple (file);
!     set_script (t, args);      
!     Py_XDECREF (args); 
  }
  
! // Array with the registered events; each type of event is kept in
! // a vector of its own for faster access
! vector<event*> event_handler::handlers[MAX_EVENT];
! 
! // See whether a matching event is registered and execute the
! // according script(s) 
! void event_handler::raise_event (event& e)
! {
!     vector<event*>::iterator i;
!     // Search through all registered events with the type of the raised event
!     for (i = handlers[e.type].begin (); i != handlers[e.type].end (); i++)
!         // Execute the script; pass recieved event on to get event data
!         if ((*i)->equals (e)) (*i)->execute (e); 
! }
! 
! 
! // Unregister an event
! void event_handler::remove_event (event *e)
  {
!     vector<event*>::iterator i;
! 
!     // Search for the event we want to remove
!     i = find (handlers[e->type].begin (), handlers[e->type].end (), e);
! 
!     // found? -> get rid of it :)
!     if (i != handlers[e->type].end ()) handlers[e->type].erase(i);
! 
! }
  
! // Register a event with it's script
! void event_handler::register_event (event *e)
! {
!     handlers[e->type].push_back (e);
  }
--- 18,169 ----
   * @author Kai Sterker <address@hidden>
   * 
!  * @brief  Defines the base event class.
   * 
   */
  
  #include "event.h"
  
! // constructor
! event::event ()
  {
!     Repeat = -1;
!     Script = NULL;
!     PyFunc = NULL;
!     Args = NULL;
!     Action = ACTION_NOTHING;
  }
  
! // destructor
! event::~event ()
  {
!     clear ();
  }
  
! // cleanup
! void event::clear ()
  {
!     switch (Action)
!     {
!         // script attached
!         case ACTION_SCRIPT:
!         {
!             delete Script;
!             Py_XDECREF (Args);
!             Args = NULL;
!             Script = NULL;
!             
!             break;
!         }
!         
!         // python callback attached
!         case ACTION_PYFUNC:
!         {
!             delete PyFunc;
!             PyFunc = NULL;
!             
!             break;
!         }
!         
!         default: break;
!     }
      
!     Action = ACTION_NOTHING;
  }
  
! // set a script as event's action
! void event::set_script (std::string filename, PyObject * args)
  {
!     // cleanup
!     clear ();
      
!     if (filename == "") return;
!     
!     Py_XINCREF (args);
!     Args = args; 
!        
!     u_int16 argssize = args == NULL ? 1 : PyTuple_Size (args) + 1; 
!     PyObject *theargs = PyTuple_New (argssize);
          
!     // We can pass_instance directly 'cause PyTuple_SetItem steals a
!     // reference to the result of pass_instance.
!     PyTuple_SetItem (theargs, 0, python::pass_instance (this, "event"));
!     for (u_int16 i = 1; i < argssize; i++)
!     {
!         PyObject *intref = PyTuple_GetItem (args, i - 1);
!         Py_INCREF (intref); 
!         PyTuple_SetItem (theargs, i, intref); 
      }
      
!     Script = new py_object;
!     Script->create_instance (EVENTS_DIR + filename, filename, theargs);
!     Py_DECREF (theargs);
!         
!     Action = ACTION_SCRIPT;
  }
  
! // set a python callback as event's action
! void event::set_callback (PyObject *callback, PyObject *args)
  {
!     // cleanup
!     clear ();
!     
!     // create the callback
!     PyFunc = new py_callback (callback, args);
!     
!     // tell the event what to do    
!     Action = ACTION_PYFUNC;
  }
  
! // set a C/C++ callback as event's action
! void event::set_callback (const Functor0 & callback)
  {
!     // cleanup
!     clear ();
  
!     Callback = callback;
!     Action = ACTION_CPPFUNC;
  }
  
! // save the state of the script associated with the event
! void event::put_state (ogzstream & file) const
  {
!     Type >> file;
!     Repeat >> file;
!     Action >> file;
!     
!     if (Action != ACTION_SCRIPT) return;
!         
!     Script->object_file () >> file;
!     
!     if (Args)
      {
!         true >> file;
!         python::put_tuple (Args, file);
      }
!     else false >> file;
  }
  
! // load the state of the script associated with the event 
! bool event::get_state (igzstream & file) 
  {
!     std::string name;
!     bool has_args;
!     PyObject * args = NULL;
  
!     // Note that »Type« is already read by event_list::load to
!     // determine what event subclass to instanciate
!     Repeat << file;
!     Action << file;
!     
!     if (Action != ACTION_SCRIPT) return true;
!         
!     name << file;
!     has_args << file;
!     
!     if (has_args) args = python::get_tuple (file);
!     
!     set_script (name, args);
!     Py_XDECREF (args);
!     
!     return true;
  }

Index: event.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/event.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** event.h     25 Apr 2002 15:34:11 -0000      1.26
--- event.h     9 Aug 2002 20:01:26 -0000       1.27
***************
*** 2,6 ****
     $Id$
  
!    Copyright (C) 2000/2001 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
--- 2,6 ----
     $Id$
  
!    Copyright (C) 2000/2001/2002 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
***************
*** 13,289 ****
  */
  
- 
  /**
   * @file   event.h
   * @author Kai Sterker <address@hidden>
   * 
!  * @brief  Declares the event_list, event and event_handler class.
!  * 
   * 
   */
-  
  
! #ifndef EVENT_H_
! #define EVENT_H_
  
! #include <vector> 
! #include "fileops.h" 
  #include "py_object.h"
  
  /**
!  * Directory where events scripts resides.
!  * 
   */ 
  #define EVENTS_DIR "game_events."
  
! 
! class event_handler;
! 
  /**
!  * Events types.
!  * 
   */ 
  enum
  {
!     ENTER_EVENT = 0,                            // Characters reach a new tile
!     LEAVE_EVENT = 1,                            // Characters leave a tile
!     TIME_EVENT = 2,                             // A minute of gametime passed
!     ACTION_EVENT = 3,                           // Character "acts" on a 
square 
!     MAX_EVENT = 4
  };
  
  /**
!  * Base class for events. You can create your own event types that can
!  * be handled by the event list and event handler by inheriting them from
   * this class.
!  * 
   */ 
  class event
  {
  public:
! 
!     /** 
!      * Default constructor.
!      * 
       */
!     event (); 
!     
      /** 
       * Destructor.
-      *  
       */ 
!      virtual ~event ();
  
!     /** 
!      * Returns the file name of the event's script.
!      * 
!      * 
!      * @return file name of the script.
       */
!     string script_file () const
!     {
!         return script_file_;
!     }
      
!     /** 
!      * Save the event to a file.
!      * 
!      * @param out file where to save the event.
!      */ 
!     virtual void save (ogzstream& out) const = 0;
!     
!     /** 
!      * Loads an event from a file.
!      * 
!      * @param in file to load the event from.
       *
!      * @return \e true if the event could be loaded, \e false otherwise
       */
!     virtual bool load (igzstream& in) = 0;
! 
!     /** 
!      * Sets the script for an event.
!      * 
!      * @param filename filename of the script to set.
!      */
!     void set_script (string filename, PyObject * args = NULL);
! 
!     void get_script_state (igzstream & file); 
!     void put_script_state (ogzstream & file) const; 
!     
! protected:
      /**
!      * Event type - see enum above.
!      * 
!      */ 
!     u_int8 type;
  
      /**
!      * Script object.
!      * 
       */
!     py_object script; 
  
-     PyObject * script_args; 
-     
      /**
!      * Script file.
!      * 
       */
!     string script_file_; 
! 
      /**
!      * Execute the script.
       * 
       */ 
!     virtual void execute (event& e) = 0;
  
      /** 
       * Compare two events for equality.
       * 
!      * @param ev pointer to the event to compare with.
!      * 
       * @return \e true if the events are equal, \e false otherwise.
       */
!     virtual bool equals (event& ev) = 0;
!     
! #ifndef SWIG
!     friend class event_handler;
! #endif
!     
! };
! 
! /**
!  * Pointer to a function returning a newly allocated event
!  *
!  */
! typedef event* (*new_event)();
! 
! 
! /**
!  * Base class for objects that want to register events
!  *
!  */ 
! class event_list
! {
! public:
!     /**
!      * Destructor - unregisters and deletes all events owned by this list.
!      * 
!      */ 
!     virtual ~event_list ();
! 
!     /**
!      * Unregisters and deletes all events owned by this list.
!      * 
!      */ 
!     void clear ();
  
      /** 
!      * Adds an event to this list. The event will be
!      * registered with the event_handler and the list will then
!      * take care of it's deletion.
       * 
!      * @param ev pointer to the event to add.
       */
!     void add_event (event* ev);
! 
      /**
!      * Register an event for loading. Before the event_list can load
!      * an event from file, it needs a callback function that returns
!      * a new instance of the event of the given type.
       *
!      * @param type the type of the event to register
!      * @param e a callback returning a new instance of an event of the given 
type.
       *
!      * @sa load ()
       */
!     static void register_event (u_int8 type, new_event e);
!     
      /** 
!      * Save the event_list to a file.
       * 
!      * @param out file where to save the event_list.
       */ 
!     void save (ogzstream& out) const;
      
      /** 
!      * Loads the event_list from a file and registers all loaded events.
!      * @warning Before the event_list can load an event from file, it needs
!      *          a callback function that returns a new instance of that event.
!      * 
!      * @param in file to load the event_list from.
       * 
!      * @return \e true if the event_list was loaded successfully, \e false 
otherwise.
!      * @sa register_event ()
       */
!     bool load (igzstream& in);
  
! #ifndef SWIG
  protected:
      /**
!      * List of events.
!      * 
       */ 
!     mutable vector<event*> events;
  
- private:
      /**
!      * Array with callbacks that return a newly allocated instance of an 
event.
!      * The event's type is the postion of the according callback in the array.
       */
!     static new_event instanciate_event[MAX_EVENT];
! #endif // SWIG
! };
! 
! /**
!  * Keeps track of registered scripts, recieves triggered events 
!  * and executes scripts handling those events
!  *
!  */ 
! class event_handler
! {
! public:
!     /** 
!      * Registers an event.
!      * 
!      * @param ev pointer to the event to register.
       */
!     static void register_event (event* ev);
! 
!     /** 
!      * Unregister an event.
!      * 
!      * @param event* pointer to the event to unregister.
       */
!     static void remove_event (event* ev);
  
!     /** 
!      * Check if an event corresponding to ev exists, and execute it. 
!      * 
!      * @param ev event to raise.
       */
!     static void raise_event (event& ev);
      
! private:
! #ifndef SWIG
!     static vector<event*> handlers[MAX_EVENT];      // registered events 
storage
! #endif
  };
  
! #ifndef SWIG
! 
! /**
!  * A function that returns a new instance of an event.
!  */
! #define NEW_EVENT(evt)\
!     event* new_ ## evt () { return (event*) new evt; }
! /**
!  * Registers an event with the event_list, allowing it to load this event
!  * without knowing about it at compile time.
!  */
! #define REGISTER_EVENT(type,evt)\
!     event_list::register_event (type, (new_event) &new_ ## evt);
! 
! #endif // SWIG
! #endif // EVENT_H_
--- 13,254 ----
  */
  
  /**
   * @file   event.h
   * @author Kai Sterker <address@hidden>
   * 
!  * @brief  Declares the %event class.
   * 
   */
  
! #ifndef EVENT_H__
! #define EVENT_H__
  
! #include "fileops.h"
! #include "callback.h"
  #include "py_object.h"
+ #include "py_callback.h"
+ 
+ using std::string;
  
  /**
!  * Directory where %event scripts reside.
   */ 
  #define EVENTS_DIR "game_events."
  
! #ifndef SWIG
  /**
!  * Available %event types.
   */ 
  enum
  {
!     ENTER_EVENT     = 0,            // Characters reach a new tile
!     LEAVE_EVENT     = 1,            // Characters leave a tile
!     TIME_EVENT      = 2,            // Certain point in gametime reached
!     ACTION_EVENT    = 3,            // Character "acts" on a square 
!     MAX_EVENTS      = 4
  };
  
  /**
!  * Available 'actions', i.e. what happens when the event occurs
!  */
! enum
! {
!     ACTION_NOTHING  = 0,
!     ACTION_SCRIPT   = 1,
!     ACTION_PYFUNC   = 2,
!     ACTION_CPPFUNC  = 3
! };
! #endif // SWIG
!     
! /**
!  * Base class for events. You can create your own %event types that can
!  * be handled by the event_list and event_handler by inheriting from
   * this class.
!  *
!  * Events are used to notify when certain things happen during the game.
!  * They may either execute the "run" method of an exclusive python script
!  * or a simple python callback defined elsewhere.
   */ 
  class event
  {
  public:
!     /**
!      * Constructor. Needs to be called by any derived class!
       */
!     event ();
! 
      /** 
       * Destructor.
       */ 
!     virtual ~event ();
  
!     /**
!      * Cleanup. Clears script and its arguments. 
       */
!     void clear ();    
      
!     /**
!      * Get the event's type.
       *
!      * @return type of the event
       */
!     u_int8 type () const
!     { 
!         return Type;
!     }
!      
      /**
!      * Return whether this event should be repeated.
!      *
!      * @return the number of times this event should be repeated or
!      *      -1 in case it should be repeated unlimited times.
!      */
!     s_int32 repeat ()
!     {
!         if (Repeat > 0) Repeat--;
!         
!         return Repeat;
!     }
  
      /**
!      * Set whether this event should be repeated. A number greater than 0
!      * will repeat the event that many times, a number less than 0 will
!      * repeat the event forever. A number equal to 0 won't repeat the event.
!      *
!      *  @param count How often the event should be repeated.
       */
!     void set_repeat (s_int32 count)
!     {
!         Repeat = count;
!     }
  
      /**
!      * @name Event Handling
       */
!     //@{
!     
      /**
!      * Execute the associated python script or callback.
       * 
+      * @param evnt The %event that triggered the execution.
       */ 
!     virtual void execute (const event& evnt) = 0;
  
      /** 
       * Compare two events for equality.
       * 
!      * @param evnt pointer to the %event to compare with.
       * @return \e true if the events are equal, \e false otherwise.
       */
!     virtual bool equals (const event& evnt) = 0;
  
+     //@}
+     
      /** 
!      * Sets a script to be executed whenever the event occurs.
       * 
!      * @param filename filename of the script to set.
!      * @param args The arguments to pass to the script's constructor
       */
!     void set_script (string filename, PyObject * args = NULL);
!     
      /**
!      * Sets a python function/method to be executed whenever the
!      * %event occurs.
       *
!      * @warning the callback won't be saved with the %event. It
!      * must be restored by the event's owner.
       *
!      * @param callback The function or method to call.
!      * @param args Additional arguments to pass to the callback.
       */
!     void set_callback (PyObject *callback, PyObject *args = NULL);
!      
! #ifndef SWIG
!     /**
!      * Sets a C function/C++ method to be executed whenever the
!      * %event occurs.
!      *
!      * @warning the callback won't be saved with the %event. It
!      * must be restored by the event's owner.
!      *
!      * @param callback The callback, a function with no arguments
!      *      returning void
!      */
!     void set_callback (const Functor0 & callback);
! #endif // SWIG
! 
!     /**
!      * @name Loading / Saving
!      */
!     //@{
! 
      /** 
!      * Saves the basic %event %data (such as the type or script data)
!      * to a file. Call this method from the derived class.
       * 
!      * @param out file where to save the %event.
       */ 
!     virtual void put_state (ogzstream& out) const;
      
      /** 
!      * Loads the basic %event %date from a file. Call this method from 
!      * the derived class.
       * 
!      * @param in file to load the %event from.
!      * @return \e true if the %event could be loaded, \e false otherwise
       */
!     virtual bool get_state (igzstream& in);
  
!     //@}
!     
  protected:
+ #ifndef SWIG
      /**
!      * @name Basic Event Data
!      */
!     //@{
!     
!     /**
!      * Event type - see enum above.
       */ 
!     u_int8 Type;
  
      /**
!      * What happens if the event occurs - see enum above.
       */
!     u_int8 Action;
!     
!     /**
!      * Defines how often the %event should be repeated. <b>0</b> means
!      * never, <b>-1</b> means infinitely and <b>n</b> (n > 0) means 
!      * exactly n times.
       */
!     s_int32 Repeat;
!     
!     /**
!      * The Python script accociated with this %event. It is executed
!      * whenever the %event gets triggered.
       */
!     py_object *Script; 
  
!     /**
!      * The arguments passed to the script. This needs to be a PyTuple
!      * or NULL if there are no arguments.
       */
!     PyObject *Args;
      
!     /**
!      * Python callback that may be executed instead of the script.
!      */
!     py_callback *PyFunc;
!     
!     /**
!      * C++ callback that may be executed when the %event gets triggered.
!      */
!     Functor0 Callback;
!     //@}
! #endif // SWIG
  };
  
! #endif // EVENT_H__

Index: gamedata.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gamedata.cc,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** gamedata.cc 26 May 2002 09:27:27 -0000      1.19
--- gamedata.cc 9 Aug 2002 20:01:26 -0000       1.20
***************
*** 37,41 ****
  // File format versions of the various data files
  // *** Increase when changing file format! ***
! #define ENGINE_DAT_VER  1
  #define AUDIO_DAT_VER   2
  #define CHAR_DAT_VER    4
--- 37,41 ----
  // File format versions of the various data files
  // *** Increase when changing file format! ***
! #define ENGINE_DAT_VER  2
  #define AUDIO_DAT_VER   2
  #define CHAR_DAT_VER    4

Index: gametime.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gametime.cc,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** gametime.cc 10 Nov 2001 16:15:14 -0000      1.10
--- gametime.cc 9 Aug 2002 20:01:26 -0000       1.11
***************
*** 2,6 ****
     $Id$
  
!    Copyright (C) 2001 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
--- 2,6 ----
     $Id$
  
!    Copyright (C) 2001/2002 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
***************
*** 18,66 ****
   * @author Kai Sterker
   * @brief Implements the gametime class.
!  */
  
- #include <string>
- #include "event.h"
  #include "gametime.h"
  #include <SDL/SDL.h>
  
! 
  u_int32 gametime::timer1;
  u_int32 gametime::timer2;
! u_int8 gametime::fts = 0;
! bool gametime::running = false; 
! 
! NEW_EVENT(time_event)
  
! gametime::gametime (u_int32 start, float ratio)
  {     
-     ticks = 0;
-     time = start;
-     
      fts = 0; 
      timer1 = 0;
      timer2 = 0;
      
!     // This decides how many realtime milliseconds make one gametime minute
!     minute = (int) (60000 * ratio);
      
!     REGISTER_EVENT (TIME_EVENT, time_event)
! }
! 
! // Increase gametime 
! void gametime::tick (u_int32 val)
! {
!     ticks += val;
! 
!     // notify the eventhandler whenever a minute has passed
!     if (ticks >= minute)
!     {
!         ticks -= minute;
!         time++;
! 
!         time_event t;
!         t.time = time;
!         event_handler::raise_event (t);
!     }
  }
  
--- 18,47 ----
   * @author Kai Sterker
   * @brief Implements the gametime class.
!   */
  
  #include "gametime.h"
  #include <SDL/SDL.h>
  
! float gametime::Minute;
  u_int32 gametime::timer1;
  u_int32 gametime::timer2;
! u_int8 gametime::fts;
! bool gametime::running; 
  
! // initialize the gametime class
! void gametime::init (u_int16 rt_minutes)
  {     
      fts = 0; 
      timer1 = 0;
      timer2 = 0;
      
!     running = false;
      
!     // Number of game cycles during rt_minutes realtime minutes
!     float cycles = (60000 * rt_minutes) / (float) CYCLE_LENGTH;
!     
!     // Calculate how many game cycles make one gametime minute,
!     // so that one gametime day lasts rt_minutes realtime minutes.
!     Minute = cycles / 1440;
  }
  
***************
*** 70,75 ****
      // We declare this variable as static to avoid having to
      // perform the division every time.
!     // This value correspond to the minimum delay before between
!     // Two displayed frames (see FRAME_RATE).
      static u_int16 gfx_cycle_length = 1000 / FRAME_RATE;
      
--- 51,56 ----
      // We declare this variable as static to avoid having to
      // perform the division every time.
!     // Its value corresponds to the minimum delay between
!     // two displayed frames (see FRAME_RATE).
      static u_int16 gfx_cycle_length = 1000 / FRAME_RATE;
      
***************
*** 91,188 ****
      fts = timer2 / CYCLE_LENGTH;
      if (fts > FTS_LIMIT) fts = FTS_LIMIT;
- }
- 
- time_event::time_event ()
- {
-     time = minute = hour = day =  0;
-     m_step = h_step = d_step = 1;
-     type = TIME_EVENT;
- }
- 
- // Save a time_event to file
- void time_event::save (ogzstream& out) const
- {
-     type >> out;
-     minute >> out;
-     m_step >> out;
-     hour >> out;
-     h_step >> out;
-     day >> out;
-     d_step >> out;
-     script_file () >> out;
- }
- 
- // Load a time event from file
- bool time_event::load (igzstream& f)
- {
-     string s; 
-     minute << f;
-     m_step << f;
-     hour << f;
-     h_step << f;
-     day << f;
-     d_step << f;
-     s << f;
-     set_script (s);
-     
-     return true;
- }
- 
- // Execute time event's script
- void time_event::execute (event &e)
- {
-     time_event t = (time_event&) e; 
- 
-     // Build the event script's local namespace
-     PyObject *locals = Py_BuildValue ("{s:i,s:i,s:i}", "minute", (int) 
t.minute, 
-         "hour", (int) t.hour, "day", (int) t.day);
- //     script.set_locals (locals);
-     script.run ();
- //     script.set_locals (NULL); 
-     
-     // Cleanup
-     Py_DECREF (locals);
- #ifdef PY_DEBUG
-     python::show_traceback ();
- #endif // PY_DEBUG
- }
- 
- // Check whether this time_even matches a given gametime
- bool time_event::equals (event &e)
- {
-     time_event t = (time_event &) e;
-     u_int32 time = t.time % 40320;
-     u_int32 d, h, m = time % 60;
-     
-     if (m_step != 0) {
-         if ((m - minute) % m_step != 0 || m < minute) return 0;
-     }
-     else
-         if (m != minute) return 0;
- 
-     // this is the current hour
-     h = ((time - m) % 1440) / 60;
- 
-     if (h_step != 0) {
-         if ((h - hour) % h_step != 0 || h < hour) return 0;
-     }
-     else
-         if (h != hour) return 0;
-          
-     // this is the current day
-     d = (time - (m + h * 60)) / 1440;
-     
-     if (d_step != 0) {
-         if ((d - day) % d_step != 0 || d < day) return 0; 
-     }
-     else
-         if (d != day) return 0;
- 
-     // if the event matches, we set the actual minute, hour and day,
-     // in case it is needed in the script
-     t.minute = m;
-     t.hour = h;
-     t.day = d;
-     
-     return 1;
  }
--- 72,74 ----

Index: gametime.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/gametime.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** gametime.h  10 Nov 2001 16:15:14 -0000      1.11
--- gametime.h  9 Aug 2002 20:01:26 -0000       1.12
***************
*** 2,6 ****
     $Id$
  
!    Copyright (C) 2001 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
--- 2,6 ----
     $Id$
  
!    Copyright (C) 2001/2002 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
***************
*** 23,43 ****
  #define GAMETIME_H_
  
! #include "event.h"
! 
  
  /**
   * Length of a %game cycle, in milliseconds. Decrease it to speed up
!  * the %game, increase it to slow the %game down.
!  * This constant implicitly defines the maximum number of frames per 
!  * second (FPS): FPS = 1000 / CYCLE_LENGTH.
   */ 
  #define CYCLE_LENGTH 13
  
  /**
!  * Number of maximum displayed frames per second. This value only affect
!  * the renderer, and not the speed of the game itself. The choice has been
!  * made to allow this option so Adonthell doesn't eat all the CPU of the
!  * machine it runs on.
!  * 
   */ 
  #define FRAME_RATE 50
--- 23,41 ----
  #define GAMETIME_H_
  
! #include "types.h"
  
  /**
   * Length of a %game cycle, in milliseconds. Decrease it to speed up
!  * the %game, increase it to slow the %game down.  This constant 
!  * defines how often the state of the game world is updated. 
!  * A cycle length of 13 means 1000/13 = 76.9 updates per second. 
   */ 
  #define CYCLE_LENGTH 13
  
  /**
!  * Number of maximum displayed frames per second. This value affects
!  * the renderer only, not the speed of the game itself. Limiting the 
!  * frame rate prevents Adonthell from using all the CPU of the
!  * machine it runs on (as long as the machine is fast enough).
   */ 
  #define FRAME_RATE 50
***************
*** 49,63 ****
   * skip frames so that the correct number of updates can be performed,
   * thus keeping the speed constant. However, we can't skip too many
!  * frames, since that would perform in jerky animations and eventually
   * render the %game unplayable.
   */ 
  #define FTS_LIMIT 20
  
  class gametime
  {
  public:
!     gametime (u_int32, float);      // constructor
!     void tick (u_int32);            // Increase the gametime
  
      static void start_action ()
      {
--- 47,87 ----
   * skip frames so that the correct number of updates can be performed,
   * thus keeping the speed constant. However, we can't skip too many
!  * frames, since that would result in jerky animations and eventually
   * render the %game unplayable.
   */ 
  #define FTS_LIMIT 20
  
+ /**
+  * Tehe %gametime class makes the speed of the %game independent of 
+  * the machine it runs on. This is achieved by keeping the number of 
+  * updates to the %game state constant, no matter how fast or slow 
+  * the machine. This won't work for very slow machines of course, 
+  * but Adonthell will still be playable on a 100 Ghz CPU.
+  */
  class gametime
  {
  public:
!     /**
!      * Initialize the gametime class.
!      *
!      * @param rt_minutes Defines how many real life minutes make one
!      *      gametime day. 
!      */
!     static void init (u_int16 rt_minutes);
! 
!     /**
!      * Return the in-game time that passed since the last call to
!      * this method. 
!      *
!      * @return %gametime in minutes.
!      */
!     static float minute ()
!     {
!         return Minute;
!     }
  
+     /**
+      *
+      */
      static void start_action ()
      {
***************
*** 66,69 ****
--- 90,96 ----
      }
      
+     /**
+      *
+      */
      static void stop_action () 
      {
***************
*** 71,74 ****
--- 98,105 ----
      }
  
+     /**
+      * @name Methods to sync the %game speed to the machine it runs on
+      */
+     //@{
      /** 
       * Returns the number of updates to perform before drawing
***************
*** 90,94 ****
        * delays the execution and for slower boxes it calculates the
        * number of frames to skip. If the engine should do 50 frames per
!       * second, for example, but the main loop takes 40ms to perform,
        * every second frame will be skipped to keep the %game' speed
        * constant.
--- 121,125 ----
        * delays the execution and for slower boxes it calculates the
        * number of frames to skip. If the engine should do 50 frames per
!       * second, for example, but the main loop takes 26ms to perform,
        * every second frame will be skipped to keep the %game' speed
        * constant.
***************
*** 98,106 ****
        */
      static void update (); 
      
  private:
!     u_int32 ticks;                  // Realtime in Milliseconds
!     u_int32 minute;                 // 1 min gametime in (realtime) 
milliseconds
!     u_int32 time;                   // Gametime in "minutes"
  
      static bool running; 
--- 129,138 ----
        */
      static void update (); 
+     //@}
      
  private:
! #ifndef SWIG
!     // One minute of gametime in game cycles
!     static float Minute;
  
      static bool running; 
***************
*** 111,135 ****
      // Timers used to calculate the delay between 2 update() calls.
      static u_int32 timer1, timer2;
! };
! 
! // To notify at a certain time
! class time_event : public event
! {
! public:
!     time_event ();
!     void save (ogzstream&) const;   // Save event data
! 
!     u_int8 minute;                  // 0 - 59
!     u_int8 m_step;                  // 0, 1, 2, ...
!     u_int8 hour;                    // 0 - 23
!     u_int8 h_step;                  // 0, 1, 2, ...
!     u_int8 day;                     // 0 - 27
!     u_int8 d_step;                  // 0, 1, 2, ...
!     u_int32 time;                   // the actual gametime in minutes
! 
! protected:
!     void execute (event& e);        // Run the event's script
!     bool equals (event&);           // Compare two events
!     bool load (igzstream&);         // Load event data
  };
  
--- 143,147 ----
      // Timers used to calculate the delay between 2 update() calls.
      static u_int32 timer1, timer2;
! #endif // SWIG
  };
  

Index: landmap.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/landmap.cc,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** landmap.cc  28 Jun 2002 12:15:20 -0000      1.19
--- landmap.cc  9 Aug 2002 20:01:26 -0000       1.20
***************
*** 25,147 ****
  using namespace std; 
  
- /** 
-  * Returns a newly allocated enter_event.
-  *  
-  */ 
- NEW_EVENT(enter_event); 
- 
- /** 
-  * Returns a newly allocated leave_event.
-  *  
-  */ 
- NEW_EVENT(leave_event); 
- 
- /** 
-  * Returns a newly allocated action_event.
-  *  
-  */ 
- NEW_EVENT(action_event); 
- 
- enter_event::enter_event () : base_map_event ()
- {
-     type = ENTER_EVENT; 
- }
- 
- leave_event::leave_event () : base_map_event ()
- {
-     type = LEAVE_EVENT; 
- }
- 
- action_event::action_event () : base_map_event ()
- {
-     type = ACTION_EVENT; 
- }
- 
- base_map_event::base_map_event ()
- {
-     submap = x = y = dir = map = -1;
-     c = NULL;
- }
- 
- // compare two enter events
- bool base_map_event::equals (event &e)
- {
-     // we know that we've got an enter_event :)
-     base_map_event tmp = (base_map_event &) e;
- 
-     if (submap != -1 && tmp.submap != submap) return false;
-     if (x != -1 && tmp.x != x) return false;
-     if (y != -1 && tmp.y != y) return false;
-     if (dir != -1 && tmp.dir != dir) return false;
-     if (map != -1 && tmp.map != map) return false;
-     if (c && tmp.c != c) return false;
-     
-     return true;
- }
- 
- // Execute enter event's script
- void base_map_event::execute (event& e)
- {
-     base_map_event t = (base_map_event&) e; 
-     
-     PyObject * args = Py_BuildValue ("(i, i, i, i, s)", t.submap, t.x, t.y,
-                                      t.dir, t.c->get_id ().c_str ());  
-     
-     // Execute script
-     script.run (args);
-     
-     // Cleanup
-     Py_DECREF (args);
- }
- 
- // Load a enter event from file
- bool base_map_event::load (igzstream& f)
- {
-     string name;
-     string s; 
-     
-     submap << f; 
-     x << f;
-     y << f;
- 
-     dir << f;
-     map << f;
- 
-     s << f;
-     if (s != "") c = (mapcharacter*) data::characters[s.c_str ()];
-     else c = NULL; 
-     
-     event::get_script_state (f); 
- 
-     return true;
- }
- 
- // Save map event to file
- void base_map_event::save (ogzstream& out) const
- {
-     type >> out;
-     submap >> out; 
-     x >> out;
-     y >> out;
-     dir >> out;
-     map >> out;
-     
-     if (c) c->get_id () >> out;
-     else 
-     {
-         string s = ""; 
-         s >> out;
-     }
- 
-     event::put_script_state (out); 
- }  
  
  landmap::landmap () : event_list () 
  {
-     // doing this here means some slight overhead, but at least
-     // its safe and we don't have additional dependencies.
-     REGISTER_EVENT (ENTER_EVENT, enter_event)
-     REGISTER_EVENT (LEAVE_EVENT, leave_event) 
-     REGISTER_EVENT (ACTION_EVENT, action_event) 
  }
  
--- 25,31 ----
***************
*** 328,332 ****
      
      // try to load event list
!     if (!event_list::load (file))
          return false;
      
--- 212,216 ----
      
      // try to load event list
!     if (!event_list::get_state (file))
          return false;
      
***************
*** 352,356 ****
      
      // save all events attached to this map
!     event_list::save (file); 
      
      // Save the mapcharacters and their status
--- 236,240 ----
      
      // save all events attached to this map
!     event_list::put_state (file); 
      
      // Save the mapcharacters and their status

Index: landmap.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/landmap.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** landmap.h   1 Sep 2001 14:21:21 -0000       1.24
--- landmap.h   9 Aug 2002 20:01:26 -0000       1.25
***************
*** 2,6 ****
     $Id$
  
!    Copyright (C) 1999/2000/2001   Alexandre Courbot
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
--- 2,6 ----
     $Id$
  
!    Copyright (C) 1999/2000/2001 Alexandre Courbot
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
***************
*** 28,32 ****
  #include "mapcharacter.h"
  #include "mapsquare.h"
! #include "event.h"
  
  #include <string>
--- 28,32 ----
  #include "mapcharacter.h"
  #include "mapsquare.h"
! #include "event_list.h"
  
  #include <string>
***************
*** 34,155 ****
  #include <list>
  
! /// Subdirectory where maps are saved.
  #define MAPS_DIR "maps/"
  
- 
  class mapview;
- 
- 
- /**
-  * Baseclass for map enter/leave/action events.
-  * The event will be launched if all the member's data matches.
-  *
-  */ 
- class base_map_event : public event
- {
- public:
-     /**
-      * Default constructor.
-      * 
-      */ 
-     base_map_event ();
- 
-     void save (ogzstream&) const;
- 
-     bool load (igzstream&);
- 
-     /**
-      * Submap index (-1 for any).
-      * 
-      */
-     s_int32 submap;
- 
-     /**
-      * X position (-1 for any).
-      * 
-      */
-     s_int32 x;
- 
-     /**
-      * Y position (-1 for any).
-      * 
-      */
-     s_int32 y;
- 
-     /**
-      * Direction where the character is looking (-1 for any).
-      * 
-      */ 
-     s_int8 dir;
- 
-     /**
-      * Useless (for now).
-      * 
-      */ 
-     s_int32 map;
- 
-     /**
-      * Pointer to the mapcharacter that can launch this event (NULL for any).
-      * 
-      */ 
-     mapcharacter *c;
- 
- protected:
- 
-     void execute (event& e);
-     bool equals (event& ev);
- 
- #ifndef SWIG
-     friend class event_list;
- #endif
- };
- 
- 
- 
- /**
-  * To notify when a character entered a mapsquare.
-  *
-  */ 
- class enter_event : public base_map_event
- {
- public:
-     /**
-      * Default constructor.
-      * 
-      */ 
-     enter_event ();
- };
- 
- 
- 
- /**
-  * To notify when a mapcharacter left a mapsquare.
-  *
-  */ 
- class leave_event : public base_map_event
- {
- public:
-     /**
-      * Default constructor.
-      * 
-      */ 
-     leave_event ();
- };
- 
- /**
-  * To notify when a mapcharacter "act" on a square.
-  *
-  */ 
- class action_event : public base_map_event
- {
- public:
-     /**
-      * Default constructor.
-      * 
-      */ 
-     action_event ();
- };
- 
- 
  
  /**
--- 34,43 ----
  #include <list>
  
! /**
!  * Subdirectory where maps are saved.
!  */
  #define MAPS_DIR "maps/"
  
  class mapview;
  
  /**

Index: main.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/main.cc,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -r1.49 -r1.50
*** main.cc     29 Jul 2002 13:00:49 -0000      1.49
--- main.cc     9 Aug 2002 20:01:26 -0000       1.50
***************
*** 25,30 ****
--- 25,32 ----
  #include "audio.h"
  #include "character.h"
+ #include "event_handler.h"
  #include "game.h"
  #include "gamedata.h"
+ #include "gametime.h"
  #include "input.h"
  #include "nls.h"
***************
*** 155,158 ****
--- 157,167 ----
      // init window manager
      win_manager::init (); 
+ 
+     // event system
+     event_handler::init ();
+ 
+     // gametime system
+     // (180 realtime minutes make approx. 1 gametime day)
+     gametime::init (180);
  
      // init random number generator

Index: mapcharacter.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/mapcharacter.cc,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -r1.40 -r1.41
*** mapcharacter.cc     28 Jun 2002 12:15:20 -0000      1.40
--- mapcharacter.cc     9 Aug 2002 20:01:26 -0000       1.41
***************
*** 2,6 ****
     $Id$
  
!    Copyright (C) 1999/2000/2001   Alexandre Courbot
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
--- 2,6 ----
     $Id$
  
!    Copyright (C) 1999/2000/2001/2002 Alexandre Courbot
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
***************
*** 13,18 ****
  */
  
- 
- 
  /** 
   * @file mapcharacter.cc
--- 13,16 ----
***************
*** 22,28 ****
   */
   
! 
! 
! #include "mapcharacter.h" 
  #include "landmap.h"
  #include "win_manager.h"
--- 20,26 ----
   */
   
! #include "mapcharacter.h"
! #include "map_event.h"
! #include "event_handler.h"
  #include "landmap.h"
  #include "win_manager.h"
***************
*** 31,38 ****
  
  
- 
  // Public methods
- 
- 
  mapcharacter::mapcharacter () : mapsquare_walkable_area (), character_base ()
  {
--- 29,33 ----

Index: py_adonthell.i
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/py_adonthell.i,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** py_adonthell.i      13 Apr 2002 11:05:10 -0000      1.32
--- py_adonthell.i      9 Aug 2002 20:01:26 -0000       1.33
***************
*** 5,11 ****
  #include <string>
  #include "types.h"
  #include "storage.h"
- #include "event.h"
  #include "gametime.h"
  #include "SDL_keysym.h"
  #include "input.h"
--- 5,15 ----
  #include <string>
  #include "types.h"
+ #include "time_event.h"
+ #include "map_event.h"
+ #include "event_list.h"
+ #include "event_handler.h"
  #include "storage.h"
  #include "gametime.h"
+ #include "gamedate.h"
  #include "SDL_keysym.h"
  #include "input.h"
***************
*** 129,135 ****
  %include "types.h"
  %include "fileops.h"
- %include "storage.h"
  %include "event.h"
  %include "gametime.h"
  %include "SDL_keysym.h"
  %include "input.h"
--- 133,144 ----
  %include "types.h"
  %include "fileops.h"
  %include "event.h"
+ %include "event_list.h"
+ %include "time_event.h"
+ %include "map_event.h"
+ %include "event_handler.h"
+ %include "storage.h"
  %include "gametime.h"
+ %include "gamedate.h"
  %include "SDL_keysym.h"
  %include "input.h"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]