void parse_quest(FILE *quest_f, int nr) { static char line[256]; static int i = 0, j; int retval = 0, t[7]; char f1[128], buf2[MAX_STRING_LENGTH]; aquest_table[i].vnum = nr; aquest_table[i].qm = NOBODY; aquest_table[i].name = NULL; aquest_table[i].desc = NULL; aquest_table[i].info = NULL; aquest_table[i].done = NULL; aquest_table[i].quit = NULL; aquest_table[i].flags = 0; aquest_table[i].type = -1; aquest_table[i].target = -1; aquest_table[i].prereq = NOTHING; for (j = 0; j < 7; j++) aquest_table[i].value[j] = 0; aquest_table[i].prev_quest = NOTHING; aquest_table[i].next_quest = NOTHING; aquest_table[i].func = NULL; aquest_table[i].gold_reward = 0; aquest_table[i].exp_reward = 0; aquest_table[i].obj_reward = NOTHING; /* begin to parse the data */ aquest_table[i].name = fread_string(quest_f, buf2); aquest_table[i].desc = fread_string(quest_f, buf2); aquest_table[i].info = fread_string(quest_f, buf2); aquest_table[i].done = fread_string(quest_f, buf2); aquest_table[i].quit = fread_string(quest_f, buf2); if (!get_line(quest_f, line) || (retval = sscanf(line, " %d %d %s %d %d %d %d", t, t+1, f1, t+2, t+3, t + 4, t + 5)) != 7) { log("Format error in numeric line (expected 7, got %d), %s\n", retval, line); exit(1); } aquest_table[i].type = t[0]; aquest_table[i].qm = (real_mobile(t[1]) == NOBODY) ? NOBODY : t[1]; aquest_table[i].flags = asciiflag_conv(f1); aquest_table[i].target = (t[2] == -1) ? NOTHING : t[2]; aquest_table[i].prev_quest = (t[3] == -1) ? NOTHING : t[3]; aquest_table[i].next_quest = (t[4] == -1) ? NOTHING : t[4]; aquest_table[i].prereq = (t[5] == -1) ? NOTHING : t[5]; if (!get_line(quest_f, line) || (retval = sscanf(line, " %d %d %d %d %d %d %d", t, t+1, t+2, t+3, t+4, t + 5, t + 6)) != 7) { log("Format error in numeric line (expected 7, got %d), %s\n", retval, line); exit(1); } for (j = 0; j < 7; j++) aquest_table[i].value[j] = t[j]; if (!get_line(quest_f, line) || (retval = sscanf(line, " %d %d %d", t, t+1, t+2)) != 3) { log("Format error in numeric (rewards) line (expected 3, got %d), %s\n", retval, line); exit(1); } aquest_table[i].gold_reward = t[0]; aquest_table[i].exp_reward = t[1]; aquest_table[i].obj_reward = (t[2] == -1) ? NOTHING : t[2]; for (;;) { if (!get_line(quest_f, line)) { log("Format error in %s\n", line); exit(1); } switch(*line) { case 'S': total_quests = ++i; return; break; } } } /* parse_quest */
int display_help_content(struct char_data *ch, char *argument) { MYSQL_RES *commandlist; MYSQL_ROW row; int qend, i, rec_count; unsigned long *fieldlength; char *entry = get_buffer(MAX_STRING_LENGTH); char *name; for (i = 0; i <= top_of_help_categories; i++) { // If it is a category: if (!GOT_RIGHTS(ch, help_categories[i].rights) && !GOT_RIGHTS(ch, RIGHTS_HELPFILES)) continue; if (is_name(argument, help_categories[i].name)) { /* * A full category name was matched in the string, so we print out that * category with its belonging information instead of trying to search * the help entries for something. */ /* * Get all the commands that belong to this category. Make sure that they do not see * commands that are not of their rights. */ if (!(commandlist = mysqlGetResource(TABLE_HLP_INDEX, "SELECT menutitle, keyword, rights FROM %s WHERE category = %d ORDER BY keyword ASC;", TABLE_HLP_INDEX, help_categories[i].num))) { extended_mudlog(NRM, SYSL_BUGS, TRUE, "Error loading help index."); extended_mudlog(NRM, SYSL_SQL, TRUE, "Query error (%s)%s:%d: %s", __FILE__, __FUNCTION__, __LINE__, mysql_error(&mysql)); release_buffer(entry); return (0); } name = str_dup(help_categories[i].name); sprintf(entry, "\r\n&C%s&n\r\n%s%s", ALLCAP(name), (strlen(help_categories[i].text) > 1?"\r\n":""), (strlen(help_categories[i].text) > 1?help_categories[i].text:"")); send_to_char(entry, ch); release_buffer(name); rec_count = mysql_num_rows(commandlist); if (rec_count == 0) { send_to_char("\r\n This help category is empty.\r\n", ch); mysql_free_result(commandlist); release_buffer(entry); return (1); } strcpy(entry, "\r\n"); for (qend = 0, i = 0; i < rec_count; i++) { row = mysql_fetch_row(commandlist); fieldlength = mysql_fetch_lengths(commandlist); if (!GOT_RIGHTS(ch, asciiflag_conv(row[2]))) continue; sprintf(entry + strlen(entry), "%s%-18s", ((qend % 4 == 0)?" ":""), ((fieldlength[0] > 0)?ALLCAP(row[0]):ALLCAP(row[1]))); if (qend++ % 4 == 3) { strcat(entry, "\r\n"); send_to_char(entry, ch); *entry = '\0'; } } if (*entry) send_to_char(entry, ch); if (!(--qend % 4 == 3)) send_to_char("\r\n", ch); mysql_free_result(commandlist); release_buffer(entry); return (1); } } release_buffer(entry); return (0); }
/** * formerly obj_from_store * * @param FILE *fl The open item file. * @param obj_vnum vnum The vnum of the item being loaded, or NOTHING for non-prototyped item. * @param int *location A place to bind the current WEAR_x position of the item; also used to track container contents. * @param char_data *notify Optional: A person to notify if an item is updated (NULL for none). * @return obj_data* The loaded item, or NULL if it's not available. */ obj_data *Obj_load_from_file(FILE *fl, obj_vnum vnum, int *location, char_data *notify) { void scale_item_to_level(obj_data *obj, int level); char line[MAX_INPUT_LENGTH], error[MAX_STRING_LENGTH], s_in[MAX_INPUT_LENGTH]; obj_data *proto = obj_proto(vnum); struct extra_descr_data *ex; obj_data *obj, *new; bool end = FALSE; int length, i_in[3]; int l_in; bool seek_end = FALSE; // up-front *location = 0; // load based on vnum or, if NOTHING, create anonymous object if (proto) { obj = read_object(vnum, FALSE); } else { // what we do here depends on input ... if the vnum was real, but no proto, it's a deleted obj if (vnum == NOTHING) { obj = create_obj(); } else { obj = NULL; seek_end = TRUE; // signal it to skip obj data } } // default to version 0 if (obj) { OBJ_VERSION(obj) = 0; } // for fread_string sprintf(error, "Obj_load_from_file %d", vnum); // for more readable if/else chain #define OBJ_FILE_TAG(src, tag, len) (!strn_cmp((src), (tag), ((len) = strlen(tag)))) while (!end) { if (!get_line(fl, line)) { log("SYSERR: Unexpected end of obj file in Obj_load_from_file"); exit(1); } if (OBJ_FILE_TAG(line, "End", length)) { end = TRUE; } else if (seek_end) { // are we looking for the end of the object? ignore this line // WARNING: don't put any ifs that require "obj" above seek_end; obj is not guaranteed continue; } else if (OBJ_FILE_TAG(line, "Version:", length)) { if (sscanf(line + length + 1, "%d", &i_in[0])) { OBJ_VERSION(obj) = i_in[0]; } } else if (OBJ_FILE_TAG(line, "Location:", length)) { if (sscanf(line + length + 1, "%d", &i_in[0]) == 1) { *location = i_in[0]; } } else if (OBJ_FILE_TAG(line, "Keywords:", length)) { if (GET_OBJ_KEYWORDS(obj) && (!proto || GET_OBJ_KEYWORDS(obj) != GET_OBJ_KEYWORDS(proto))) { free(GET_OBJ_KEYWORDS(obj)); } GET_OBJ_KEYWORDS(obj) = fread_string(fl, error); } else if (OBJ_FILE_TAG(line, "Short-desc:", length)) { if (GET_OBJ_SHORT_DESC(obj) && (!proto || GET_OBJ_SHORT_DESC(obj) != GET_OBJ_SHORT_DESC(proto))) { free(GET_OBJ_SHORT_DESC(obj)); } GET_OBJ_SHORT_DESC(obj) = fread_string(fl, error); } else if (OBJ_FILE_TAG(line, "Long-desc:", length)) { if (GET_OBJ_LONG_DESC(obj) && (!proto || GET_OBJ_LONG_DESC(obj) != GET_OBJ_LONG_DESC(proto))) { free(GET_OBJ_LONG_DESC(obj)); } GET_OBJ_LONG_DESC(obj) = fread_string(fl, error); } else if (OBJ_FILE_TAG(line, "Action-desc:", length)) { if (GET_OBJ_ACTION_DESC(obj) && (!proto || GET_OBJ_ACTION_DESC(obj) != GET_OBJ_ACTION_DESC(proto))) { free(GET_OBJ_ACTION_DESC(obj)); } GET_OBJ_ACTION_DESC(obj) = fread_string(fl, error); } else if (OBJ_FILE_TAG(line, "Extra-desc:", length)) { if (proto && obj->ex_description == proto->ex_description) { obj->ex_description = NULL; } CREATE(ex, struct extra_descr_data, 1); ex->next = obj->ex_description; obj->ex_description = ex; ex->keyword = fread_string(fl, error); ex->description = fread_string(fl, error); } else if (OBJ_FILE_TAG(line, "Val-0:", length)) { if (sscanf(line + length + 1, "%d", &i_in[0])) { GET_OBJ_VAL(obj, 0) = i_in[0]; } } else if (OBJ_FILE_TAG(line, "Val-1:", length)) { if (sscanf(line + length + 1, "%d", &i_in[0])) { GET_OBJ_VAL(obj, 1) = i_in[0]; } } else if (OBJ_FILE_TAG(line, "Val-2:", length)) { if (sscanf(line + length + 1, "%d", &i_in[0])) { GET_OBJ_VAL(obj, 2) = i_in[0]; } } else if (OBJ_FILE_TAG(line, "Type:", length)) { if (sscanf(line + length + 1, "%d", &i_in[0])) { GET_OBJ_TYPE(obj) = i_in[0]; } } else if (OBJ_FILE_TAG(line, "Wear:", length)) { if (sscanf(line + length + 1, "%s", s_in)) { GET_OBJ_WEAR(obj) = asciiflag_conv(s_in); } } else if (OBJ_FILE_TAG(line, "Flags:", length)) { if (sscanf(line + length + 1, "%s", s_in)) { GET_OBJ_EXTRA(obj) = asciiflag_conv(s_in); } } else if (OBJ_FILE_TAG(line, "Affects:", length)) { if (sscanf(line + length + 1, "%s", s_in)) { obj->obj_flags.bitvector = asciiflag_conv(s_in); } } else if (OBJ_FILE_TAG(line, "Timer:", length)) { if (sscanf(line + length + 1, "%d", &i_in[0])) { GET_OBJ_TIMER(obj) = i_in[0]; } } else if (OBJ_FILE_TAG(line, "Current-scale:", length)) { if (sscanf(line + length + 1, "%d", &i_in[0])) { GET_OBJ_CURRENT_SCALE_LEVEL(obj) = i_in[0]; } } else if (OBJ_FILE_TAG(line, "Min-scale:", length)) { if (sscanf(line + length + 1, "%d", &i_in[0])) { GET_OBJ_MIN_SCALE_LEVEL(obj) = i_in[0]; } } else if (OBJ_FILE_TAG(line, "Max-scale:", length)) { if (sscanf(line + length + 1, "%d", &i_in[0])) { GET_OBJ_MAX_SCALE_LEVEL(obj) = i_in[0]; } } else if (OBJ_FILE_TAG(line, "Material:", length)) { if (sscanf(line + length + 1, "%d", &i_in[0])) { GET_OBJ_MATERIAL(obj) = i_in[0]; } } else if (OBJ_FILE_TAG(line, "Last-empire:", length)) { if (sscanf(line + length + 1, "%d", &i_in[0])) { obj->last_empire_id = i_in[0]; } } else if (OBJ_FILE_TAG(line, "Last-owner:", length)) { if (sscanf(line + length + 1, "%d", &l_in)) { obj->last_owner_id = l_in; } } else if (OBJ_FILE_TAG(line, "Stolen-timer:", length)) { if (sscanf(line + length + 1, "%d", &i_in[0])) { obj->stolen_timer = i_in[0]; } } else if (OBJ_FILE_TAG(line, "Autostore-timer:", length)) { if (sscanf(line + length + 1, "%d", &i_in[0])) { GET_AUTOSTORE_TIMER(obj) = i_in[0]; } } else if (OBJ_FILE_TAG(line, "Apply:", length)) { if (sscanf(line + length + 1, "%d %d %d", &i_in[0], &i_in[1], &i_in[2])) { obj->affected[i_in[0]].location = i_in[1]; obj->affected[i_in[0]].modifier = i_in[2]; } } else if (OBJ_FILE_TAG(line, "Bound-to:", length)) { if (sscanf(line + length + 1, "%d", &i_in[0])) { struct obj_binding *bind; CREATE(bind, struct obj_binding, 1); bind->idnum = i_in[0]; bind->next = OBJ_BOUND_TO(obj); OBJ_BOUND_TO(obj) = bind; } } else if (OBJ_FILE_TAG(line, "Trigger:", length)) {
int Crash_load_objs(struct char_data *ch) { FILE *fl; char fname[MAX_STRING_LENGTH]; char line[256]; int t[10],i,num_of_days; int orig_rent_code; struct obj_data *temp; int locate=0, nr,cost,num_objs=0; struct obj_data *cont_row[MAX_BAG_ROWS]; int rentcode,timed,netcost,gold,account,nitems; if (!get_filename(fname, sizeof(fname), CRASH_FILE, GET_NAME(ch))) return 1; for (i = 0; i < MAX_BAG_ROWS; i++) cont_row[i] = NULL; if (!(fl = fopen(fname, "r"))) { if (errno != ENOENT) { /* if it fails, NOT because of no file */ char buf[MAX_STRING_LENGTH]; sprintf(buf, "SYSERR: READING OBJECT FILE %s (5)", fname); perror(buf); send_to_char(ch, "\r\n********************* NOTICE *********************\r\n" "There was a problem loading your objects from disk.\r\n" "Contact a God for assistance.\r\n"); } mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s entering game with no equipment.", GET_NAME(ch)); return 1; } if (get_line(fl, line)) sscanf(line,"%d %d %d %d %d %d",&rentcode, &timed, &netcost,&gold,&account,&nitems); if (rentcode == RENT_RENTED || rentcode == RENT_TIMEDOUT) { char str[64]; sprintf(str, "%d", SECS_PER_REAL_DAY); num_of_days = (int)((float) (time(0) - timed) / (float)atoi(str)); cost = (int) (netcost * num_of_days); if (cost > GET_GOLD(ch) + GET_BANK_GOLD(ch)) { fclose(fl); mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s entering game, rented equipment lost (no $).", GET_NAME(ch)); Crash_crashsave(ch); return 2; } else { GET_BANK_GOLD(ch) -= MAX(cost - GET_GOLD(ch), 0); GET_GOLD(ch) = MAX(GET_GOLD(ch) - cost, 0); save_char(ch); } } switch (orig_rent_code = rentcode) { case RENT_RENTED: mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s un-renting and entering game.", GET_NAME(ch)); break; case RENT_CRASH: mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s retrieving crash-saved items and entering game.", GET_NAME(ch)); break; case RENT_CRYO: mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s un-cryo'ing and entering game.", GET_NAME(ch)); break; case RENT_FORCED: case RENT_TIMEDOUT: mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s retrieving force-saved items and entering game.", GET_NAME(ch)); break; default: mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "WARNING: %s entering game with undefined rent code.", GET_NAME(ch)); break; } temp = NULL; while (get_line(fl, line)) { char tag[6]; int num; /* first, we get the number. Not too hard. */ if(*line == '$' && line[1] == '~') { if (temp) num_objs += handle_obj(temp, ch, locate, cont_row); break; } if (*line == '#') { if (sscanf(line, "#%d", &nr) != 1) { continue; } else { if (temp) num_objs += handle_obj(temp, ch, locate, cont_row); temp = NULL; locate = 0; } /* we have the number, check it, load obj. */ if (nr == NOTHING) { /* then it is unique */ temp = create_obj(); temp->item_number=NOTHING; } else if (nr < 0) { continue; } else { if(nr >= 999999) continue; if(real_object(nr) != NOTHING) { temp=read_object(nr,VIRTUAL); if (!temp) { continue; } } else { log("Nonexistent object %d found in rent file.", nr); continue; } } } tag_argument(line, tag); num = atoi(line); switch(*tag) { case 'A': if (!strcmp(tag, "ADes")) { char error[40]; snprintf(error, sizeof(error)-1, "rent(Ades):%s", temp->name); temp->action_description = fread_string(fl, error); } else if (!strcmp(tag, "Aff ")) { sscanf(line, "%d %d %d", &t[0], &t[1], &t[2]); if (t[0] < MAX_OBJ_AFFECT) { temp->affected[t[0]].location = t[1]; temp->affected[t[0]].modifier = t[2]; } } break; case 'C': if (!strcmp(tag, "Cost")) GET_OBJ_COST(temp) = num; break; case 'D': if (!strcmp(tag, "Desc")) temp->description = strdup(line); break; case 'E': if(!strcmp(tag, "EDes")) { struct extra_descr_data *new_desc; char error[40]; snprintf(error, sizeof(error)-1, "rent(Edes): %s", temp->name); if (temp->item_number != NOTHING && /* Regular object */ temp->ex_description && /* with ex_desc == prototype */ (temp->ex_description == obj_proto[real_object(temp->item_number)].ex_description)) temp->ex_description = NULL; CREATE(new_desc, struct extra_descr_data, 1); new_desc->keyword = fread_string(fl, error); new_desc->description = fread_string(fl, error); new_desc->next = temp->ex_description; temp->ex_description = new_desc; } break; case 'F': if (!strcmp(tag, "Flag")) GET_OBJ_EXTRA(temp) = asciiflag_conv(line); break; case 'L': if(!strcmp(tag, "Loc ")) locate = num; break; case 'N': if (!strcmp(tag, "Name")) temp->name = strdup(line); break; case 'P': if (!strcmp(tag, "Perm")) temp->obj_flags.bitvector = asciiflag_conv(line); break; case 'R': if (!strcmp(tag, "Rent")) GET_OBJ_RENT(temp) = num; break; case 'S': if (!strcmp(tag, "Shrt")) temp->short_description = strdup(line); break; case 'T': if (!strcmp(tag, "Type")) GET_OBJ_TYPE(temp) = num; break; case 'W': if (!strcmp(tag, "Wear")) GET_OBJ_WEAR(temp) = asciiflag_conv(line); else if (!strcmp(tag, "Wght")) GET_OBJ_WEIGHT(temp) = num; break; case 'V': if (!strcmp(tag, "Vals")) { sscanf(line, "%d %d %d %d", &t[0], &t[1], &t[2], &t[3]); for (i = 0; i < 4; i++) GET_OBJ_VAL(temp, i) = t[i]; } break; } } /* Little hoarding check. -gg 3/1/98 */ mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "%s (level %d) has %d objects (max %d).", GET_NAME(ch), GET_LEVEL(ch), num_objs, max_obj_save); fclose(fl); if ((orig_rent_code == RENT_RENTED) || (orig_rent_code == RENT_CRYO)) return 0; else return 1; }
void parse_quest(FILE *quest_file, int vnum) { static int i = 0; struct char_data *mob = NULL; char line[MAX_INPUT_LENGTH]; char value[MAX_INPUT_LENGTH]; char field[20]; int numval = 0; int nummsgs = 0; int numneeds = 0; int mob_rnum = 0; i++; mob_rnum = real_mobile(vnum); if (mob_rnum == -1) { stderr_log("Error trying to assign quest to non-existant mob."); fflush(NULL); exit(1); } mob = (mob_proto + mob_rnum); GET_MOB_QUEST_NUM(mob) = i; (mob_quests + i)->maxlevel = 51; (mob_quests + i)->qnum = i; while (get_line(quest_file, line)) { if (line[0] == 'S') { return; } parse_pline(line, field, value); numval = atoi(value); switch (UPPER(*field)) { case 'A': if (strcmp(field, "amount") == 0) { (mob_quests + i)->needs[numneeds].amount = numval; numneeds++; (mob_quests + i)->maxneeds = numneeds; } else { sprintf(buf2, "Unknown Quest field [%s]", field); stderr_log(buf2); } break; case 'C': if (strcmp(field, "classlist") == 0) { (mob_quests + i)->classlist = asciiflag_conv(value); } else { sprintf(buf2, "Unknown Quest field [%s]", field); stderr_log(buf2); } break; case 'D': if (strcmp(field, "destroy") == 0) { if (strcasecmp(value, "no") == 0) { (mob_quests + i)->needs[numneeds].destroy = 0; } } else { sprintf(buf2, "Unknown Quest field [%s]", field); stderr_log(buf2); } break; case 'F': if (strcmp(field, "flags") == 0) { (mob_quests + i)->flags = asciiflag_conv(value); } else { sprintf(buf2, "Unknown Quest field [%s]", field); stderr_log(buf2); } break; case 'G': if (strcmp(field, "goal") == 0) { (mob_quests + i)->goal = search_block(value, goal_list, FALSE); } else { sprintf(buf2, "Unknown Quest field [%s]", field); stderr_log(buf2); } break; case 'K': if (strcmp(field, "keywords") == 0) { RECREATE((mob_quests + i)->messages, struct quest_message_data, nummsgs + 1); (mob_quests + i)->messages[nummsgs].keywords = strdup(value); } else if (strcmp(field, "knowledge") == 0) { line[0] = '\0'; (mob_quests + i)->knowledge = fread_string(quest_file, line); } else { sprintf(buf2, "Unknown Quest field [%s]", field); stderr_log(buf2); } break; case 'M': if (strcmp(field, "maxlevel") == 0) { (mob_quests + i)->maxlevel = numval; } else if (strcmp(field, "message") == 0) { line[0] = '\0'; (mob_quests + i)->messages[nummsgs].message = fread_string(quest_file, line); nummsgs++; (mob_quests + i)->maxmsgs = nummsgs; } else { sprintf(buf2, "Unknown Quest field [%s]", field); stderr_log(buf2); } break; case 'N': if (strcmp(field, "needs") == 0) { RECREATE((mob_quests + i)->needs, struct quest_needs_data, numneeds + 1); (mob_quests + i)->needs[numneeds].destroy = 1; (mob_quests + i)->needs[numneeds].participants = NULL; (mob_quests + i)->needs[numneeds].type = search_block(value, needs_list, FALSE); (mob_quests + i)->needs[numneeds].complete = 0; (mob_quests + i)->needs[numneeds].needs_complete_msg = NULL; (mob_quests + i)->needs[numneeds].need_more_msg = NULL; } else if (strcmp(field, "need_more_msg") == 0) {
/* return values: 0 - successful load, keep char in rent room. 1 - load failure or load of crash items -- put char in temple. 2 - rented equipment lost (no $) */ int Crash_load(struct char_data * ch) { void Crash_save(struct char_data * ch, int type); FILE *fl; char fname[MAX_STRING_LENGTH]; char buf[MAX_STRING_LENGTH]; char input[MAX_INPUT_LENGTH + 1]; char tag[MAX_INPUT_LENGTH + 1]; char tag_arguments[MAX_INPUT_LENGTH + 1]; int val; struct obj_data *tmpobj = NULL; struct obj_data *tmpobj2; struct obj_data *next_obj; int found_begin = 0; int affect_counter = 0; int found; char *p; struct corpse_obj_save *crash_load_stack = NULL; struct corpse_obj_save *temp_stack = NULL; struct corpse_obj_save *temp_stack_next = NULL; int chg; int ovnum = 0; int j; if (!get_filename(GET_NAME(ch), fname, CRASH_FILE)) { return 1; } if (!(fl = fopen(fname, "r"))) { if (errno != ENOENT) { /* if it fails, NOT because of no file */ sprintf(buf1, "SYSERR: READING OBJECT FILE %s (5)", fname); perror(buf1); send_to_char("\r\n********************* NOTICE *********************\r\n" "There was a problem loading your objects from disk.\r\n" "Contact a God for assistance.\r\n", ch); } sprintf(buf, "%s entering game with no equipment.", GET_NAME(ch)); mudlog(buf, 'R', COM_IMMORT, TRUE); plog(buf, ch, 0); return 1; } while (get_line(fl, input)) { parse_pline(input, tag, tag_arguments); while ((p = strrchr(tag_arguments, '\n')) != NULL) { *p = '\0'; } val = atoi(tag_arguments); switch (tag[4]) { case 'a': case 'A': if (strcasecmp(tag, "obj_affect_loc") == 0 && affect_counter < MAX_OBJ_AFFECT) { tmpobj->affected[affect_counter].location = val; } else if (strcasecmp(tag, "obj_affect_mod") == 0 && affect_counter < MAX_OBJ_AFFECT) { tmpobj->affected[affect_counter].modifier = val; affect_counter++; } else { sprintf(buf, "Unknown Rent-File Tag: %s", tag); stderr_log(buf); } break; case 'b': case 'B': if (strcasecmp(tag, "obj_begin") == 0) { if (found_begin) { send_to_char("\r\n********************* NOTICE *********************\r\n" "There was a problem loading your objects from disk.\r\n" "Contact a God for assistance.\r\n", ch); return 1; } found_begin = 1; } else if (strcasecmp(tag, "obj_bitvector") == 0) { GET_OBJ_BITV(tmpobj) = asciiflag_conv(tag_arguments); } else if (strcasecmp(tag, "obj_bitvector2") == 0) { GET_OBJ_BITV2(tmpobj) = asciiflag_conv(tag_arguments); } else { sprintf(buf, "Unknown Rent-File Tag: %s", tag); stderr_log(buf); } break; case 'e': case 'E': if (strcasecmp(tag, "obj_extra_flags") == 0) { GET_OBJ_EXTRA(tmpobj) = asciiflag_conv(tag_arguments); } else if (strcasecmp(tag, "obj_end") == 0) { if (ovnum >= 0) { if (!found_begin) { send_to_char("\r\n********************* NOTICE *********************\r\n" "There was a problem loading your objects from disk.\r\n" "Contact a God for assistance.\r\n", ch); return 1; } found_begin = 0; affect_counter = 0; CREATE(crash_load_stack, struct corpse_obj_save, 1); crash_load_stack->level = 0; crash_load_stack->prev = NULL; for (tmpobj2 = ch->carrying, found = 0; tmpobj2 && !found; tmpobj2 = next_obj) { next_obj = tmpobj2->next_content; if (tmpobj2->objnum == tmpobj->inobj) { obj_to_obj(tmpobj, tmpobj2); found = 1; } if (tmpobj2->contains) { crash_load_stack->next_obj = next_obj; CREATE(temp_stack, struct corpse_obj_save, 1); temp_stack->level = crash_load_stack->level + 1; temp_stack->prev = crash_load_stack; crash_load_stack = temp_stack; next_obj = tmpobj2->contains; if (tmpobj2 == next_obj) { /* infinite loop */ next_obj = NULL; continue; } } else if (next_obj == NULL && crash_load_stack->level > 0) { temp_stack = crash_load_stack; crash_load_stack = crash_load_stack->prev; FREE(temp_stack); next_obj = crash_load_stack->next_obj; } } for (temp_stack = crash_load_stack; temp_stack; temp_stack = temp_stack_next) { temp_stack_next = temp_stack->prev; FREE(temp_stack); } if (!found) { obj_to_char(tmpobj, ch); } } else { extract_obj(tmpobj); found_begin = 0; affect_counter = 0; ovnum = 0; } } else {