Skip to content

Commit

Permalink
amend for rherbs
Browse files Browse the repository at this point in the history
  • Loading branch information
stm2 committed Dec 17, 2015
1 parent d85123f commit 6c77e5e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/alchemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/economy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
4 changes: 2 additions & 2 deletions src/kernel/region.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/save.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/laws.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit 6c77e5e

Please sign in to comment.