forked from github/server
quick performance improvement for scale_number
This commit is contained in:
parent
beb673a28b
commit
7cedc4c9dd
1 changed files with 7 additions and 4 deletions
|
@ -974,6 +974,12 @@ void remove_skill(unit * u, skill_t sk)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void remove_skills(unit * u) {
|
||||||
|
free(u->skills);
|
||||||
|
u->skills = NULL;
|
||||||
|
u->skill_size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
skill *add_skill(unit * u, skill_t sk)
|
skill *add_skill(unit * u, skill_t sk)
|
||||||
{
|
{
|
||||||
skill *sv;
|
skill *sv;
|
||||||
|
@ -1588,10 +1594,7 @@ void scale_number(unit * u, int n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (u->number == 0 || n == 0) {
|
if (u->number == 0 || n == 0) {
|
||||||
skill_t sk;
|
remove_skills(u);
|
||||||
for (sk = 0; sk < MAXSKILLS; sk++) {
|
|
||||||
remove_skill(u, sk);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_number(u, n);
|
set_number(u, n);
|
||||||
|
|
Loading…
Reference in a new issue