forked from github/server
misc bugfixes turn 3
This commit is contained in:
parent
5c4b97dfc3
commit
48f82ece17
4 changed files with 27 additions and 38 deletions
|
@ -482,33 +482,32 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
|
|||
region * r = u->region;
|
||||
plane * pl;
|
||||
request *o;
|
||||
int recruitcost;
|
||||
int recruitcost = -1;
|
||||
const faction * f = u->faction;
|
||||
const struct race * rc = f->race;
|
||||
const struct race * rc = u->race;
|
||||
const char * str;
|
||||
|
||||
if (fval(u, UFL_RECRUITING)) rc = u->race;
|
||||
|
||||
init_tokens(ord);
|
||||
skip_token();
|
||||
n = getuint();
|
||||
|
||||
str = getstrtoken();
|
||||
if (str && str[0]) {
|
||||
/* Monster dürfen REKRUTIERE 15 dracoid machen
|
||||
* also: secondary race */
|
||||
rc = findrace(str, f->locale);
|
||||
if (rc!=NULL) {
|
||||
recruitcost = recruit_cost(f, rc);
|
||||
if (u->number==0) {
|
||||
str = getstrtoken();
|
||||
if (str && str[0]) {
|
||||
/* Monster dürfen REKRUTIERE 15 dracoid machen
|
||||
* also: secondary race */
|
||||
rc = findrace(str, f->locale);
|
||||
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
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
if (!playerrace(u->race) || idle(u->faction)) {
|
||||
if (!playerrace(rc) || idle(u->faction)) {
|
||||
cmistake(u, ord, 139, MSG_EVENT);
|
||||
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)) {
|
||||
/* 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);
|
||||
return;
|
||||
}
|
||||
fset(u, UFL_RECRUITING);
|
||||
|
||||
o = (request *) calloc(1, sizeof(request));
|
||||
o->qty = n;
|
||||
o->unit = u;
|
||||
|
|
|
@ -272,10 +272,10 @@ get_food(region *r)
|
|||
faction * owner = r->land->ownership->owner;
|
||||
if (owner && owner!=u->faction) {
|
||||
for (v=r->units;v;v=v->next) {
|
||||
if (v->faction==owner) break;
|
||||
}
|
||||
if (v) {
|
||||
help_feed(v, u, &need);
|
||||
if (v->faction==owner && alliedunit(v, f, HELP_MONEY) && help_money(v)) {
|
||||
help_feed(v, u, &need);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1329,14 +1329,14 @@ terraform_region(region * r, const terrain_type * terrain)
|
|||
rsethorses(r, rng_int() % (terrain->size / 50));
|
||||
if(rng_int()%100 < 40) {
|
||||
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)) {
|
||||
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 {
|
||||
rsettrees(r, 2, 0);
|
||||
}
|
||||
rsettrees(r, 1, rtrees(r, 2)/4);
|
||||
rsettrees(r, 0, rtrees(r, 2)/8);
|
||||
|
||||
if (!fval(r, RF_CHAOTIC)) {
|
||||
int peasants;
|
||||
|
|
|
@ -62,7 +62,6 @@ struct item;
|
|||
#define UFL_STEALTH (1<<26)
|
||||
#define UFL_GUARD (1<<27)
|
||||
#define UFL_GROUP (1<<28)
|
||||
#define UFL_RECRUITING (1<<29) /* unit is recruiting, and cannot change race */
|
||||
|
||||
/* 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)
|
||||
|
|
Loading…
Reference in a new issue