forked from github/server
remove static initialization code
This commit is contained in:
parent
aa998166e4
commit
b43ac6ab27
2 changed files with 26 additions and 29 deletions
11
src/battle.c
11
src/battle.c
|
@ -1923,8 +1923,8 @@ int skilldiff(troop at, troop dt, int dist)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (df->building) {
|
if (df->building) {
|
||||||
static const curse_type *strongwall_ct;
|
if (df->building->attribs) {
|
||||||
strongwall_ct = ct_find("strongwall");
|
const curse_type *strongwall_ct = ct_find("strongwall");
|
||||||
if (strongwall_ct) {
|
if (strongwall_ct) {
|
||||||
curse *c = get_curse(df->building->attribs, strongwall_ct);
|
curse *c = get_curse(df->building->attribs, strongwall_ct);
|
||||||
if (curse_active(c)) {
|
if (curse_active(c)) {
|
||||||
|
@ -1933,14 +1933,14 @@ int skilldiff(troop at, troop dt, int dist)
|
||||||
is_protected = 2;
|
is_protected = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (df->building->type->protection) {
|
if (df->building->type->protection) {
|
||||||
int beff = df->building->type->protection(df->building, du, DEFENSE_BONUS);
|
int beff = df->building->type->protection(df->building, du, DEFENSE_BONUS);
|
||||||
if (beff) {
|
if (beff) {
|
||||||
static const curse_type *magicwalls_ct;
|
|
||||||
skdiff -= beff;
|
skdiff -= beff;
|
||||||
is_protected = 2;
|
is_protected = 2;
|
||||||
magicwalls_ct = ct_find("magicwalls");
|
if (df->building->attribs) {
|
||||||
|
const curse_type *magicwalls_ct = ct_find("magicwalls");
|
||||||
if (magicwalls_ct
|
if (magicwalls_ct
|
||||||
&& curse_active(get_curse(df->building->attribs, magicwalls_ct))) {
|
&& curse_active(get_curse(df->building->attribs, magicwalls_ct))) {
|
||||||
/* Verdoppelt Burgenbonus */
|
/* Verdoppelt Burgenbonus */
|
||||||
|
@ -1949,6 +1949,7 @@ int skilldiff(troop at, troop dt, int dist)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* Effekte der Waffen */
|
/* Effekte der Waffen */
|
||||||
skdiff += weapon_effskill(at, dt, awp, true, dist > 1);
|
skdiff += weapon_effskill(at, dt, awp, true, dist > 1);
|
||||||
if (awp && fval(awp->type, WTF_MISSILE)) {
|
if (awp && fval(awp->type, WTF_MISSILE)) {
|
||||||
|
|
|
@ -298,8 +298,6 @@ int crew_skill(const ship *sh) {
|
||||||
int shipspeed(const ship * sh, const unit * u)
|
int shipspeed(const ship * sh, const unit * u)
|
||||||
{
|
{
|
||||||
int k = sh->type->range;
|
int k = sh->type->range;
|
||||||
static const struct curse_type *stormwind_ct, *nodrift_ct;
|
|
||||||
static bool init;
|
|
||||||
attrib *a;
|
attrib *a;
|
||||||
struct curse *c;
|
struct curse *c;
|
||||||
int bonus;
|
int bonus;
|
||||||
|
@ -312,19 +310,17 @@ int shipspeed(const ship * sh, const unit * u)
|
||||||
assert(sh->type->construction);
|
assert(sh->type->construction);
|
||||||
assert(sh->type->construction->improvement == NULL); /* sonst ist construction::size nicht ship_type::maxsize */
|
assert(sh->type->construction->improvement == NULL); /* sonst ist construction::size nicht ship_type::maxsize */
|
||||||
|
|
||||||
if (!init) {
|
|
||||||
init = true;
|
|
||||||
stormwind_ct = ct_find("stormwind");
|
|
||||||
nodrift_ct = ct_find("nodrift");
|
|
||||||
}
|
|
||||||
if (sh->size != sh->type->construction->maxsize)
|
if (sh->size != sh->type->construction->maxsize)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (curse_active(get_curse(sh->attribs, stormwind_ct)))
|
if (sh->attribs) {
|
||||||
|
if (curse_active(get_curse(sh->attribs, ct_find("stormwind")))) {
|
||||||
k *= 2;
|
k *= 2;
|
||||||
if (curse_active(get_curse(sh->attribs, nodrift_ct)))
|
}
|
||||||
|
if (curse_active(get_curse(sh->attribs, ct_find("nodrift")))) {
|
||||||
k += 1;
|
k += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (u->faction->race == u_race(u)) {
|
if (u->faction->race == u_race(u)) {
|
||||||
/* race bonus for this faction? */
|
/* race bonus for this faction? */
|
||||||
if (fval(u_race(u), RCF_SHIPSPEED)) {
|
if (fval(u_race(u), RCF_SHIPSPEED)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue