forked from github/server
"Tragekapazität von Monstern zu hoch" throwing away carts because monsters don't know what to do with them.
This commit is contained in:
parent
38ff80892f
commit
802b9332c7
4 changed files with 46 additions and 34 deletions
|
@ -78,18 +78,30 @@
|
|||
static void
|
||||
reduce_weight(unit * u)
|
||||
{
|
||||
int horses = get_resource(u, oldresourcetype[R_HORSE]);
|
||||
int capacity = walkingcapacity(u);
|
||||
int capacity, weight = 0;
|
||||
item ** itmp = &u->items;
|
||||
int weight = 0;
|
||||
int horses = get_resource(u, oldresourcetype[R_HORSE]);
|
||||
|
||||
if (horses > 0) {
|
||||
horses = MIN(horses, (u->number*2));
|
||||
change_resource(u, oldresourcetype[R_HORSE], - horses);
|
||||
}
|
||||
|
||||
/* 0. ditch any vehicles */
|
||||
while (*itmp!=NULL) {
|
||||
item * itm = *itmp;
|
||||
const item_type * itype = itm->type;
|
||||
weight += itm->number*itype->weight;
|
||||
if (itype->flags & ITF_VEHICLE) {
|
||||
give_item(itm->number, itm->type, u, NULL, NULL);
|
||||
}
|
||||
if (*itmp==itm) itmp=&itm->next;
|
||||
}
|
||||
|
||||
capacity = walkingcapacity(u);
|
||||
|
||||
/* 1. get rid of anything that isn't silver or really lightweight or helpful in combat */
|
||||
while (capacity>0 && *itmp!=NULL) {
|
||||
for (itmp = &u->items;*itmp && capacity>0;) {
|
||||
item * itm = *itmp;
|
||||
const item_type * itype = itm->type;
|
||||
weight += itm->number*itype->weight;
|
||||
|
|
|
@ -190,7 +190,7 @@ bin_r_str_buf(struct storage * store, char * result, size_t size)
|
|||
result[0] = 0;
|
||||
} else {
|
||||
len = (size_t)i;
|
||||
rd = MIN(len, size);
|
||||
rd = MIN(len, size-1);
|
||||
fread(result, sizeof(char), rd, file(store));
|
||||
if (rd<len) {
|
||||
fseek(file(store), (long)(len-rd), SEEK_CUR);
|
||||
|
|
|
@ -284,56 +284,56 @@ ridingcapacity(unit * u)
|
|||
int
|
||||
walkingcapacity(const struct unit * u)
|
||||
{
|
||||
int n, tmp, people, pferde_fuer_wagen;
|
||||
int wagen_ohne_pferde, wagen_mit_pferden, wagen_mit_trollen;
|
||||
int n, tmp, people, pferde_fuer_wagen;
|
||||
int wagen_ohne_pferde, wagen_mit_pferden, wagen_mit_trollen;
|
||||
int vehicles = 0, vcap = 0;
|
||||
int animals = 0, acap = 0;
|
||||
|
||||
get_transporters(u->items, &animals, &acap, &vehicles, &vcap);
|
||||
|
||||
/* Das Gewicht, welches die Pferde tragen, plus das Gewicht, welches
|
||||
* die Leute tragen */
|
||||
* die Leute tragen */
|
||||
|
||||
pferde_fuer_wagen = MIN(animals, effskill(u, SK_RIDING) * u->number * 4);
|
||||
if (fval(u->race, RCF_HORSE)) {
|
||||
animals += u->number;
|
||||
people = 0;
|
||||
} else {
|
||||
people = u->number;
|
||||
}
|
||||
if (fval(u->race, RCF_HORSE)) {
|
||||
animals += u->number;
|
||||
people = 0;
|
||||
} else {
|
||||
people = u->number;
|
||||
}
|
||||
|
||||
/* maximal diese Pferde können zum Ziehen benutzt werden */
|
||||
wagen_mit_pferden = MIN(vehicles, pferde_fuer_wagen / HORSESNEEDED);
|
||||
/* maximal diese Pferde können zum Ziehen benutzt werden */
|
||||
wagen_mit_pferden = MIN(vehicles, pferde_fuer_wagen / HORSESNEEDED);
|
||||
|
||||
n = wagen_mit_pferden * vcap;
|
||||
n = wagen_mit_pferden * vcap;
|
||||
|
||||
if (u->race == new_race[RC_TROLL]) {
|
||||
/* 4 Trolle ziehen einen Wagen. */
|
||||
/* Unbesetzte Wagen feststellen */
|
||||
wagen_ohne_pferde = vehicles - wagen_mit_pferden;
|
||||
if (u->race == new_race[RC_TROLL]) {
|
||||
/* 4 Trolle ziehen einen Wagen. */
|
||||
/* Unbesetzte Wagen feststellen */
|
||||
wagen_ohne_pferde = vehicles - wagen_mit_pferden;
|
||||
|
||||
/* Genug Trolle, um die Restwagen zu ziehen? */
|
||||
wagen_mit_trollen = MIN(u->number / 4, wagen_ohne_pferde);
|
||||
/* Genug Trolle, um die Restwagen zu ziehen? */
|
||||
wagen_mit_trollen = MIN(u->number / 4, wagen_ohne_pferde);
|
||||
|
||||
/* Wagenkapazität hinzuzählen */
|
||||
n += wagen_mit_trollen * vcap;
|
||||
wagen_ohne_pferde -= wagen_mit_trollen;
|
||||
}
|
||||
/* Wagenkapazität hinzuzählen */
|
||||
n += wagen_mit_trollen * vcap;
|
||||
wagen_ohne_pferde -= wagen_mit_trollen;
|
||||
}
|
||||
|
||||
n += animals * acap;
|
||||
n += people * personcapacity(u);
|
||||
/* Goliathwasser */
|
||||
n += animals * acap;
|
||||
n += people * personcapacity(u);
|
||||
/* Goliathwasser */
|
||||
tmp = get_effect(u, oldpotiontype[P_STRONG]);
|
||||
if (tmp>0) {
|
||||
int horsecap = olditemtype[I_HORSE]->capacity;
|
||||
if (tmp>people) tmp = people;
|
||||
n += tmp * (horsecap - personcapacity(u));
|
||||
n += tmp * (horsecap - personcapacity(u));
|
||||
}
|
||||
/* change_effect wird in ageing gemacht */
|
||||
tmp = get_item(u, I_TROLLBELT);
|
||||
n += MIN(people, tmp) * (STRENGTHMULTIPLIER-1) * personcapacity(u);
|
||||
n += MIN(people, tmp) * (STRENGTHMULTIPLIER-1) * personcapacity(u);
|
||||
|
||||
return n;
|
||||
return n;
|
||||
}
|
||||
|
||||
enum {
|
||||
|
|
|
@ -194,7 +194,7 @@ static struct curse_type ct_fogtrap = {
|
|||
static struct curse_type ct_maelstrom = {
|
||||
"maelstrom",
|
||||
CURSETYP_NORM, CURSE_ISNEW, (M_DURATION | M_VIGOUR),
|
||||
NULL
|
||||
cinfo_simple
|
||||
};
|
||||
static struct curse_type ct_blessedharvest = {
|
||||
"blessedharvest",
|
||||
|
|
Loading…
Reference in a new issue