mystickdreamer

Untitled

Dec 1st, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.15 KB | None | 0 0
  1. in save_char function I have
  2.  
  3. /* Save Skills */
  4.     for (i = 1; i <= SK_ARRAY_MAX; i++) {
  5.         if (GET_SKILL_RANK(ch, i))
  6.             fprintf(fl, "Skil: %d %d/%d\n", GET_SKILL(ch, i), GET_SKILL_RANK(ch, i), GET_SKILL_XP(ch, i));
  7.     }
  8.  
  9. // I believe the skills are correctly saving because when I modify a skill, save the character, and open the pfile while the character is loaded the skills are saved into the pfile
  10.  
  11.  
  12. under load_char I have
  13.  
  14.   case 'S':
  15.                     if (!strcmp(tag, "Sex ")) GET_SEX(ch) = atoi(line);
  16.                     else if (!strcmp(tag, "ScrW")) GET_SCREEN_WIDTH(ch) = atoi(line);
  17.                     else if (!strcmp(tag, "Skil"))load_skills(ch, line, LOAD_SKILL);
  18.  
  19.  
  20.  
  21. and then the load_skills function is
  22.  
  23. static void load_skills(struct char_data *ch, const char *line, int mode) {//(FILE *fl, struct char_data *ch) {
  24.     int num = 0, num2 = 0, num3 = 0;
  25.     int i;
  26.     sscanf(line, "%d %d/%d", &num, &num2, &num3);
  27.  
  28.     switch (mode) {
  29.         case LOAD_SKILL:
  30. //            GET_SKILL(ch, i) = num;
  31.             GET_SKILL_RANK(ch, num) = num2;
  32.             GET_SKILL_XP(ch, num) = num3;
  33.             break;
  34.     }
Advertisement
Add Comment
Please, Sign In to add comment