Assert whenever an invalid journal entry is encountered.

This commit is contained in:
Jonathan Moore Liles 2009-09-07 19:53:04 -05:00
parent 942389a503
commit df344dc065
1 changed files with 11 additions and 7 deletions

View File

@ -322,16 +322,14 @@ Loggable::do_this ( const char *s, bool reverse )
{
unsigned int id = 0;
if ( ! ( sscanf( s, "%*s %X ", &id ) > 0 ) )
return false;
Loggable *l = find( id );
// assert( l );
char classname[40];
char command[40];
char *arguments = NULL;
int found = sscanf( s, "%s %X %s ", classname, &id, command );
ASSERT( 3 == found, "Invalid journal entry format \"%s\"", s );
const char *create, *destroy;
if ( reverse )
@ -352,6 +350,8 @@ Loggable::do_this ( const char *s, bool reverse )
if ( ! strcmp( command, destroy ) )
{
Loggable *l = find( id );
/* deleting eg. a track, which contains a list of other
widgets, causes destroy messages to be emitted for all those
widgets, but when replaying the journal the destroy message
@ -365,6 +365,10 @@ Loggable::do_this ( const char *s, bool reverse )
{
// printf( "got set command (%s).\n", arguments );
Loggable *l = find( id );
ASSERT( l, "Unable to find object 0x%X referenced by command \"%s\"", id, s );
Log_Entry e( arguments );
l->log_start();
@ -687,8 +691,8 @@ Loggable::log_create ( void ) const
{
if ( ! _fp )
/* replaying, don't bother */
return;
log( "%s 0x%X create ", class_name(), _id );
Log_Entry e;