mirror of
https://github.com/tbamud/tbamud.git
synced 2026-04-06 20:35:22 +02:00
Update gain_skill function with timers
This commit is contained in:
parent
3560427902
commit
cf621e02c1
4 changed files with 66 additions and 11 deletions
|
|
@ -434,6 +434,14 @@ int load_char(const char *name, struct char_data *ch)
|
|||
if (!strcmp(tag, "Sex ")) GET_SEX(ch) = atoi(line);
|
||||
else if (!strcmp(tag, "ScrW")) GET_SCREEN_WIDTH(ch) = atoi(line);
|
||||
else if (!strcmp(tag, "Skil")) load_skills(fl, ch);
|
||||
else if (!strcmp(tag, "SkGt")) { /* Skill Gain Timers */
|
||||
for (int i = 1; i <= MAX_SKILLS; i++) {
|
||||
long t = 0;
|
||||
if (fscanf(fl, " %ld", &t) != 1)
|
||||
t = 0;
|
||||
GET_SKILL_NEXT_GAIN(ch, i) = (time_t)t;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(tag, "Str ")) load_HMVS(ch, line, LOAD_STRENGTH);
|
||||
break;
|
||||
|
||||
|
|
@ -673,6 +681,12 @@ void save_char(struct char_data * ch)
|
|||
fprintf(fl, "0 0\n");
|
||||
}
|
||||
|
||||
/* Write per-skill next gain times as epoch seconds. */
|
||||
fprintf(fl, "SkGt:"); /* Skill Gain Timer */
|
||||
for (int i = 1; i <= MAX_SKILLS; i++)
|
||||
fprintf(fl, " %ld", (long)GET_SKILL_NEXT_GAIN(ch, i));
|
||||
fputc('\n', fl);
|
||||
|
||||
/* Save affects */
|
||||
if (tmp_aff[0].spell > 0) {
|
||||
fprintf(fl, "Affs:\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue