diff --git a/src/alchemy.c b/src/alchemy.c index a1dd86c0a..ace6a62dd 100644 --- a/src/alchemy.c +++ b/src/alchemy.c @@ -77,7 +77,7 @@ void herbsearch(unit * u, int max) herbsfound = ntimespprob(effsk * u->number, (double)rherbs(r) / 100.0F, -0.01F); herbsfound = _min(herbsfound, max); - rsetherbs(r, (short) (rherbs(r) - herbsfound)); + rsetherbs(r, rherbs(r) - herbsfound); if (herbsfound) { produceexp(u, SK_HERBALISM, u->number); diff --git a/src/economy.c b/src/economy.c index 6311d0c3a..12843bd58 100644 --- a/src/economy.c +++ b/src/economy.c @@ -2298,7 +2298,8 @@ static void plant(unit * u, int raw) /* Alles ok. Abziehen. */ use_pooled(u, rt_water, GET_DEFAULT, 1); use_pooled(u, itype->rtype, GET_DEFAULT, n); - rsetherbs(r, (short) (rherbs(r) + planted)); + /* TODO should there a region maximum for herbs? */ + rsetherbs(r, rherbs(r) + planted); ADDMSG(&u->faction->msgs, msg_message("plant", "unit region amount herb", u, r, planted, itype->rtype)); } diff --git a/src/kernel/region.c b/src/kernel/region.c index ed56851ee..5e264d3a2 100644 --- a/src/kernel/region.c +++ b/src/kernel/region.c @@ -640,7 +640,7 @@ int rherbs(const struct region *r) void rsetherbs(const struct region *r, int value) { if (r->land) { - assert(value >= 0); + assert(value >= 0 && value < (1 << 15)); r->land->herbs = (short)(value); } } @@ -1124,7 +1124,7 @@ void terraform_region(region * r, const terrain_type * terrain) } if (itype != NULL) { rsetherbtype(r, itype); - rsetherbs(r, (short)(50 + rng_int() % 31)); + rsetherbs(r, 50 + rng_int() % 31); } else { rsetherbtype(r, NULL); diff --git a/src/kernel/save.c b/src/kernel/save.c index d4df2b6f8..40894b3cd 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -946,7 +946,7 @@ static region *readregion(struct gamedata *data, int x, int y) rsetherbtype(r, NULL); } READ_INT(data->store, &n); - rsetherbs(r, (short)n); + rsetherbs(r, n); READ_INT(data->store, &n); rsetpeasants(r, n); READ_INT(data->store, &n); diff --git a/src/laws.c b/src/laws.c index 7dc6cd0af..bbb7ee342 100755 --- a/src/laws.c +++ b/src/laws.c @@ -692,7 +692,7 @@ growing_herbs(region * r, const int current_season, const int last_weeks_season) int i; for (i = rherbs(r); i > 0; i--) { if (rng_int() % 100 < (100 - rherbs(r))) - rsetherbs(r, (short)(rherbs(r) + 1)); + rsetherbs(r, rherbs(r) + 1); } } }