bug in fishing-code

This commit is contained in:
Enno Rehling 2010-02-10 06:30:47 +00:00
parent 8553d0083b
commit 5415d3bf20
2 changed files with 14 additions and 14 deletions

View file

@ -221,7 +221,7 @@ get_food(region *r)
* jede Einheit genug Silber für ihren Unterhalt hat. */
for (u = r->units; u; u = u->next) {
int style = lifestyle(u);
int style = INCOME_FISHING;
int need = style;
/* Erstmal zurücksetzen */
@ -230,23 +230,21 @@ get_food(region *r)
if (u->ship && (u->ship->flags&SF_FISHING)) {
unit * v;
int c = 2;
for (v=r->units;c>0 && v;v=v->next) {
for (v=u;c>0 && v;v=v->next) {
if (v->ship==u->ship) {
if (u==v) {
int get = 0;
if (u->number==c) {
if (v->number==c) {
get = need;
} else {
int x = MIN(c, u->number);
get = (style * x) / u->number;
int x = MIN(c, v->number);
get = (style * x) / v->number;
}
if (get) {
change_money(u, get);
change_money(v, get);
}
}
c -= v->number;
}
}
u->ship->flags -= SF_FISHING;
}

View file

@ -75,6 +75,8 @@ extern void st_register(const ship_type * type);
#define SF_SELECT 1<<3 /* previously FL_DH */
#define SF_FISHING 1<<4 /* was on an ocean, can fish */
#define INCOME_FISHING 10
typedef struct ship {
struct ship *next;
struct ship *nexthash;