optimization: the orcish curse is pretty rare, and we are spending a lot of time on processing it.

remove static variables.
This commit is contained in:
Enno Rehling 2016-08-29 19:44:43 +01:00
parent 8ff26eb0e4
commit aa998166e4
1 changed files with 27 additions and 30 deletions

View File

@ -682,7 +682,7 @@ static void godcurse(void)
}
/** handles the "orcish" curse that makes units grow like old orks
* This would probably be better handled in an age-function for the curse,
* TODO: This would probably be better handled in an age-function for the curse,
* but it's now being called by randomevents()
*/
static void orc_growth(void)
@ -691,18 +691,13 @@ static void orc_growth(void)
for (r = regions; r; r = r->next) {
unit *u;
for (u = r->units; u; u = u->next) {
static bool init = false;
static const curse_type *ct_orcish = 0;
curse *c = 0;
if (!init) {
init = true;
ct_orcish = ct_find("orcish");
}
if (ct_orcish)
c = get_curse(u->attribs, ct_orcish);
if (c && !has_skill(u, SK_MAGIC) && !has_skill(u, SK_ALCHEMY)
if (u->attribs && !has_skill(u, SK_MAGIC) && !has_skill(u, SK_ALCHEMY)
&& !fval(u, UFL_HERO)) {
const curse_type *ct_orcish = ct_find("orcish");
if (ct_orcish) {
curse *c = get_curse(u->attribs, ct_orcish);
if (c) {
int n;
int increase = 0;
int num = get_cursedmen(u, c);
@ -728,6 +723,8 @@ static void orc_growth(void)
}
}
}
}
}
/** Talente von Dämonen verschieben sich.
*/