adonthell-commits
[Top][All Lists]
Advanced

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

[Adonthell-commits] CVS: adonthell/src event_list.cc,1.4,1.5 event_list.


From: Kai Sterker <address@hidden>
Subject: [Adonthell-commits] CVS: adonthell/src event_list.cc,1.4,1.5 event_list.h,1.3,1.4 mapcharacter.cc,1.47,1.48 mapcharacter.h,1.57,1.58 time_event_handler.cc,1.4,1.5
Date: Wed, 21 Aug 2002 11:25:47 -0400

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

Modified Files:
        event_list.cc event_list.h mapcharacter.cc mapcharacter.h 
        time_event_handler.cc 
Log Message:
MOVED event pausing from mapcharacter to event_list, so that new events get the 
proper state
CHANGED time_event_handler so that time_events that are older than the current 
game time can be registered nonetheless


Index: event_list.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/event_list.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** event_list.cc       18 Aug 2002 19:53:16 -0000      1.4
--- event_list.cc       21 Aug 2002 15:25:45 -0000      1.5
***************
*** 29,32 ****
--- 29,38 ----
  new_event event_list::instanciate_event[MAX_EVENTS];
  
+ // constructor
+ event_list::event_list ()
+ {
+     Paused = false;
+ }
+ 
  // destructor
  event_list::~event_list ()
***************
*** 54,57 ****
--- 60,64 ----
      ev->set_list (this);
      Events.push_back (ev);
+     if (Paused) ev->pause ();
      event_handler::register_event (ev); 
  }
***************
*** 67,70 ****
--- 74,93 ----
      // found? -> get rid of it :)
      if (i != Events.end ()) Events.erase (i);
+ }
+ 
+ // disable all events in the list
+ void event_list::pause ()
+ {
+     Paused = true;
+     for (vector<event*>::iterator i = Events.begin (); i != Events.end (); 
i++)
+         (*i)->pause ();
+ }
+ 
+ // enable all events in the list
+ void event_list::resume ()
+ {
+     Paused = false;
+     for (vector<event*>::iterator i = Events.begin (); i != Events.end (); 
i++)
+         (*i)->resume ();
  }
  

Index: event_list.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/event_list.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** event_list.h        18 Aug 2002 19:53:16 -0000      1.3
--- event_list.h        21 Aug 2002 15:25:45 -0000      1.4
***************
*** 52,55 ****
--- 52,60 ----
  public:
      /**
+      * Constructor - creates an empty, unpaused %event_list
+      */
+     event_list ();
+     
+     /**
       * Destructor - unregisters and deletes all events owned by this list.
       */ 
***************
*** 79,82 ****
--- 84,100 ----
      
      /**
+      * Disable any events associated with this %event_list. This will
+      * effectively stop all actions of the %object the %event_list
+      * belongs to, e.g. a NPC.
+      */
+     void pause ();
+     
+     /**
+      * Re-enable the events associated with the %event_list, thus
+      * 'awaking' the %object to life again. 
+      */
+     void resume ();
+ 
+     /**
       * Register an %event for loading. Before the %event_list can load
       * an %event from file, it needs a callback function that returns
***************
*** 119,122 ****
--- 137,146 ----
  
  private:
+     /**
+      * Whether this %event_list is paused or not. Events that are added
+      * to a paused list will be paused as well.
+      */
+     bool Paused;
+ 
      /**
       * Array with callbacks that return a newly allocated instance of an 
%event.

Index: mapcharacter.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/mapcharacter.cc,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -r1.47 -r1.48
*** mapcharacter.cc     20 Aug 2002 17:40:40 -0000      1.47
--- mapcharacter.cc     21 Aug 2002 15:25:45 -0000      1.48
***************
*** 31,35 ****
  
  // Public methods
! mapcharacter::mapcharacter () : mapsquare_walkable_area (), character_base ()
  {
      submap_ = posx_ = posy_ = offx_ = offy_ = 0;
--- 31,35 ----
  
  // Public methods
! mapcharacter::mapcharacter () : mapsquare_walkable_area (), character_base 
(), event_list ()
  {
      submap_ = posx_ = posy_ = offx_ = offy_ = 0;
***************
*** 594,609 ****
      
      Py_XDECREF (callback);
- }
- 
- void mapcharacter::pause ()
- {
-     for (vector<event*>::iterator i = Events.begin (); i != Events.end (); 
i++)
-         (*i)->pause ();
- }
- 
- void mapcharacter::resume ()
- {
-     for (vector<event*>::iterator i = Events.begin (); i != Events.end (); 
i++)
-         (*i)->resume ();
  }
  
--- 594,597 ----

Index: mapcharacter.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/mapcharacter.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -r1.57 -r1.58
*** mapcharacter.h      20 Aug 2002 17:40:40 -0000      1.57
--- mapcharacter.h      21 Aug 2002 15:25:45 -0000      1.58
***************
*** 658,674 ****
  
      /**
-      * Disable any events associated with this character. This will
-      * effectively stop all of its actions (at least if its schedule
-      * is event-driven as it should be.
-      */
-     void pause ();
-     
-     /**
-      * Re-enable the events associated with the character, thus
-      * 'awaking' it to life again. 
-      */
-     void resume ();
- 
-     /**
       * Tell the character to do something. Will execute the given method
       * of the current schedule with the given arguments.
--- 658,661 ----
***************
*** 681,685 ****
      bool do_stuff (string method, PyObject *args = NULL); 
      //@}
- 
  
  
--- 668,671 ----

Index: time_event_handler.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/time_event_handler.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** time_event_handler.cc       18 Aug 2002 19:53:17 -0000      1.4
--- time_event_handler.cc       21 Aug 2002 15:25:45 -0000      1.5
***************
*** 68,78 ****
  void time_event_handler::register_event (event *e)
  {
-     // make sure the event is recent enough
-     if (((time_event *) e)->time () < gamedate::time ())
-     {
-         fprintf (stderr, "*** time_event_handler::register_event: event older 
than current time!\n");
-         return;
-     }
- 
      vector<event*>::iterator i = Events.begin ();
  
--- 68,71 ----





reply via email to

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