old_race ist wesentlich langsamer als new_race. Deshalb wird es jetzt an ein paar Stellen mal ersetzt.

This commit is contained in:
Enno Rehling 2005-05-05 01:37:08 +00:00
parent 36b8e00728
commit f00a3d96ff
7 changed files with 25 additions and 14 deletions

View File

@ -3790,8 +3790,10 @@ processorders (void)
puts(" - Kontakte löschen"); puts(" - Kontakte löschen");
remove_contacts(); remove_contacts();
#ifdef KARMA_MODULE
puts(" - Jihad-Angriffe"); puts(" - Jihad-Angriffe");
jihad_attacks(); jihad_attacks();
#endif
puts(" - Attackieren"); puts(" - Attackieren");
if(nobattle == false) do_battle(); if(nobattle == false) do_battle();
@ -3882,8 +3884,10 @@ processorders (void)
puts(" - Gebäudeunterhalt (2. Versuch)"); puts(" - Gebäudeunterhalt (2. Versuch)");
maintain_buildings(true); maintain_buildings(true);
#ifdef KARMA_MODULE
puts(" - Jihads setzen"); puts(" - Jihads setzen");
karma(); karma();
#endif
#ifdef USE_UGROUPS #ifdef USE_UGROUPS
puts(" - Verbände bilden"); puts(" - Verbände bilden");

View File

@ -1061,8 +1061,9 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
} }
da += rc_specialdamage(au->race, du->race, awtype); da += rc_specialdamage(au->race, du->race, awtype);
#ifdef KARMA_MODULE
da += jihad(au->faction, du->race); da += jihad(au->faction, du->race);
#endif
faerie_level = fspecial(du->faction, FS_FAERIE); faerie_level = fspecial(du->faction, FS_FAERIE);
if (type == AT_STANDARD && faerie_level) { if (type == AT_STANDARD && faerie_level) {
int c; int c;
@ -1679,9 +1680,10 @@ skilldiff(troop at, troop dt, int dist)
af->side->size[SUM_ROW] >= df->side->size[SUM_ROW] * 10) af->side->size[SUM_ROW] >= df->side->size[SUM_ROW] * 10)
skdiff += 1; skdiff += 1;
#ifdef KARMA_MODULE
/* TODO this should be a skillmod */ /* TODO this should be a skillmod */
skdiff += jihad(au->faction, du->race); skdiff += jihad(au->faction, du->race);
#endif
skdiff += af->person[at.index].attack; skdiff += af->person[at.index].attack;
skdiff -= df->person[dt.index].defence; skdiff -= df->person[dt.index].defence;

View File

@ -1034,11 +1034,17 @@ cansee(const faction * f, const region * r, const unit * u, int modifier)
int n; int n;
boolean cansee = false; boolean cansee = false;
unit *u2; unit *u2;
static const item_type * itype_grail = (const item_type *)0xdeadbeef; static const item_type * itype_grail;
static boolean init;
if (!init) {
init = true;
itype_grail = it_find("grail");
}
if (u->faction == f || omniscient(f)) { if (u->faction == f || omniscient(f)) {
return true; return true;
} else if (old_race(u->race) == RC_SPELL) { } else if (u->race == new_race[RC_SPELL]) {
return false; return false;
} else if (u->number == 0) { } else if (u->number == 0) {
attrib *a = a_find(u->attribs, &at_creator); attrib *a = a_find(u->attribs, &at_creator);
@ -1051,7 +1057,6 @@ cansee(const faction * f, const region * r, const unit * u, int modifier)
} }
if (leftship(u)) return true; if (leftship(u)) return true;
if (itype_grail==(const item_type *)0xdeadbeef) itype_grail = it_find("grail");
if (itype_grail!=NULL && i_get(u->items, itype_grail)) return true; if (itype_grail!=NULL && i_get(u->items, itype_grail)) return true;
n = eff_stealth(u, r) - modifier; n = eff_stealth(u, r) - modifier;
@ -1094,7 +1099,7 @@ cansee_durchgezogen(const faction * f, const region * r, const unit * u, int mod
int n; int n;
boolean cansee = false; boolean cansee = false;
unit *u2; unit *u2;
if (old_race(u->race) == RC_SPELL || u->number == 0) return false; if (u->race == new_race[RC_SPELL] || u->number == 0) return false;
else if (u->faction == f) cansee = true; else if (u->faction == f) cansee = true;
else { else {

View File

@ -1266,7 +1266,7 @@ const item_t matresource[] = {
static int static int
mod_elves_only(const unit * u, const region * r, skill_t sk, int value) mod_elves_only(const unit * u, const region * r, skill_t sk, int value)
{ {
if (old_race(u->race) == RC_ELF) return value; if (u->race == new_race[RC_ELF]) return value;
unused(r); unused(r);
return -118; return -118;
} }
@ -1968,7 +1968,7 @@ static int
use_warmthpotion(struct unit *u, const struct potion_type *ptype, int amount, struct order * ord) use_warmthpotion(struct unit *u, const struct potion_type *ptype, int amount, struct order * ord)
{ {
assert(ptype==oldpotiontype[P_WARMTH]); assert(ptype==oldpotiontype[P_WARMTH]);
if (old_race(u->faction->race) == RC_INSECT) { if (u->faction->race == new_race[RC_INSECT]) {
fset(u, UFL_WARMTH); fset(u, UFL_WARMTH);
} else { } else {
/* nur für insekten: */ /* nur für insekten: */

View File

@ -550,7 +550,6 @@ jihad(faction *f, const race * rc)
for(a = a_find(f->attribs, &at_jihad); a; a = a->nexttype) { for(a = a_find(f->attribs, &at_jihad); a; a = a->nexttype) {
if(a->data.sa[0] == jrt) return a->data.sa[1]; if(a->data.sa[0] == jrt) return a->data.sa[1];
} }
return 0; return 0;
} }

View File

@ -67,9 +67,11 @@ extern struct attrib_type at_jihad;
extern struct fspecialdata fspecials[]; extern struct fspecialdata fspecials[];
extern int fspecial(const struct faction *f, fspecial_t special); extern int fspecial(const struct faction *f, fspecial_t special);
#ifdef KARMA_MODULE
extern void karma(void); extern void karma(void);
extern int jihad(struct faction *, const struct race *); extern int jihad(struct faction *, const struct race *);
extern void jihad_attacks(void); extern void jihad_attacks(void);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -607,12 +607,11 @@ spskill(char * buffer, const struct locale * lang, const struct unit * u, skill_
char * pbuf = buffer; char * pbuf = buffer;
int i, effsk; int i, effsk;
if (!u->number) if (!u->number) return 0;
return 0;
if (!has_skill(u, sk)) return; if (!has_skill(u, sk)) return 0;
pbuf += strlcpy(pbuf, ", "); sbuf+=2; pbuf += strlcpy(pbuf, ", ");
if (!*dh) { if (!*dh) {
pbuf += strlcpy(pbuf, LOC(lang, "nr_skills")); pbuf += strlcpy(pbuf, LOC(lang, "nr_skills"));
@ -632,7 +631,7 @@ spskill(char * buffer, const struct locale * lang, const struct unit * u, skill_
if (sk == SK_STEALTH) { if (sk == SK_STEALTH) {
i = u_geteffstealth(u); i = u_geteffstealth(u);
if(i>=0) { if(i>=0) {
pbuf += dprintf(pbuf, "%d/", i); pbuf += sprintf(pbuf, "%d/", i);
} }
} }