"Tragekapazität von Monstern zu hoch"
throwing away carts because monsters don't know what to do with them.
This commit is contained in:
Enno Rehling 2008-08-28 15:16:13 +00:00
parent 38ff80892f
commit 802b9332c7
4 changed files with 46 additions and 34 deletions

View File

@ -78,18 +78,30 @@
static void static void
reduce_weight(unit * u) reduce_weight(unit * u)
{ {
int horses = get_resource(u, oldresourcetype[R_HORSE]); int capacity, weight = 0;
int capacity = walkingcapacity(u);
item ** itmp = &u->items; item ** itmp = &u->items;
int weight = 0; int horses = get_resource(u, oldresourcetype[R_HORSE]);
if (horses > 0) { if (horses > 0) {
horses = MIN(horses, (u->number*2)); horses = MIN(horses, (u->number*2));
change_resource(u, oldresourcetype[R_HORSE], - horses); 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 */ /* 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; item * itm = *itmp;
const item_type * itype = itm->type; const item_type * itype = itm->type;
weight += itm->number*itype->weight; weight += itm->number*itype->weight;

View File

@ -190,7 +190,7 @@ bin_r_str_buf(struct storage * store, char * result, size_t size)
result[0] = 0; result[0] = 0;
} else { } else {
len = (size_t)i; len = (size_t)i;
rd = MIN(len, size); rd = MIN(len, size-1);
fread(result, sizeof(char), rd, file(store)); fread(result, sizeof(char), rd, file(store));
if (rd<len) { if (rd<len) {
fseek(file(store), (long)(len-rd), SEEK_CUR); fseek(file(store), (long)(len-rd), SEEK_CUR);

View File

@ -194,7 +194,7 @@ static struct curse_type ct_fogtrap = {
static struct curse_type ct_maelstrom = { static struct curse_type ct_maelstrom = {
"maelstrom", "maelstrom",
CURSETYP_NORM, CURSE_ISNEW, (M_DURATION | M_VIGOUR), CURSETYP_NORM, CURSE_ISNEW, (M_DURATION | M_VIGOUR),
NULL cinfo_simple
}; };
static struct curse_type ct_blessedharvest = { static struct curse_type ct_blessedharvest = {
"blessedharvest", "blessedharvest",