[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Adonthell-commits] CVS: adonthell/src event.cc,1.21,1.22 event.h,1.31,
From: |
Kai Sterker <address@hidden> |
Subject: |
[Adonthell-commits] CVS: adonthell/src event.cc,1.21,1.22 event.h,1.31,1.32 event_handler.h,1.4,1.5 event_list.cc,1.5,1.6 fileops.cc,1.11,1.12 fileops.h,1.16,1.17 map_event.cc,1.3,1.4 py_object.cc,1.15,1.16 time_event.cc,1.4,1.5 time_event.h,1.6,1.7 |
Date: |
Mon, 20 Jan 2003 15:18:46 -0500 |
Update of /cvsroot/adonthell/adonthell/src
In directory subversions:/tmp/cvs-serv17648
Modified Files:
event.cc event.h event_handler.h event_list.cc fileops.cc
fileops.h map_event.cc py_object.cc time_event.cc time_event.h
Log Message:
IMPROVED fileops Python wrapping
FIXED serious bug of paused time_events blocking time_event_handler
Index: event.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/event.cc,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** event.cc 20 Jan 2003 00:15:41 -0000 1.21
--- event.cc 20 Jan 2003 20:18:43 -0000 1.22
***************
*** 217,220 ****
--- 217,234 ----
}
+ // disable the event temporarily
+ void event::pause ()
+ {
+ event_handler::remove_event (this);
+ Paused = true;
+ }
+
+ // resume a disabled event
+ void event::resume ()
+ {
+ event_handler::register_event (this);
+ Paused = false;
+ }
+
// repeat an event
s_int32 event::do_repeat ()
Index: event.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/event.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -r1.31 -r1.32
*** event.h 17 Jan 2003 21:53:39 -0000 1.31
--- event.h 20 Jan 2003 20:18:43 -0000 1.32
***************
*** 2,6 ****
$Id$
! Copyright (C) 2000/2001/2002 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
--- 2,6 ----
$Id$
! Copyright (C) 2000/2001/2002/2003 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
***************
*** 215,232 ****
* Disable the %event temporarily. As long as it in this state, the
* event will neither be executed, nor will its repeat-count change.
*/
! virtual void pause ()
! {
! Paused = true;
! }
/**
! * Re-enable an %event that has been paused.
*/
! virtual void resume ()
{
! Paused = false;
}
-
//@}
--- 215,237 ----
* Disable the %event temporarily. As long as it in this state, the
* event will neither be executed, nor will its repeat-count change.
+ * As long as the %event is paused, it will be removed from its
+ * %event handler.
*/
! virtual void pause ();
/**
! * Re-enable an %event that has been paused. Re-registers it with
! * its %event handler.
! */
! virtual void resume ();
!
! /**
! * Check whether the %event is temporarily disabled or not.
! * @return \b true if it is paused, \b false otherwise.
*/
! bool is_paused () const
{
! return Paused;
}
//@}
Index: event_handler.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/event_handler.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** event_handler.h 18 Aug 2002 19:53:16 -0000 1.4
--- event_handler.h 20 Jan 2003 20:18:43 -0000 1.5
***************
*** 2,6 ****
$Id$
! Copyright (C) 2000/2001/2002 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
--- 2,6 ----
$Id$
! Copyright (C) 2000/2001/2002/2003 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
***************
*** 85,88 ****
--- 85,93 ----
friend void event_list::add_event (event* ev);
+ /**
+ * As is event::resume.
+ */
+ friend void event::resume ();
+
private:
/**
Index: event_list.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/event_list.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** event_list.cc 21 Aug 2002 15:25:45 -0000 1.5
--- event_list.cc 20 Jan 2003 20:18:43 -0000 1.6
***************
*** 2,6 ****
$Id$
! Copyright (C) 2000/2001/2002 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
--- 2,6 ----
$Id$
! Copyright (C) 2000/2001/2002/2003 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
***************
*** 60,65 ****
ev->set_list (this);
Events.push_back (ev);
if (Paused) ev->pause ();
! event_handler::register_event (ev);
}
--- 60,69 ----
ev->set_list (this);
Events.push_back (ev);
+
+ // if the event list is paused, also pause new events
if (Paused) ev->pause ();
!
! // only register event if not paused
! else if (ev->is_paused ()) event_handler::register_event (ev);
}
Index: fileops.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/fileops.cc,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** fileops.cc 20 Jan 2003 00:15:41 -0000 1.11
--- fileops.cc 20 Jan 2003 20:18:43 -0000 1.12
***************
*** 89,96 ****
/// Reads a boolean.
! bool igzstream::get_bool (igzstream& gfile)
{
u_int8 b;
! gzread (gfile.file, &b, sizeof (b));
return b;
}
--- 89,96 ----
/// Reads a boolean.
! bool igzstream::get_bool ()
{
u_int8 b;
! gzread (file, &b, sizeof (b));
return b;
}
***************
*** 103,106 ****
--- 103,107 ----
}
+ /// Read a block of size chars
void igzstream::get_block (void * to, u_int32 size)
{
***************
*** 116,123 ****
/// Reads a u_int8.
! u_int8 igzstream::get_uint8 (igzstream& gfile)
{
u_int8 n;
! gzread (gfile.file, &n, sizeof (n));
return n;
}
--- 117,124 ----
/// Reads a u_int8.
! u_int8 igzstream::get_uint8 ()
{
u_int8 n;
! gzread (file, &n, sizeof (n));
return n;
}
***************
*** 131,138 ****
/// Reads a s_int8.
! s_int8 igzstream::get_sint8 (igzstream& gfile)
{
s_int8 n;
! gzread (gfile.file, &n, sizeof (n));
return n;
}
--- 132,139 ----
/// Reads a s_int8.
! s_int8 igzstream::get_sint8 ()
{
s_int8 n;
! gzread (file, &n, sizeof (n));
return n;
}
***************
*** 142,155 ****
{
gzread(gfile.file, &n, sizeof (n));
! n = SDL_SwapLE16(n);
! return n;
}
/// Reads a u_int16.
! u_int16 igzstream::get_uint16 (igzstream& gfile)
{
u_int16 n;
! gzread (gfile.file, &n, sizeof (n));
! return n;
}
--- 143,155 ----
{
gzread(gfile.file, &n, sizeof (n));
! return SDL_SwapLE16(n);
}
/// Reads a u_int16.
! u_int16 igzstream::get_uint16 ()
{
u_int16 n;
! gzread (file, &n, sizeof (n));
! return SDL_SwapLE16(n);
}
***************
*** 158,171 ****
{
gzread(gfile.file, &n, sizeof (n));
! n = SDL_SwapLE16(n);
! return n;
}
/// Reads a s_int16.
! s_int16 igzstream::get_sint16 (igzstream& gfile)
{
s_int16 n;
! gzread (gfile.file, &n, sizeof (n));
! return n;
}
--- 158,170 ----
{
gzread(gfile.file, &n, sizeof (n));
! return SDL_SwapLE16(n);
}
/// Reads a s_int16.
! s_int16 igzstream::get_sint16 ()
{
s_int16 n;
! gzread (file, &n, sizeof (n));
! return SDL_SwapLE16(n);
}
***************
*** 174,187 ****
{
gzread(gfile.file, &n, sizeof (n));
! n = SDL_SwapLE32(n);
! return n;
}
/// Reads a u_int32.
! u_int32 igzstream::get_uint32 (igzstream& gfile)
{
u_int32 n;
! gzread (gfile.file, &n, sizeof (n));
! return n;
}
--- 173,185 ----
{
gzread(gfile.file, &n, sizeof (n));
! return SDL_SwapLE32(n);
}
/// Reads a u_int32.
! u_int32 igzstream::get_uint32 ()
{
u_int32 n;
! gzread (file, &n, sizeof (n));
! return SDL_SwapLE32(n);
}
***************
*** 190,203 ****
{
gzread(gfile.file, &n, sizeof (n));
! n = SDL_SwapLE32(n);
! return n;
}
/// Reads a s_int32.
! s_int32 igzstream::get_sint32 (igzstream& gfile)
{
s_int32 n;
! gzread (gfile.file, &n, sizeof (n));
! return n;
}
--- 188,200 ----
{
gzread(gfile.file, &n, sizeof (n));
! return SDL_SwapLE32(n);
}
/// Reads a s_int32.
! s_int32 igzstream::get_sint32 ()
{
s_int32 n;
! gzread (file, &n, sizeof (n));
! return SDL_SwapLE32(n);
}
***************
*** 219,226 ****
/// Reads a string.
! string igzstream::get_string (igzstream& gfile)
{
string s;
! s << gfile;
return s;
}
--- 216,223 ----
/// Reads a string.
! string igzstream::get_string ()
{
string s;
! s << *this;
return s;
}
***************
*** 239,246 ****
/// Reads a float.
! float igzstream::get_float (igzstream& gfile)
{
float f;
! f << gfile;
return f;
}
--- 236,243 ----
/// Reads a float.
! float igzstream::get_float ()
{
float f;
! f << *this;
return f;
}
Index: fileops.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/fileops.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** fileops.h 20 Jan 2003 00:15:41 -0000 1.16
--- fileops.h 20 Jan 2003 20:18:43 -0000 1.17
***************
*** 203,215 ****
#endif
! bool get_bool (igzstream& gfile);
! u_int8 get_uint8 (igzstream& gfile);
! s_int8 get_sint8 (igzstream& gfile);
! u_int16 get_uint16 (igzstream& gfile);
! s_int16 get_sint16 (igzstream& gfile);
! u_int32 get_uint32 (igzstream& gfile);
! s_int32 get_sint32 (igzstream& gfile);
! string get_string (igzstream& gfile);
! float get_float (igzstream& gfile);
private:
--- 203,215 ----
#endif
! bool get_bool ();
! u_int8 get_uint8 ();
! s_int8 get_sint8 ();
! u_int16 get_uint16 ();
! s_int16 get_sint16 ();
! u_int32 get_uint32 ();
! s_int32 get_sint32 ();
! string get_string ();
! float get_float ();
private:
***************
*** 295,307 ****
#endif
! void put_bool (const bool &n, ogzstream& gfile) { n >> gfile; }
! void put_uint8 (const u_int8 &n, ogzstream& gfile) { n >> gfile; }
! void put_sint8 (const s_int8 &n, ogzstream& gfile) { n >> gfile; }
! void put_uint16 (const u_int16 &n, ogzstream& gfile) { n >> gfile; }
! void put_sint16 (const s_int16 &n, ogzstream& gfile) { n >> gfile; }
! void put_uint32 (const u_int32 &n, ogzstream& gfile) { n >> gfile; }
! void put_sint32 (const s_int32 &n, ogzstream& gfile) { n >> gfile; }
! void put_string (const string& s, ogzstream& gfile) { s >> gfile; }
! void put_float (const float &n, ogzstream& gfile) { n >> gfile; }
private:
--- 295,307 ----
#endif
! void put_bool (const bool &n) { n >> *this; }
! void put_uint8 (const u_int8 &n) { n >> *this; }
! void put_sint8 (const s_int8 &n) { n >> *this; }
! void put_uint16 (const u_int16 &n) { n >> *this; }
! void put_sint16 (const s_int16 &n) { n >> *this; }
! void put_uint32 (const u_int32 &n) { n >> *this; }
! void put_sint32 (const s_int32 &n) { n >> *this; }
! void put_string (const string& s) { s >> *this; }
! void put_float (const float &n) { n >> *this; }
private:
Index: map_event.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/map_event.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** map_event.cc 20 Aug 2002 17:40:40 -0000 1.3
--- map_event.cc 20 Jan 2003 20:18:43 -0000 1.4
***************
*** 2,6 ****
$Id$
! Copyright (C) 2002 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
--- 2,6 ----
$Id$
! Copyright (C) 2002/2003 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
***************
*** 32,38 ****
bool map_event::equals (const event* e)
{
- // if our event is paused, this will prevent it from getting executed
- if (Paused) return false;
-
// we know that we've got a map_event :)
map_event *t = (map_event *) e;
--- 32,35 ----
Index: py_object.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/py_object.cc,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** py_object.cc 18 Jan 2003 23:22:59 -0000 1.15
--- py_object.cc 20 Jan 2003 20:18:43 -0000 1.16
***************
*** 2,6 ****
$Id$
! Copyright (C) 1999/2000/2001 Kai Sterker
Copyright (C) 2001 Alexandre Courbot
Part of the Adonthell Project http://adonthell.linuxgames.com
--- 2,6 ----
$Id$
! Copyright (C) 1999/2000/2001/2003 Kai Sterker
Copyright (C) 2001 Alexandre Courbot
Part of the Adonthell Project http://adonthell.linuxgames.com
Index: time_event.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/time_event.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** time_event.cc 20 Aug 2002 17:40:40 -0000 1.4
--- time_event.cc 20 Jan 2003 20:18:43 -0000 1.5
***************
*** 2,6 ****
$Id$
! Copyright (C) 2002 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
--- 2,6 ----
$Id$
! Copyright (C) 2002/2003 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
***************
*** 77,84 ****
void time_event::pause ()
{
- event::pause ();
-
// save time 'til relative event is raised
if (!Absolute) Time -= gamedate::time ();
}
--- 77,84 ----
void time_event::pause ()
{
// save time 'til relative event is raised
if (!Absolute) Time -= gamedate::time ();
+
+ event::pause ();
}
***************
*** 86,93 ****
void time_event::resume ()
{
- event::resume ();
-
// restore alarm time for relative event
if (!Absolute) Time += gamedate::time ();
}
--- 86,93 ----
void time_event::resume ()
{
// restore alarm time for relative event
if (!Absolute) Time += gamedate::time ();
+
+ event::resume ();
}
Index: time_event.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/time_event.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** time_event.h 20 Aug 2002 17:40:40 -0000 1.6
--- time_event.h 20 Jan 2003 20:18:43 -0000 1.7
***************
*** 2,6 ****
$Id$
! Copyright (C) 2002 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
--- 2,6 ----
$Id$
! Copyright (C) 2002/2003 Kai Sterker <address@hidden>
Part of the Adonthell Project http://adonthell.linuxgames.com
***************
*** 103,107 ****
{
time_event *e = (time_event *) evnt;
! return Time <= e->time () && !Paused;
}
--- 103,107 ----
{
time_event *e = (time_event *) evnt;
! return Time <= e->time ();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Adonthell-commits] CVS: adonthell/src event.cc,1.21,1.22 event.h,1.31,1.32 event_handler.h,1.4,1.5 event_list.cc,1.5,1.6 fileops.cc,1.11,1.12 fileops.h,1.16,1.17 map_event.cc,1.3,1.4 py_object.cc,1.15,1.16 time_event.cc,1.4,1.5 time_event.h,1.6,1.7,
Kai Sterker <address@hidden> <=
- Prev by Date:
[Adonthell-commits] CVS: adonthell/src event.cc,1.20,1.21 fileops.cc,1.10,1.11 fileops.h,1.15,1.16 item_base.h,1.3,1.4 map_event_handler.cc,1.4,1.5 py_adonthell.i,1.34,1.35 time_event_handler.cc,1.5,1.6
- Next by Date:
[Adonthell-commits] CVS: adonthell/src event_list.cc,1.6,1.7 fileops.cc,1.12,1.13
- Previous by thread:
[Adonthell-commits] CVS: adonthell/src event.cc,1.20,1.21 fileops.cc,1.10,1.11 fileops.h,1.15,1.16 item_base.h,1.3,1.4 map_event_handler.cc,1.4,1.5 py_adonthell.i,1.34,1.35 time_event_handler.cc,1.5,1.6
- Next by thread:
[Adonthell-commits] CVS: adonthell/src event_list.cc,1.6,1.7 fileops.cc,1.12,1.13
- Index(es):