| Message |
Well this seems to work. I can't claim the area files are identical afterwards, but that seems to be because the mob progs change their sequence. However the resets seem to match. This is the recursive reset-saver:
void save_reset_level (FILE * fpout, RESET_DATA * start_reset, const int level)
{
int spaces = level * 2;
RESET_DATA * reset;
for( reset = start_reset; reset; )
{
switch ( UPPER (reset->command) ) /* extra arg1 arg2 arg3 */
{
case '*':
break;
default:
fprintf( fpout, "%*.sR %c %d %d %d %d\n", spaces, "",
UPPER( reset->command ),
reset->extra, reset->arg1, reset->arg2, reset->arg3 );
break;
case 'G':
case 'R':
fprintf( fpout, "%*.sR %c %d %d %d\n", spaces, "",
UPPER( reset->command ), reset->extra, reset->arg1, reset->arg2 );
break;
} /* end of switch on command */
/* recurse to save nested resets */
save_reset_level (fpout, reset->first_reset, level + 1);
/* where we go next depends on if this is a top-level reset or not - for some reason */
if (level == 0)
reset = reset->next;
else
reset = reset->next_reset;
} /* end of looping through resets */
} /* end of save_reset_level */
And you replace the reset saving stuff with this line:
save_reset_level (fpout, room->first_reset, 0);
Basically that kicks off saving the first level of resets, and the function above saves the subsequent levels.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|