forked from github/server
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:
parent
8ff26eb0e4
commit
aa998166e4
1 changed files with 27 additions and 30 deletions
|
@ -682,7 +682,7 @@ static void godcurse(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** handles the "orcish" curse that makes units grow like old orks
|
/** 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()
|
* but it's now being called by randomevents()
|
||||||
*/
|
*/
|
||||||
static void orc_growth(void)
|
static void orc_growth(void)
|
||||||
|
@ -691,18 +691,13 @@ static void orc_growth(void)
|
||||||
for (r = regions; r; r = r->next) {
|
for (r = regions; r; r = r->next) {
|
||||||
unit *u;
|
unit *u;
|
||||||
for (u = r->units; u; u = u->next) {
|
for (u = r->units; u; u = u->next) {
|
||||||
static bool init = false;
|
if (u->attribs && !has_skill(u, SK_MAGIC) && !has_skill(u, SK_ALCHEMY)
|
||||||
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)
|
|
||||||
&& !fval(u, UFL_HERO)) {
|
&& !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 n;
|
||||||
int increase = 0;
|
int increase = 0;
|
||||||
int num = get_cursedmen(u, c);
|
int num = get_cursedmen(u, c);
|
||||||
|
@ -728,6 +723,8 @@ static void orc_growth(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Talente von Dämonen verschieben sich.
|
/** Talente von Dämonen verschieben sich.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue