diff -i smaug14/src/save.c smaug18/src/save.c 8c8 < * Tricops and Fireblade | * --- > * Tricops, Fireblade, Edmond, Conran | * 47a48,50 > void fwrite_variables( CHAR_DATA * ch, FILE * fp ); > void fread_variable( CHAR_DATA * ch, FILE * fp ); > 58c61 < void fread_char args( ( CHAR_DATA * ch, FILE * fp, bool preload ) ); --- > int fread_char args( ( CHAR_DATA * ch, FILE * fp, bool preload ) ); 83a87,95 > #ifdef CORRUPT > #undef CORRUPT > #endif > #define CORRUPT do \ > { \ > found = FALSE; \ > d->character = NULL; \ > bug("Load_char_obj: %s is corrupted!", strsave); \ > } while(0) 164c176 < if ( IS_NPC( ch ) || ch->level < 2 ) --- > if ( IS_NPC( ch ) ) 201c213 < if ( ch->level >= LEVEL_IMMORTAL ) --- > if ( ch->level >= LEVEL_IMMORTAL || IS_SET( ch->pcdata->flags, PCFLAG_RETIRED ) ) 224c236,241 < if ( ( fp = fopen( TEMP_FILE, "w" ) ) == NULL ) --- > if ( IS_SET( sysdata.save_flags, SV_TMPSAVE ) ) > fp = fopen( TEMP_FILE, "w" ); > else > fp = fopen( strsave, "w" ); > > if ( fp == NULL ) 226c243,246 < perror( strsave ); --- > if ( IS_SET( sysdata.save_flags, SV_TMPSAVE ) ) > perror( TEMP_FILE ); > else > perror( strsave ); 233d252 < fchmod( fileno( fp ), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH ); 241a261,262 > if ( ch->variables ) > fwrite_variables( ch, fp ); 247c268 < if ( ferr ) --- > if ( IS_SET( sysdata.save_flags, SV_TMPSAVE ) ) 249,250c270,276 < perror( strsave ); < bug( "Error writing temp file for %s -- not copying", strsave ); --- > if ( ferr ) > { > perror( strsave ); > bug( "Error writing temp file for %s -- not copying", strsave ); > } > else > rename( TEMP_FILE, strsave ); 252,253d277 < else < rename( TEMP_FILE, strsave ); 273a298 > HOME_DATA *tmphome; 292a318,324 > fprintf( fp, "Stance %d\n", ch->stance ); > fprintf( fp, "Stances %d %d %d %d %d %d %d %d %d %d %d %d\n", > ch->pcdata->stances[0], ch->pcdata->stances[1], > ch->pcdata->stances[2], ch->pcdata->stances[3], > ch->pcdata->stances[4], ch->pcdata->stances[5], > ch->pcdata->stances[6], ch->pcdata->stances[7], > ch->pcdata->stances[8], ch->pcdata->stances[9], ch->pcdata->stances[10], ch->pcdata->stances[11] ); 318,319c350,357 < fprintf( fp, "SavingThrows %d %d %d %d %d\n", < ch->saving_poison_death, ch->saving_wand, ch->saving_para_petri, ch->saving_breath, ch->saving_spell_staff ); --- > /* > fprintf( fp, "SavingThrows %d %d %d %d %d\n", > ch->saving_poison_death, > ch->saving_wand, > ch->saving_para_petri, > ch->saving_breath, > ch->saving_spell_staff ); > */ 320a359,368 > > /* > * Band aid for Edmond's screw up > */ > fprintf( fp, "SavingThrows %d %d %d %d %d\n", > race_table[ch->race]->saving_poison_death, > race_table[ch->race]->saving_wand, > race_table[ch->race]->saving_para_petri, > race_table[ch->race]->saving_breath, race_table[ch->race]->saving_spell_staff ); > 323a372 > fprintf( fp, "Honour %d\n", ch->pcdata->honour ); 329,330c378,379 < if ( ch->deaf ) < fprintf( fp, "Deaf %d\n", ch->deaf ); --- > if ( !xIS_EMPTY( ch->deaf ) ) > fprintf( fp, "Deaf %s\n", print_bitvector( &ch->deaf ) ); 365a415,418 > if ( ch->pcdata->email && ch->pcdata->email[0] != '\0' ) > fprintf( fp, "Email %s~\n", ch->pcdata->email ); > if ( ch->pcdata->icq && ch->pcdata->icq[0] != '\0' ) > fprintf( fp, "ICQ %s~\n", ch->pcdata->icq ); 413a467 > { 414a469 > } 433,434c488,496 < if ( ch->desc && ch->desc->host ) < fprintf( fp, "Site %s\n", ch->desc->host ); --- > > // Hmm not sure if we really want this. Might suck if you forgot you > // were visible to some peeps. > // Course, it personally sucks more for me when I forget I'm _not_ > // visible, but meh. > // fprintf( fp, "SeeMe %s~\n", ch->pcdata->see_me ); // Alty > > if ( ch->pcdata->recent_site ) > fprintf( fp, "Site %s\n", ch->pcdata->recent_site ); 436a499,520 > > /* > * This MUST come after Room in pfile > */ > if ( xIS_SET( ch->in_room->room_flags, ROOM_HOUSE ) && !IS_IMMORTAL( ch ) ) > { > int i; > > for ( tmphome = first_home; tmphome; tmphome = tmphome->next ) > for ( i = 0; i < MAX_HOUSE_ROOMS; i++ ) > if ( tmphome->vnum[i] == ch->in_room->vnum ) > fprintf( fp, "Homeowner %s~\n", tmphome->name ); > } > else > { > HOMEBUY_DATA *tmphb; > > for ( tmphb = first_homebuy; tmphb; tmphb = tmphb->next ) > if ( ch->in_room->vnum == tmphb->vnum ) > fprintf( fp, "Homeowner %s~\n", tmphb->seller ); > } > 508c592 < fwrite_obj( ch, obj->prev_content, fp, iNest, OS_CARRY ); --- > fwrite_obj( ch, obj->prev_content, fp, iNest, os_type ); 516a601 > || ( ( os_type == OS_VAULT ) && ( obj->item_type == ITEM_CORPSE_PC ) ) 520a606,611 > * Strip out existing gold-midas keys > */ > if ( obj->item_type == ITEM_TREASURE && obj->pIndexData->item_type == ITEM_KEY ) > return; > > /* 534a626,627 > if ( obj->owner[0] != '\0' ) > fprintf( fp, "Owner %s~\n", obj->owner ); 544c637 < if ( os_type == OS_CORPSE && obj->in_room ) --- > if ( ( os_type == OS_CORPSE || os_type == OS_VAULT ) && obj->in_room ) 550,551c643,644 < wear_loc = -1; < for ( wear = 0; wear < MAX_WEAR; wear++ ) --- > wear_loc = WEAR_NONE; > for ( wear = 0; wear < MAX_WEAR && wear_loc == WEAR_NONE; wear++ ) 677a771,772 > if ( d->host ) > ch->pcdata->recent_site = STRALLOC( d->host ); 700a796,798 > for ( i = 0; i < MAX_STANCE; i++ ) > ch->pcdata->stances[i] = 0; > ch->stance = 0; 778c876,881 < word = fread_word( fp ); --- > if ( ( word = fread_word( fp ) ) == NULL ) > { > CORRUPT; > break; > } > 781c884,888 < fread_char( ch, fp, preload ); --- > if ( fread_char( ch, fp, preload ) == -1 ) > { > CORRUPT; > break; > } 783a891 > update_aris( ch ); 790a899,900 > else if ( !strcmp( word, "VARIABLE" ) ) > fread_variable( ch, fp ); /* Variables (tags) */ 795c905,906 < mob = fread_mobile( fp ); --- > if ( ( mob = fread_mobile( fp ) ) == NULL ) > break; 797a909 > xSET_BIT( ch->act, PLR_BOUGHT_PET ); /* Pet crash fix */ 798a911,912 > if ( xIS_SET( mob->act, ACT_MOUNTED ) ) > xREMOVE_BIT( mob->act, ACT_MOUNTED ); 837a952,953 > ch->pcdata->email = str_dup( "" ); > ch->pcdata->icq = str_dup( "" ); 841a958 > ch->pcdata->see_me = str_dup( "" ); 884a1002 > { 893a1012 > } 956c1075 < void fread_char( CHAR_DATA * ch, FILE * fp, bool preload ) --- > int fread_char( CHAR_DATA * ch, FILE * fp, bool preload ) 963a1083,1084 > HOME_DATA *tmphome; > bool fHonour = FALSE; 969a1091,1093 > if ( !word ) > return -1; > 1004a1129,1130 > if ( !sname ) > return -1; 1085c1211 < "Warning: the organization %s no longer exists, and therefore you no longer\n\rbelong to that organization.\n\r", --- > "&R\n\rWarning: the organization %s no longer exists, and therefore you no longer\n\rbelong to that organization.\n\r", 1087c1213 < send_to_char( buf, ch ); --- > add_loginmsg( ch->name, 18, buf ); 1102a1229,1230 > if ( !cword ) > return -1; 1137c1265 < "Warning: the council %s no longer exists, and herefore you no longer\n\rbelong to a council.\n\r", --- > "&Y\n\rWarning: the council %s no longer exists, and therefore you no longer\n\rbelong to a council.\n\r", 1139c1267 < send_to_char( buf, ch ); --- > add_loginmsg( ch->name, 18, buf ); 1150c1278 < KEY( "Deaf", ch->deaf, fread_number( fp ) ); --- > KEY( "Deaf", ch->deaf, fread_bitvector( fp ) ); 1159,1160c1287,1288 < sprintf( buf, "Warning: the deity %s no longer exists.\n\r", ch->pcdata->deity_name ); < send_to_char( buf, ch ); --- > sprintf( buf, "&R\n\rYour deity, %s, has met its demise!\n\r", ch->pcdata->deity_name ); > add_loginmsg( ch->name, 18, buf ); 1163c1291,1293 < ch->pcdata->favor = 0; --- > /* Temporarily commenting this out for deicide -- Blod, 7/2002 > ch->pcdata->favor = 0; > */ 1204c1334 < "Warning: the organization %s no longer exists, and therefore you no longer\n\rbelong to that organization.\n\r", --- > "&R\n\rWarning: the organization %s no longer exists, and therefore you no longer\n\rbelong to that organization.\n\r", 1206c1336 < send_to_char( buf, ch ); --- > add_loginmsg( ch->name, 18, buf ); 1227a1358,1382 > if ( !strcmp( word, "Honour" ) ) > { > ch->pcdata->honour = fread_number( fp ); > fHonour = TRUE; > fMatch = TRUE; > break; > } > if ( !strcmp( word, "Homeowner" ) ) > { > int i; > > fMatch = TRUE; > > if ( ch->in_room && xIS_SET( ch->in_room->room_flags, ROOM_HOUSE ) ) > { > for ( tmphome = first_home; tmphome; tmphome = tmphome->next ) > for ( i = 0; i < MAX_HOUSE_ROOMS; i++ ) > if ( tmphome->vnum[i] == ch->in_room->vnum ) > if ( strcmp( tmphome->name, fread_string( fp ) ) ) > ch->in_room = get_room_index( ROOM_VNUM_TEMPLE ); > } > else > fread_string( fp ); > break; > } 1242a1398 > KEY( "ICQ", ch->pcdata->icq, fread_string_nohash( fp ) ); 1474a1631 > KEY( "SeeMe", ch->pcdata->see_me, fread_string( fp ) ); // Alty 1476a1634,1645 > KEY( "Stance", ch->stance, fread_number( fp ) ); > if ( !str_cmp( word, "Stances" ) ) > { > int tmp; > > for ( tmp = 0; tmp < MAX_STANCE; tmp++ ) > { > ch->pcdata->stances[tmp] = fread_number( fp ); > } > fMatch = TRUE; > break; > } 1505c1674,1675 < sprintf( buf, "Last connected from: %s\n\r", fread_word( fp ) ); --- > ch->pcdata->prev_site = STRALLOC( fread_word( fp ) ); > sprintf( buf, "Last connected from: %s\n\r", ch->pcdata->prev_site ); 1518a1689 > char *sword; 1526a1698,1699 > if ( ( sword = fread_word( fp ) ) == NULL ) > return -1; 1528c1701 < sn = skill_lookup( fread_word( fp ) ); --- > sn = skill_lookup( sword ); 1530c1703 < sn = bsearch_skill_exact( fread_word( fp ), gsn_first_skill, gsn_first_weapon - 1 ); --- > sn = bsearch_skill_exact( sword, gsn_first_skill, gsn_first_weapon - 1 ); 1556a1730 > char *sword; 1565,1566c1739,1741 < < sn = bsearch_skill_exact( fread_word( fp ), gsn_first_spell, gsn_first_skill - 1 ); --- > if ( ( sword = fread_word( fp ) ) == NULL ) > return -1; > sn = bsearch_skill_exact( sword, gsn_first_spell, gsn_first_skill - 1 ); 1586a1762 > KEY( "Email", ch->pcdata->email, fread_string_nohash( fp ) ); 1608a1785,1788 > if ( !ch->pcdata->email ) > ch->pcdata->email = str_dup( "" ); > if ( !ch->pcdata->icq ) > ch->pcdata->icq = str_dup( "" ); 1610a1791,1794 > if ( !fHonour && ( ch->level >= 50 ) ) > ch->pcdata->honour = 10; > if ( !ch->pcdata->see_me ) > ch->pcdata->see_me = str_dup( "" ); 1643,1644d1826 < if ( !ch->pcdata->prompt ) < ch->pcdata->prompt = STRALLOC( "" ); 1656c1838 < return; --- > return 0; 1663a1846 > char *sword; 1672,1673c1855,1857 < < sn = bsearch_skill_exact( fread_word( fp ), gsn_first_tongue, gsn_top_sn - 1 ); --- > if ( ( sword = fread_word( fp ) ) == NULL ) > return -1; > sn = bsearch_skill_exact( sword, gsn_first_tongue, gsn_top_sn - 1 ); 1725a1910 > char *sword; 1734,1735c1919,1921 < < sn = bsearch_skill_exact( fread_word( fp ), gsn_first_weapon, gsn_first_tongue - 1 ); --- > if ( ( sword = fread_word( fp ) ) == NULL ) > return -1; > sn = bsearch_skill_exact( sword, gsn_first_weapon, gsn_first_tongue - 1 ); 1762a1949 > return 0; 1764a1952,1961 > bool check_owner( OBJ_DATA * obj ) > { > HOME_DATA *home; > > for ( home = first_home; home; home = home->next ) > if ( home->vnum[0] == obj->pIndexData->vnum ) > if ( !str_cmp( home->name, obj->owner ) ) > return TRUE; > return FALSE; > } 1777,1778c1974,1975 < if ( ch ) < room = ch->in_room; --- > // if ( ch ) not sure why these are even here - but for housing purposes, they > // room = ch->in_room; should go away - so they are removed. they serve no other purpose 1782a1980 > obj->owner = STRALLOC( "" ); 1785c1983,1984 < fVnum = TRUE; --- > /* fVnum = TRUE; We can't assume this - what if Vnum isn't written to the file? Crashy crashy is what */ > fVnum = FALSE; 1791a1991,1992 > if ( !word ) > break; 1813a2015 > char *sword; 1816,1820c2018,2025 < sn = skill_lookup( fread_word( fp ) ); < if ( sn < 0 ) < bug( "Fread_obj: unknown skill.", 0 ); < else < paf->type = sn; --- > if ( ( sword = fread_word( fp ) ) != NULL ) > { > sn = skill_lookup( fread_word( fp ) ); > if ( sn < 0 ) > bug( "Fread_obj: unknown skill.", 0 ); > else > paf->type = sn; > } 1863a2069,2084 > > if ( obj->item_type == ITEM_HOUSEKEY ) > { > if ( !check_owner( obj ) ) > { > bug( "Fread_obj: house key found not belonging to correct house", 0 ); > if ( obj->name ) > STRFREE( obj->name ); > if ( obj->description ) > STRFREE( obj->description ); > if ( obj->short_descr ) > STRFREE( obj->short_descr ); > DISPOSE( obj ); > return; > } > } 1924a2146,2149 > else if ( os_type == OS_VAULT && room ) > { > obj = obj_to_room( obj, room ); > } 1989a2215,2222 > case 'O': > if ( !strcmp( word, "Owner" ) ) > { > STRFREE( obj->owner ); > obj->owner = fread_string( fp ); > fMatch = TRUE; > } > break; 1997a2231 > char *sword; 1999c2233 < int sn; --- > int sn = -1; 2002c2236,2237 < sn = skill_lookup( fread_word( fp ) ); --- > if ( ( sword = fread_word( fp ) ) != NULL ) > sn = skill_lookup( sword ); 2030c2265 < if ( file_ver < 3 ) --- > if ( file_ver < 3 && os_type != OS_VAULT ) 2104a2340 > 2121a2358 > CHAR_DATA *vch; 2133,2136c2370,2380 < strcpy( name, capitalize( arg ) ); < sprintf( buf, "%s%c/%s", PLAYER_DIR, tolower( arg[0] ), name ); < if ( stat( buf, &fst ) != -1 ) < sprintf( buf, "%s was last on: %s\r", name, ctime( &fst.st_mtime ) ); --- > if ( get_trust( ch ) < LEVEL_ASCENDANT > && ( !str_cmp( arg, "Thoric" ) > || !str_cmp( arg, "Nivek" ) > || !str_cmp( arg, "Kali" ) || !str_cmp( arg, "Blodkai" ) || !str_cmp( arg, "Edmond" ) ) ) > { > set_char_color( AT_IMMORT, ch ); > send_to_char( "Their godly glow prevents you from getting a good look.\n\r", ch ); > return; > } > if ( ( vch = load_player( arg ) ) == NULL ) > sprintf( buf, "%s was not found.\n\r", arg ); 2138c2382,2398 < sprintf( buf, "%s was not found.\n\r", name ); --- > { > strcpy( name, capitalize( arg ) ); > sprintf( buf, "%s%c/%s", PLAYER_DIR, tolower( arg[0] ), name ); > if ( stat( buf, &fst ) != -1 ) > { > sprintf( buf, "%s last logged from %s on: %s\r", name, > vch->pcdata->prev_site ? vch->pcdata->prev_site : "(Link-Dead)", ctime( &fst.st_mtime ) ); > if ( !vch->desc ) > { > if ( sysdata.save_pets && vch->pcdata && vch->pcdata->pet ) > extract_char( vch->pcdata->pet, TRUE ); > extract_char( vch, TRUE ); > } > } > else > sprintf( buf, "%s was not found.\n\r", name ); > }