diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index baa8042d4..23c74310d 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -3790,8 +3790,10 @@ processorders (void) puts(" - Kontakte löschen"); remove_contacts(); +#ifdef KARMA_MODULE puts(" - Jihad-Angriffe"); jihad_attacks(); +#endif puts(" - Attackieren"); if(nobattle == false) do_battle(); @@ -3882,8 +3884,10 @@ processorders (void) puts(" - Gebäudeunterhalt (2. Versuch)"); maintain_buildings(true); +#ifdef KARMA_MODULE puts(" - Jihads setzen"); karma(); +#endif #ifdef USE_UGROUPS puts(" - Verbände bilden"); diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index e97e30256..93293db4b 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -1061,8 +1061,9 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile) } da += rc_specialdamage(au->race, du->race, awtype); +#ifdef KARMA_MODULE da += jihad(au->faction, du->race); - +#endif faerie_level = fspecial(du->faction, FS_FAERIE); if (type == AT_STANDARD && faerie_level) { int c; @@ -1679,9 +1680,10 @@ skilldiff(troop at, troop dt, int dist) af->side->size[SUM_ROW] >= df->side->size[SUM_ROW] * 10) skdiff += 1; +#ifdef KARMA_MODULE /* TODO this should be a skillmod */ skdiff += jihad(au->faction, du->race); - +#endif skdiff += af->person[at.index].attack; skdiff -= df->person[dt.index].defence; diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index 0259258bc..1ea351dce 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -1034,11 +1034,17 @@ cansee(const faction * f, const region * r, const unit * u, int modifier) int n; boolean cansee = false; 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)) { return true; - } else if (old_race(u->race) == RC_SPELL) { + } else if (u->race == new_race[RC_SPELL]) { return false; } else if (u->number == 0) { 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 (itype_grail==(const item_type *)0xdeadbeef) itype_grail = it_find("grail"); if (itype_grail!=NULL && i_get(u->items, itype_grail)) return true; 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; boolean cansee = false; 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 { diff --git a/src/common/kernel/item.c b/src/common/kernel/item.c index aa67edd71..78f6a81cc 100644 --- a/src/common/kernel/item.c +++ b/src/common/kernel/item.c @@ -1266,7 +1266,7 @@ const item_t matresource[] = { static int 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); return -118; } @@ -1968,7 +1968,7 @@ static int use_warmthpotion(struct unit *u, const struct potion_type *ptype, int amount, struct order * ord) { 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); } else { /* nur für insekten: */ diff --git a/src/common/kernel/karma.c b/src/common/kernel/karma.c index 05cac68ba..80e6eb39e 100644 --- a/src/common/kernel/karma.c +++ b/src/common/kernel/karma.c @@ -550,7 +550,6 @@ jihad(faction *f, const race * rc) for(a = a_find(f->attribs, &at_jihad); a; a = a->nexttype) { if(a->data.sa[0] == jrt) return a->data.sa[1]; } - return 0; } diff --git a/src/common/kernel/karma.h b/src/common/kernel/karma.h index 16b48b7b9..f6db5965b 100644 --- a/src/common/kernel/karma.h +++ b/src/common/kernel/karma.h @@ -67,9 +67,11 @@ extern struct attrib_type at_jihad; extern struct fspecialdata fspecials[]; extern int fspecial(const struct faction *f, fspecial_t special); +#ifdef KARMA_MODULE extern void karma(void); extern int jihad(struct faction *, const struct race *); extern void jihad_attacks(void); +#endif #ifdef __cplusplus } diff --git a/src/common/kernel/reports.c b/src/common/kernel/reports.c index f8b0ff2fa..e06e4e304 100644 --- a/src/common/kernel/reports.c +++ b/src/common/kernel/reports.c @@ -607,12 +607,11 @@ spskill(char * buffer, const struct locale * lang, const struct unit * u, skill_ char * pbuf = buffer; int i, effsk; - if (!u->number) - return 0; + if (!u->number) 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) { 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) { i = u_geteffstealth(u); if(i>=0) { - pbuf += dprintf(pbuf, "%d/", i); + pbuf += sprintf(pbuf, "%d/", i); } }