misc bugfixes turn 3

This commit is contained in:
Enno Rehling 2009-07-12 09:47:30 +00:00
parent 5c4b97dfc3
commit 48f82ece17
4 changed files with 27 additions and 38 deletions

View file

@ -482,33 +482,32 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
region * r = u->region; region * r = u->region;
plane * pl; plane * pl;
request *o; request *o;
int recruitcost; int recruitcost = -1;
const faction * f = u->faction; const faction * f = u->faction;
const struct race * rc = f->race; const struct race * rc = u->race;
const char * str; const char * str;
if (fval(u, UFL_RECRUITING)) rc = u->race;
init_tokens(ord); init_tokens(ord);
skip_token(); skip_token();
n = getuint(); n = getuint();
str = getstrtoken(); if (u->number==0) {
if (str && str[0]) { str = getstrtoken();
/* Monster dürfen REKRUTIERE 15 dracoid machen if (str && str[0]) {
* also: secondary race */ /* Monster dürfen REKRUTIERE 15 dracoid machen
rc = findrace(str, f->locale); * also: secondary race */
if (rc!=NULL) { rc = findrace(str, f->locale);
recruitcost = recruit_cost(f, rc); if (rc!=NULL) {
recruitcost = recruit_cost(f, rc);
}
} }
if ((u->number!=0 && rc!=f->race) || rc==NULL || recruitcost<0) {
rc = f->race;
recruitcost = recruit_cost(f, f->race);
}
} else {
recruitcost = recruit_cost(f, f->race);
} }
assert(recruitcost>=0); if (recruitcost<0) {
rc = u->race;
recruitcost = recruit_cost(f, rc);
}
u->race = rc;
assert(rc && recruitcost>=0);
#if GUARD_DISABLES_RECRUIT #if GUARD_DISABLES_RECRUIT
/* this is a very special case because the recruiting unit may be empty /* this is a very special case because the recruiting unit may be empty
@ -573,19 +572,10 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
return; return;
} }
} }
if (!playerrace(u->race) || idle(u->faction)) { if (!playerrace(rc) || idle(u->faction)) {
cmistake(u, ord, 139, MSG_EVENT); cmistake(u, ord, 139, MSG_EVENT);
return; return;
} }
/* snotlinge sollten hiermit bereits abgefangen werden, die
* parteirasse ist uruk oder ork*/
if (u->race != rc) {
if (fval(u, UFL_RECRUITING) || u->number>0) {
cmistake(u, ord, 139, MSG_EVENT);
return;
}
else u->irace = u->race = rc;
}
if (has_skill(u, SK_MAGIC)) { if (has_skill(u, SK_MAGIC)) {
/* error158;de;{unit} in {region}: '{command}' - Magier arbeiten /* error158;de;{unit} in {region}: '{command}' - Magier arbeiten
@ -611,7 +601,7 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
cmistake(u, ord, 142, MSG_EVENT); cmistake(u, ord, 142, MSG_EVENT);
return; return;
} }
fset(u, UFL_RECRUITING);
o = (request *) calloc(1, sizeof(request)); o = (request *) calloc(1, sizeof(request));
o->qty = n; o->qty = n;
o->unit = u; o->unit = u;

View file

@ -272,10 +272,10 @@ get_food(region *r)
faction * owner = r->land->ownership->owner; faction * owner = r->land->ownership->owner;
if (owner && owner!=u->faction) { if (owner && owner!=u->faction) {
for (v=r->units;v;v=v->next) { for (v=r->units;v;v=v->next) {
if (v->faction==owner) break; if (v->faction==owner && alliedunit(v, f, HELP_MONEY) && help_money(v)) {
} help_feed(v, u, &need);
if (v) { break;
help_feed(v, u, &need); }
} }
} }
} }

View file

@ -1329,14 +1329,14 @@ terraform_region(region * r, const terrain_type * terrain)
rsethorses(r, rng_int() % (terrain->size / 50)); rsethorses(r, rng_int() % (terrain->size / 50));
if(rng_int()%100 < 40) { if(rng_int()%100 < 40) {
rsettrees(r, 2, terrain->size * (30+rng_int()%40)/1000); rsettrees(r, 2, terrain->size * (30+rng_int()%40)/1000);
rsettrees(r, 1, rtrees(r, 2)/4);
rsettrees(r, 0, rtrees(r, 2)/2);
} }
} else if (chance(0.2)) { } else if (chance(0.2)) {
rsettrees(r, 2, terrain->size * (30 + rng_int() % 40) / 1000); rsettrees(r, 2, terrain->size * (30 + rng_int() % 40) / 1000);
rsettrees(r, 1, rtrees(r, 2)/4); } else {
rsettrees(r, 0, rtrees(r, 2)/2); rsettrees(r, 2, 0);
} }
rsettrees(r, 1, rtrees(r, 2)/4);
rsettrees(r, 0, rtrees(r, 2)/8);
if (!fval(r, RF_CHAOTIC)) { if (!fval(r, RF_CHAOTIC)) {
int peasants; int peasants;

View file

@ -62,7 +62,6 @@ struct item;
#define UFL_STEALTH (1<<26) #define UFL_STEALTH (1<<26)
#define UFL_GUARD (1<<27) #define UFL_GUARD (1<<27)
#define UFL_GROUP (1<<28) #define UFL_GROUP (1<<28)
#define UFL_RECRUITING (1<<29) /* unit is recruiting, and cannot change race */
/* Flags, die gespeichert werden sollen: */ /* Flags, die gespeichert werden sollen: */
#define UFL_SAVEMASK (UFL_MOVED | UFL_NOAID | UFL_OWNER | UFL_PARTEITARNUNG | UFL_LOCKED | UFL_HUNGER | UFL_TAKEALL | UFL_GUARD | UFL_STEALTH | UFL_GROUP | UFL_HERO) #define UFL_SAVEMASK (UFL_MOVED | UFL_NOAID | UFL_OWNER | UFL_PARTEITARNUNG | UFL_LOCKED | UFL_HUNGER | UFL_TAKEALL | UFL_GUARD | UFL_STEALTH | UFL_GROUP | UFL_HERO)