Routine fuer "Teure Fremde" hat auch Untote korrigiert.

This commit is contained in:
Enno Rehling 2007-03-11 20:52:09 +00:00
parent 8b2897406c
commit e9feec08ba
5 changed files with 44 additions and 39 deletions

View File

@ -2035,8 +2035,8 @@ password_cmd(unit * u, struct order * ord)
strncpy(pbuf, s, 31); strncpy(pbuf, s, 31);
pbuf[31] = 0; pbuf[31] = 0;
c = pbuf; c = pbuf;
while(*c) { while (*c) {
if(!isalnum(*c)) pwok = false; if (!isalnum(*c)) pwok = false;
c++; c++;
} }
if (pwok == false) { if (pwok == false) {

View File

@ -1153,9 +1153,10 @@ demon_skillchanges(void)
while (weeks--) learn_skill(u, sv->id, 1.0); while (weeks--) learn_skill(u, sv->id, 1.0);
} }
if (sv->old>sv->level) { if (sv->old>sv->level) {
log_printf("%s dropped from %u to %u:%u in %s\n", if (!quiet) {
unitname(u), sv->old, sv->level, log_printf("%s dropped from %u to %u:%u in %s\n",
sv->weeks, skillname(sv->id, NULL)); unitname(u), sv->old, sv->level, sv->weeks, skillname(sv->id, NULL));
}
} }
} }
++sv; ++sv;

View File

@ -80,13 +80,13 @@ getmagicskill(void)
boolean boolean
is_migrant(unit *u) is_migrant(unit *u)
{ {
if (u->race == u->faction->race) return false; if (u->race == u->faction->race) return false;
if (is_familiar(u)) return false; if (fval(u->race, RCF_UNDEAD|RCF_ILLUSIONARY)) return false;
if (is_familiar(u)) return false;
if (u->race == new_race[RC_TOAD]) return false;
if (u->race == new_race[RC_TOAD]) return false; return true;
return true;
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */

View File

@ -103,15 +103,15 @@ enable_skill(const char * skname, boolean value)
skill_t skill_t
sk_find(const char * name) sk_find(const char * name)
{ {
skill_t i; skill_t i;
if (name==NULL) return NOSKILL; if (name==NULL) return NOSKILL;
if (strncmp(name, "sk_", 3)==0) name+=3; if (strncmp(name, "sk_", 3)==0) name+=3;
for (i=0;i!=MAXSKILLS;++i) { for (i=0;i!=MAXSKILLS;++i) {
if (skill_enabled[i]) { if (skill_enabled[i]) {
if (strcmp(name, skillnames[i])==0) return i; if (strcmp(name, skillnames[i])==0) return i;
} }
} }
return NOSKILL; return NOSKILL;
} }
/** skillmod attribut **/ /** skillmod attribut **/

View File

@ -217,12 +217,18 @@ warn_items(void)
static boolean static boolean
kor_teure_talente(unit *u) kor_teure_talente(unit *u)
{ {
if(effskill(u, SK_TACTICS) >= 1 || const skill_t expskills[] = { SK_ALCHEMY, SK_HERBALISM, SK_MAGIC, SK_SPY, SK_TACTICS, NOSKILL };
effskill(u, SK_MAGIC) >= 1 || skill * sv = u->skills;
effskill(u, SK_ALCHEMY) >= 1 || for (;sv!=u->skills+u->skill_size;++sv) {
effskill(u, SK_HERBALISM) >= 1 || int l = 0, h = 4;
effskill(u, SK_SPY) >= 1) { skill_t sk = sv->id;
return true; assert(expskills[h]==NOSKILL);
while (l<h) {
int m = (l+h)/2;
if (sk==expskills[m]) return true;
else if (sk>expskills[m]) l=m+1;
else h=m;
}
} }
return false; return false;
} }
@ -231,25 +237,23 @@ static void
no_teurefremde(boolean convert) no_teurefremde(boolean convert)
{ {
const curse_type * slave_ct = ct_find("slavery"); const curse_type * slave_ct = ct_find("slavery");
region *r; faction * f;
for(r=regions;r;r=r->next) { for (f=factions;f;f=f->next) {
unit *u; if (f->no != MONSTER_FACTION) {
unit *u;
for(u=r->units;u;u=u->next) { for (u=f->units;u;u=u->nextF) {
if (u->faction->no != MONSTER_FACTION && playerrace(u->faction->race) if (is_migrant(u) && kor_teure_talente(u)) {
&& is_migrant(u) && kor_teure_talente(u)) if (slave_ct && curse_active(get_curse(u->attribs, slave_ct)))
{ continue;
if (slave_ct && curse_active(get_curse(u->attribs, slave_ct))) log_warning(("Teurer Migrant: %s, Partei %s\n", unitname(u), factionname(f)));
continue; if (convert) {
log_warning(("Teurer Migrant: %s, Partei %s\n", u->race = f->race;
unitname(u), factionname(u->faction))); u->irace = f->race;
if (convert) { sprintf(buf, "Die Götter segnen %s mit der richtigen Rasse",
u->race = u->faction->race; unitname(u));
u->irace = u->faction->race; addmessage(0, u->faction, buf, MSG_MESSAGE, ML_IMPORTANT);
sprintf(buf, "Die Götter segnen %s mit der richtigen Rasse", }
unitname(u));
addmessage(0, u->faction, buf, MSG_MESSAGE, ML_IMPORTANT);
} }
} }
} }