savearea.c
Converter/src/savearea.c · 26.2 KB
From the archive converter.tgz
Download the archive « Back to the archive contents
#include <stdio.h>
#include <string.h>
#include "mud.h"
const char *pos_names[] =
{
"dead", "mortal", "incap", "stunned",
"sleeping", "berserk", "resting", "aggressive",
"sitting", "fighting", "defensive", "evasive",
"standing", "mounted", "shove", "drag",
"max"
};
const char *sex_names[] =
{
"neutral", "male", "female", "max"
};
const char *sect_flags[] =
{
"inside", "city", "field", "forest",
"hills", "mountain", "water_swim", "water_noswim",
"underwater", "air", "desert", "dunno",
"oceanfloor", "underground", "lava", "swamp",
"ice", "max"
};
void fwrite_paflocation( FILE *fp, AFFECT_DATA *paf )
{
if( !paf || !fp )
return;
if( paf->location >= 0 && paf->location < MAX_APPLY_TYPE )
fprintf( fp, " '%s'", a_types[paf->location] );
else
fprintf( fp, " '%d'", paf->location );
}
void fwrite_pafmodifier( FILE *fp, AFFECT_DATA *paf )
{
if( !paf || !fp )
return;
if( ( paf->location == APPLY_AFFECT || paf->location == APPLY_EXT_AFFECT ) )
fprintf( fp, " '%s'", flag_string( paf->modifier, a_flags ) );
else if( ( paf->location == APPLY_RESISTANT || paf->location == APPLY_SUSCEPTIBLE || paf->location == APPLY_IMMUNE ) )
fprintf( fp, " '%s'", flag_string( paf->modifier, ris_flags ) );
else if( ( paf->location == APPLY_WEAPONSPELL || paf->location == APPLY_WEARSPELL || paf->location == APPLY_REMOVESPELL || paf->location == APPLY_STRIPSN )
&& IS_VALID_SN( paf->modifier ) )
fprintf( fp, " '%s'", skill_table[paf->modifier]->name );
else
fprintf( fp, " '%d'", paf->modifier );
}
void fwrite_pafbitvector( FILE *fp, AFFECT_DATA *paf )
{
if( !paf || !fp )
return;
if( paf->location == APPLY_EXT_AFFECT && !xIS_EMPTY( paf->bitvector ) )
fprintf( fp, " '%s'", ext_flag_string( &paf->bitvector, a_flags ) );
else
fprintf( fp, " %s", "'-1'" );
}
void fwrite_oiaffect( FILE *fp, AFFECT_DATA *paf )
{
if( !fp || !paf )
return;
for( ; paf; paf = paf->next )
{
/* So many to just ignore lol */
if( paf->location == APPLY_SEX || paf->location == APPLY_CLASS
|| paf->location == APPLY_LEVEL || paf->location == APPLY_AGE
|| paf->location == APPLY_HEIGHT || paf->location == APPLY_WEIGHT
|| paf->location == APPLY_GOLD || paf->location == APPLY_EXP
|| paf->location == APPLY_AC || paf->location == APPLY_SAVING_POISON
|| paf->location == APPLY_SAVING_ROD || paf->location == APPLY_SAVING_PARA
|| paf->location == APPLY_SAVING_BREATH || paf->location == APPLY_SAVING_SPELL
|| paf->location == APPLY_BACKSTAB || paf->location == APPLY_PICK
|| paf->location == APPLY_TRACK || paf->location == APPLY_STEAL
|| paf->location == APPLY_SNEAK || paf->location == APPLY_HIDE
|| paf->location == APPLY_PALM || paf->location == APPLY_DETRAP
|| paf->location == APPLY_DODGE || paf->location == APPLY_PEEK
|| paf->location == APPLY_SCAN || paf->location == APPLY_GOUGE
|| paf->location == APPLY_SEARCH || paf->location == APPLY_MOUNT
|| paf->location == APPLY_DISARM || paf->location == APPLY_KICK
|| paf->location == APPLY_PARRY || paf->location == APPLY_BASH
|| paf->location == APPLY_STUN || paf->location == APPLY_PUNCH
|| paf->location == APPLY_CLIMB || paf->location == APPLY_GRIP
|| paf->location == APPLY_SCRIBE || paf->location == APPLY_BREW
|| paf->location == APPLY_EMOTION || paf->location == APPLY_MENTALSTATE
|| paf->location == APPLY_REMOVE || paf->location == APPLY_DIG
|| paf->location == APPLY_FULL || paf->location == APPLY_THIRST
|| paf->location == APPLY_DRUNK || paf->location == APPLY_COOK
|| paf->location == APPLY_ODOR || paf->location == APPLY_ROOMFLAG
|| paf->location == APPLY_SECTORTYPE || paf->location == APPLY_ROOMLIGHT
|| paf->location == APPLY_TELEVNUM || paf->location == APPLY_TELEDELAY )
continue;
/* If it is blood change it to Mana */
if( paf->location == APPLY_BLOOD )
paf->location = APPLY_MANA;
fprintf( fp, "%s", "NAffect " );
/* Have to change these to how LoP handles them */
if( paf->location == APPLY_STR || paf->location == APPLY_DEX || paf->location == APPLY_WIS
|| paf->location == APPLY_INT || paf->location == APPLY_LCK || paf->location == APPLY_CON
|| paf->location == APPLY_CHA )
{
fprintf( fp, " 'stat' '%d' '%s'", paf->modifier, a_types[paf->location] );
}
else
{
fwrite_paflocation( fp, paf );
fwrite_pafmodifier( fp, paf );
fwrite_pafbitvector( fp, paf );
}
fprintf( fp, "%s", "\n" );
}
}
int save_programs( MPROG_DATA *mprog, FILE *fp )
{
int count = 0;
if( ( mprog->arglist && mprog->arglist[0] != '\0' ) )
{
if( mprog->type == IN_FILE_PROG )
{
fprintf( fp, "> %s %s~\n", mprog_type_to_name( mprog->type ), mprog->arglist );
count++;
}
/* Don't let it save progs which came from files. That would be silly. */
else if( mprog->comlist && mprog->comlist[0] != '\0' && !mprog->fileprog )
{
fprintf( fp, "> %s %s~\n%s~\n", mprog_type_to_name( mprog->type ),
mprog->arglist, strip_cr( mprog->comlist ) );
count++;
}
}
return count;
}
void fold_area( AREA_DATA *tarea, const char *filename )
{
RESET_DATA *pReset, *tReset, *gReset;
ROOM_INDEX_DATA *room;
MOB_INDEX_DATA *pMobIndex;
OBJ_INDEX_DATA *pObjIndex;
MPROG_DATA *mprog;
EXIT_DATA *xit;
EXTRA_DESCR_DATA *ed;
FILE *fp;
char buf[MSL], newfilename[MSL], tempfilename[MSL];
int val0, val1, val2, val3, val4, val5, vnum, low_vnum, hi_vnum;
bool first;
snprintf( newfilename, sizeof( newfilename ), "../area/LOP_%s", filename );
snprintf( tempfilename, sizeof( buf ), "../area/LOP_%s.temp", filename );
log_printf_plus( LOG_NORMAL, LEVEL_LOG, "Saving %s...", newfilename );
if( !( fp = fopen( tempfilename, "w" ) ) )
{
bug( "%s: cant open %s for writing.", __FUNCTION__, newfilename );
perror( newfilename );
return;
}
/* Save area info */
if( tarea->name )
fprintf( fp, "#AREA %s~\n", tarea->name );
if( tarea->author )
fprintf( fp, "#AUTHOR %s~\n", tarea->author );
fprintf( fp, "#RANGES %d %d %d %d\n", tarea->low_soft_range,
tarea->hi_soft_range, tarea->low_hard_range, tarea->hi_hard_range );
if( tarea->resetmsg )
fprintf( fp, "#RESETMSG %s~\n", tarea->resetmsg );
if( tarea->reset_frequency )
fprintf( fp, "#RESETFREQ %d\n", tarea->reset_frequency );
if( tarea->flags )
fprintf( fp, "#FLAGS %s~\n", flag_string( tarea->flags, area_flags ) );
/* save mobiles */
first = true;
low_vnum = tarea->low_m_vnum;
if( tarea->low_r_vnum < low_vnum )
low_vnum = tarea->low_r_vnum;
if( tarea->low_o_vnum < low_vnum )
low_vnum = tarea->low_o_vnum;
hi_vnum = tarea->hi_m_vnum;
if( tarea->hi_r_vnum > hi_vnum )
hi_vnum = tarea->hi_r_vnum;
if( tarea->hi_o_vnum > hi_vnum )
hi_vnum = tarea->hi_o_vnum;
for( vnum = low_vnum; vnum <= hi_vnum; vnum++ )
{
if( !( pMobIndex = get_mob_index( vnum ) ) )
continue;
if( first )
fprintf( fp, "\n#MOBILES\n" );
first = false;
fprintf( fp, "Vnum %d\n", vnum );
if( pMobIndex->level )
fprintf( fp, "Level %d\n", pMobIndex->level );
if( pMobIndex->player_name )
fprintf( fp, "Name %s~\n", strip_cr( pMobIndex->player_name ) );
if( pMobIndex->short_descr )
fprintf( fp, "Short %s~\n", strip_cr( pMobIndex->short_descr ) );
if( pMobIndex->long_descr )
fprintf( fp, "Long %s~\n", strip_cr( pMobIndex->long_descr ) );
if( pMobIndex->description )
fprintf( fp, "Description\n %s~\n", strip_cr( pMobIndex->description ) );
if( !xIS_EMPTY( pMobIndex->act ) )
fprintf( fp, "Flags %s~\n", ext_flag_string( &pMobIndex->act, act_flags ) );
/* Not used in LoP */
xREMOVE_BIT( pMobIndex->affected_by, AFF_HOLD );
/* Not used in LoP */
xREMOVE_BIT( pMobIndex->affected_by, AFF_FLAMING );
/* LoP can understand "paralysis" but not "_paralysis" */
if( !xIS_EMPTY( pMobIndex->affected_by ) )
{
fprintf( fp, "%s", "Affected " );
if( xIS_SET( pMobIndex->affected_by, AFF_PARALYSIS ) )
{
fprintf( fp, "%s", "paralysis " );
xREMOVE_BIT( pMobIndex->affected_by, AFF_PARALYSIS );
}
fprintf( fp, "%s~\n", ext_flag_string( &pMobIndex->affected_by, a_flags ) );
}
if( pMobIndex->xflags )
fprintf( fp, "Parts %s~\n", flag_string( pMobIndex->xflags, part_flags ) );
REMOVE_BIT( pMobIndex->resistant, RIS_HOLD );
REMOVE_BIT( pMobIndex->resistant, RIS_PLUS1 );
REMOVE_BIT( pMobIndex->resistant, RIS_PLUS2 );
REMOVE_BIT( pMobIndex->resistant, RIS_PLUS3 );
REMOVE_BIT( pMobIndex->resistant, RIS_PLUS4 );
REMOVE_BIT( pMobIndex->resistant, RIS_PLUS5 );
REMOVE_BIT( pMobIndex->resistant, RIS_PLUS6 );
if( pMobIndex->resistant )
fprintf( fp, "Resistant %s~\n", flag_string( pMobIndex->resistant, ris_flags ) );
REMOVE_BIT( pMobIndex->immune, RIS_HOLD );
REMOVE_BIT( pMobIndex->immune, RIS_PLUS1 );
REMOVE_BIT( pMobIndex->immune, RIS_PLUS2 );
REMOVE_BIT( pMobIndex->immune, RIS_PLUS3 );
REMOVE_BIT( pMobIndex->immune, RIS_PLUS4 );
REMOVE_BIT( pMobIndex->immune, RIS_PLUS5 );
REMOVE_BIT( pMobIndex->immune, RIS_PLUS6 );
if( pMobIndex->immune )
fprintf( fp, "Immune %s~\n", flag_string( pMobIndex->immune, ris_flags ) );
REMOVE_BIT( pMobIndex->susceptible, RIS_HOLD );
REMOVE_BIT( pMobIndex->susceptible, RIS_PLUS1 );
REMOVE_BIT( pMobIndex->susceptible, RIS_PLUS2 );
REMOVE_BIT( pMobIndex->susceptible, RIS_PLUS3 );
REMOVE_BIT( pMobIndex->susceptible, RIS_PLUS4 );
REMOVE_BIT( pMobIndex->susceptible, RIS_PLUS5 );
REMOVE_BIT( pMobIndex->susceptible, RIS_PLUS6 );
if( pMobIndex->susceptible )
fprintf( fp, "Susceptible %s~\n", flag_string( pMobIndex->susceptible, ris_flags ) );
xREMOVE_BIT( pMobIndex->attacks, ATCK_NASTYPOISON );
xREMOVE_BIT( pMobIndex->attacks, ATCK_GAZE );
xREMOVE_BIT( pMobIndex->attacks, ATCK_FLAMESTRIKE );
xREMOVE_BIT( pMobIndex->attacks, ATCK_HARM );
xREMOVE_BIT( pMobIndex->attacks, ATCK_COLORSPRAY );
xREMOVE_BIT( pMobIndex->attacks, ATCK_WEAKEN );
xREMOVE_BIT( pMobIndex->attacks, ATCK_SPIRALBLAST );
if( !xIS_EMPTY( pMobIndex->attacks ) )
fprintf( fp, "Attacks %s~\n", ext_flag_string( &pMobIndex->attacks, attack_flags ) );
xREMOVE_BIT( pMobIndex->defenses, DFND_MONSUM1 );
xREMOVE_BIT( pMobIndex->defenses, DFND_MONSUM2 );
xREMOVE_BIT( pMobIndex->defenses, DFND_MONSUM3 );
xREMOVE_BIT( pMobIndex->defenses, DFND_MONSUM4 );
if( !xIS_EMPTY( pMobIndex->defenses ) )
fprintf( fp, "Defenses %s~\n", ext_flag_string( &pMobIndex->defenses, defense_flags ) );
if( pMobIndex->defposition )
fprintf( fp, "DefPosition %s~\n", pos_names[pMobIndex->defposition] );
if( pMobIndex->sex )
fprintf( fp, "Sex %s~\n", sex_names[pMobIndex->sex] );
if( pMobIndex->alignment )
fprintf( fp, "Alignment %d\n", pMobIndex->alignment );
{
int maxhit = ( pMobIndex->hitnodice * number_range( 1, pMobIndex->hitsizedice ) + pMobIndex->hitplus );
fprintf( fp, "Hit %d %d\n", maxhit, ( maxhit + 100 ) );
}
fprintf( fp, "Saves %d %d %d %d %d\n",
pMobIndex->saving_poison_death, pMobIndex->saving_wand,
pMobIndex->saving_para_petri, pMobIndex->saving_breath, pMobIndex->saving_spell_staff );
fprintf( fp, "Stats %d %d %d %d %d %d %d\n", pMobIndex->perm_str, pMobIndex->perm_int,
pMobIndex->perm_wis, pMobIndex->perm_dex, pMobIndex->perm_con, pMobIndex->perm_cha, pMobIndex->perm_lck );
if( pMobIndex->ac )
fprintf( fp, "Armor %d\n", pMobIndex->ac );
if( pMobIndex->gold )
fprintf( fp, "Gold %d\n", pMobIndex->gold );
if( pMobIndex->height )
fprintf( fp, "Height %d\n", pMobIndex->height );
if( pMobIndex->weight )
fprintf( fp, "Weight %d\n", pMobIndex->weight );
if( pMobIndex->numattacks )
fprintf( fp, "NumAttacks %d\n", pMobIndex->numattacks );
if( pMobIndex->hitroll )
fprintf( fp, "HitRoll %d\n", pMobIndex->hitroll );
if( pMobIndex->damroll )
fprintf( fp, "DamRoll %d\n", pMobIndex->damroll );
if( pMobIndex->spec_funname )
fprintf( fp, "Special %s\n", pMobIndex->spec_funname );
if( pMobIndex->pShop )
{
int stype;
fprintf( fp, "NShop %d %d %d %d ",
pMobIndex->pShop->profit_buy,
pMobIndex->pShop->profit_sell, pMobIndex->pShop->open_hour, pMobIndex->pShop->close_hour );
for( stype = 0; stype < MAX_TRADE; stype++ )
if( pMobIndex->pShop->buy_type[stype] )
fprintf( fp, " %s", o_types[pMobIndex->pShop->buy_type[stype]] );
fprintf( fp, "%s", "~\n" );
}
if( pMobIndex->rShop )
{
int stype;
fprintf( fp, "NRepair %d %d %d ",
pMobIndex->rShop->profit_fix, pMobIndex->rShop->open_hour,
pMobIndex->rShop->close_hour );
for( stype = 0; stype < MAX_FIX; stype++ )
if( pMobIndex->rShop->fix_type[stype] )
fprintf( fp, " %s", o_types[pMobIndex->rShop->fix_type[stype]] );
fprintf( fp, "%s", "~\n" );
}
if( pMobIndex->mudprogs )
{
int count = 0;
for( mprog = pMobIndex->mudprogs; mprog; mprog = mprog->next )
count = save_programs( mprog, fp );
if( count > 0 )
fprintf( fp, "%s", "|\n" );
}
fprintf( fp, "End\n\n" );
}
if( !first )
fprintf( fp, "#0\n\n\n" );
/* save objects */
first = true;
for( vnum = low_vnum; vnum <= hi_vnum; vnum++ )
{
if( !( pObjIndex = get_obj_index( vnum ) ) )
continue;
if( first )
fprintf( fp, "#OBJECTS\n" );
first = false;
fprintf( fp, "Vnum %d\n", vnum );
if( pObjIndex->level )
fprintf( fp, "Level %d\n", pObjIndex->level );
if( pObjIndex->name )
fprintf( fp, "Name %s~\n", strip_cr( pObjIndex->name ) );
if( pObjIndex->short_descr )
fprintf( fp, "Short %s~\n", strip_cr( pObjIndex->short_descr ) );
if( pObjIndex->description )
fprintf( fp, "Description\n%s~\n", strip_cr( pObjIndex->description ) );
if( pObjIndex->action_desc )
fprintf( fp, "Action %s~\n", strip_cr( pObjIndex->action_desc ) );
if( pObjIndex->item_type != ITEM_TRASH )
fprintf( fp, "Type %s~\n", o_types[pObjIndex->item_type] );
xREMOVE_BIT( pObjIndex->extra_flags, ITEM_HUM );
xREMOVE_BIT( pObjIndex->extra_flags, ITEM_EVIL );
if( !xIS_EMPTY( pObjIndex->extra_flags ) )
fprintf( fp, "Flags %s~\n", ext_flag_string( &pObjIndex->extra_flags, o_flags ) );
if( pObjIndex->wear_flags )
{
fprintf( fp, "%s", "Wear " );
/* If doesn't have take flag need to put notake in file, if it does just remove the flag */
if( IS_SET( pObjIndex->wear_flags, ITEM_TAKE ) )
REMOVE_BIT( pObjIndex->wear_flags, ITEM_TAKE );
else
fprintf( fp, "%s", "notake " );
/* In LoP it wield is just a hold position */
if( IS_SET( pObjIndex->wear_flags, ITEM_WIELD ) )
{
REMOVE_BIT( pObjIndex->wear_flags, ITEM_WIELD );
fprintf( fp, "%s", "hold " );
}
fprintf( fp, "%s~\n", flag_string( pObjIndex->wear_flags, w_flags ) );
}
if( pObjIndex->layers )
fprintf( fp, "Layers %d\n", pObjIndex->layers );
val0 = pObjIndex->value[0];
val1 = pObjIndex->value[1];
val2 = pObjIndex->value[2];
val3 = pObjIndex->value[3];
val4 = pObjIndex->value[4];
val5 = pObjIndex->value[5];
switch( pObjIndex->item_type )
{
case ITEM_PILL:
case ITEM_POTION:
case ITEM_SCROLL:
if( !IS_VALID_SN( val1 ) )
val1 = HAS_SPELL_INDEX;
if( !IS_VALID_SN( val2 ) )
val2 = HAS_SPELL_INDEX;
if( !IS_VALID_SN( val3 ) )
val3 = HAS_SPELL_INDEX;
break;
case ITEM_STAFF:
case ITEM_WAND:
if( !IS_VALID_SN( val3 ) )
val3 = HAS_SPELL_INDEX;
break;
case ITEM_SALVE:
if( !IS_VALID_SN( val3 ) )
val3 = HAS_SPELL_INDEX;
if( !IS_VALID_SN( val4 ) )
val4 = HAS_SPELL_INDEX;
if( !IS_VALID_SN( val5 ) )
val5 = HAS_SPELL_INDEX;
break;
}
if( val0 != -1 )
fprintf( fp, "Val0 %d\n", val0 );
if( val1 != -1 )
{
fprintf( fp, "Val1 %d ", val1 );
if( pObjIndex->item_type == ITEM_PILL || pObjIndex->item_type == ITEM_POTION
|| pObjIndex->item_type == ITEM_SCROLL )
fprintf( fp, "'%s'", IS_VALID_SN( val1 ) ? skill_table[val1]->name : "NONE" );
fprintf( fp, "%s", "\n" );
}
if( val2 != -1 )
{
fprintf( fp, "Val2 %d ", val2 );
if( pObjIndex->item_type == ITEM_PILL || pObjIndex->item_type == ITEM_POTION
|| pObjIndex->item_type == ITEM_SCROLL )
fprintf( fp, "'%s'", IS_VALID_SN( val2 ) ? skill_table[val2]->name : "NONE" );
fprintf( fp, "%s", "\n" );
}
if( val3 != -1 )
{
fprintf( fp, "Val3 %d ", val3 );
switch( pObjIndex->item_type )
{
case ITEM_PILL:
case ITEM_POTION:
case ITEM_SCROLL:
case ITEM_STAFF:
case ITEM_WAND:
case ITEM_SALVE:
fprintf( fp, "'%s'", IS_VALID_SN( val3 ) ? skill_table[val3]->name : "NONE" );
break;
}
fprintf( fp, "%s", "\n" );
}
if( val4 != -1 )
{
fprintf( fp, "Val4 %d ", val4 );
if( pObjIndex->item_type == ITEM_SALVE )
fprintf( fp, "'%s'", IS_VALID_SN( val4 ) ? skill_table[val4]->name : "NONE" );
fprintf( fp, "%s", "\n" );
}
if( val5 != -1 )
{
fprintf( fp, "Val5 %d ", val5 );
if( pObjIndex->item_type == ITEM_SALVE )
fprintf( fp, "'%s'", IS_VALID_SN( val5 ) ? skill_table[val5]->name : "NONE" );
fprintf( fp, "%s", "\n" );
}
if( pObjIndex->weight != 1 )
fprintf( fp, "Weight %d\n", pObjIndex->weight );
if( pObjIndex->cost )
fprintf( fp, "Cost %d\n", pObjIndex->cost );
for( ed = pObjIndex->first_extradesc; ed; ed = ed->next )
fprintf( fp, "E\n%s~\n%s~\n", ed->keyword, strip_cr( ed->description ) );
fwrite_oiaffect( fp, pObjIndex->first_affect );
if( pObjIndex->mudprogs )
{
int count = 0;
for( mprog = pObjIndex->mudprogs; mprog; mprog = mprog->next )
count = save_programs( mprog, fp );
if( count > 0 )
fprintf( fp, "%s", "|\n" );
}
fprintf( fp, "%s", "End\n\n" );
}
if( !first )
fprintf( fp, "%s", "#0\n\n\n" );
/* save rooms */
first = true;
for( vnum = low_vnum; vnum <= hi_vnum; vnum++ )
{
if( !( room = get_room_index( vnum ) ) )
continue;
if( first )
fprintf( fp, "#ROOMS\n" );
first = false;
fprintf( fp, "Vnum %d\n", vnum );
if( room->name )
fprintf( fp, "Name %s~\n", strip_cr( room->name ) );
if( room->description )
fprintf( fp, "Description %s~\n", strip_cr( room->description ) );
if( !xIS_EMPTY( room->room_flags ) )
fprintf( fp, "Flags %s~\n", ext_flag_string( &room->room_flags, r_flags ) );
if( room->sector_type != SECT_INSIDE )
fprintf( fp, "Sector %s~\n", sect_flags[room->sector_type] );
if( room->tele_delay )
fprintf( fp, "Teledelay %d\n", room->tele_delay );
if( room->tele_vnum )
fprintf( fp, "Televnum %d\n", room->tele_vnum );
if( room->tunnel )
fprintf( fp, "Tunnel %d\n", room->tunnel );
for( xit = room->first_exit; xit; xit = xit->next )
{
/* Only save exits to the area */
if( xit->vnum > hi_vnum || xit->vnum < low_vnum )
continue;
if( IS_SET( xit->exit_info, EX_PORTAL ) ) /* don't save portals */
continue;
fprintf( fp, "Exit %s\n", dir_name[xit->vdir] );
if( xit->description && xit->description[0] != '\0' )
fprintf( fp, "Description %s~\n", strip_cr( xit->description ) );
if( xit->keyword && xit->keyword[0] != '\0' )
fprintf( fp, "Keyword %s~\n", strip_cr( xit->keyword ) );
REMOVE_BIT( xit->exit_info, EX_BASHED );
if( xit->exit_info )
fprintf( fp, "Flags %s~\n", flag_string( xit->exit_info, ex_flags ) );
if( xit->key >= 0 )
fprintf( fp, "Key %d\n", xit->key );
if( xit->vnum )
fprintf( fp, "To %d\n", xit->vnum );
if( xit->pulltype )
fprintf( fp, "Pulltype %s~\n", pull_type_name( xit->pulltype ) );
if( xit->pull )
fprintf( fp, "Pull %d\n", xit->pull );
fprintf( fp, "%s", "End\n" );
}
for( pReset = room->first_reset; pReset; pReset = pReset->next )
{
switch( pReset->command ) /* extra arg1 arg2 arg3 */
{
default:
case '*':
break;
case 'm':
case 'M':
case 'o':
case 'O':
fprintf( fp, "R %c %d %d %d %d 100\n", UPPER( pReset->command ),
pReset->extra, pReset->arg1, pReset->arg2, pReset->arg3 );
for( tReset = pReset->first_reset; tReset; tReset = tReset->next_reset )
{
switch( tReset->command )
{
case 'p':
case 'P':
case 'e':
case 'E':
fprintf( fp, " NR %c %d %d %d %d 100\n", UPPER( tReset->command ),
tReset->extra, tReset->arg1, tReset->arg2, tReset->arg3 );
if( tReset->first_reset )
{
for( gReset = tReset->first_reset; gReset; gReset = gReset->next_reset )
{
if( gReset->command != 'p' && gReset->command != 'P' )
continue;
fprintf( fp, " NR %c %d %d %d %d 100\n", UPPER( gReset->command ),
gReset->extra, gReset->arg1, gReset->arg2, gReset->arg3 );
}
}
break;
case 'g':
case 'G':
fprintf( fp, " NR %c %d %d %d 100\n", UPPER( tReset->command ),
tReset->extra, tReset->arg1, tReset->arg2 );
if( tReset->first_reset )
{
for( gReset = tReset->first_reset; gReset; gReset = gReset->next_reset )
{
if( gReset->command != 'p' && gReset->command != 'P' )
continue;
fprintf( fp, " NR %c %d %d %d %d 100\n", UPPER( gReset->command ),
gReset->extra, gReset->arg1, gReset->arg2, gReset->arg3 );
}
}
break;
case 't':
case 'T':
case 'h':
case 'H':
fprintf( fp, " NR %c %d %d %d %d 100\n", UPPER( tReset->command ),
tReset->extra, tReset->arg1, tReset->arg2, tReset->arg3 );
break;
}
}
break;
case 'd':
case 'D':
case 't':
case 'T':
case 'h':
case 'H':
fprintf( fp, "NR %c %d %d %d %d 100\n", UPPER( pReset->command ),
pReset->extra, pReset->arg1, pReset->arg2, pReset->arg3 );
break;
case 'r':
case 'R':
fprintf( fp, "NR %c %d %d %d 100\n", UPPER( pReset->command ), pReset->extra, pReset->arg1,
pReset->arg2 );
break;
}
}
for( ed = room->first_extradesc; ed; ed = ed->next )
fprintf( fp, "E\n%s~\n%s~\n", ed->keyword, strip_cr( ed->description ) );
if( room->mudprogs )
{
int count = 0;
for( mprog = room->mudprogs; mprog; mprog = mprog->next )
count = save_programs( mprog, fp );
if( count > 0 )
fprintf( fp, "%s", "|\n" );
}
fprintf( fp, "End\n\n" );
}
if( !first )
fprintf( fp, "#0\n\n\n" );
/* END */
fprintf( fp, "#$\n" );
fclose( fp );
fp = NULL;
rename( tempfilename, newfilename );
return;
}
void fold_all_areas( void )
{
AREA_DATA *tarea;
for( tarea = first_area; tarea; tarea = tarea->next )
fold_area( tarea, tarea->filename );
}