begin removing orcification

This commit is contained in:
Enno Rehling 2016-11-13 17:06:28 +01:00
parent 7557b97dee
commit 8b0ee77bda
2 changed files with 20 additions and 12 deletions

View file

@ -396,9 +396,14 @@ message * give_men(int n, unit * u, unit * u2, struct order *ord)
message * disband_men(int n, unit * u, struct order *ord) { message * disband_men(int n, unit * u, struct order *ord) {
message * msg; message * msg;
static const race *rc_snotling;
static int rccache;
// TODO: cache RC_SNOTLING if (rc_changed(&rccache)) {
if (u_race(u) == get_race(RC_SNOTLING)) { rc_snotling = get_race(RC_SNOTLING);
}
if (u_race(u) == rc_snotling) {
/* snotlings may not be given to the peasants. */ /* snotlings may not be given to the peasants. */
return msg_error(u, ord, 307); return msg_error(u, ord, 307);
} }
@ -408,7 +413,7 @@ message * disband_men(int n, unit * u, struct order *ord) {
transfermen(u, NULL, n); transfermen(u, NULL, n);
//TODO: is ORCIFICATION still working? snotlings cannot be given to peasants //TODO: is ORCIFICATION still working? snotlings cannot be given to peasants
#ifdef ORCIFICATION #ifdef ORCIFICATION
if (u_race(u) == get_race(RC_SNOTLING) && !fval(u->region, RF_ORCIFIED)) { if (u_race(u) == rc_snotling && !fval(u->region, RF_ORCIFIED)) {
attrib *a = a_find(u->region->attribs, &at_orcification); attrib *a = a_find(u->region->attribs, &at_orcification);
if (!a) { if (!a) {
a = a_add(&u->region->attribs, a_new(&at_orcification)); a = a_add(&u->region->attribs, a_new(&at_orcification));

View file

@ -827,9 +827,11 @@ void randomevents(void)
else { else {
attrib *a = a_find(r->attribs, &at_orcification); attrib *a = a_find(r->attribs, &at_orcification);
if (a != NULL) { if (a != NULL) {
if (rpeasants(r) <= 0) {
a_remove(&r->attribs, a);
}
else {
double probability = 0.0; double probability = 0.0;
if (rpeasants(r) <= 0)
continue;
probability = a->data.i / (double)rpeasants(r); probability = a->data.i / (double)rpeasants(r);
if (chance(probability)) { if (chance(probability)) {
fset(r, RF_ORCIFIED); fset(r, RF_ORCIFIED);
@ -844,6 +846,7 @@ void randomevents(void)
} }
} }
} }
}
volcano_update(); volcano_update();
/* Monumente zerfallen, Schiffe verfaulen */ /* Monumente zerfallen, Schiffe verfaulen */