forked from github/server
we only call these when target is 0, anyway.
This commit is contained in:
parent
d976ee6f67
commit
d9d542cfee
34
src/give.c
34
src/give.c
|
@ -148,32 +148,22 @@ int give_quota(const unit * src, const unit * dst, const item_type * type,
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
give_horses(unit * s, unit * d, const item_type * itype, int n,
|
give_horses(unit * s, const item_type * itype, int n)
|
||||||
struct order *ord)
|
|
||||||
{
|
{
|
||||||
if (d == NULL) {
|
region *r = s->region;
|
||||||
region *r = s->region;
|
if (r->land) {
|
||||||
if (r->land) {
|
rsethorses(r, rhorses(r) + n);
|
||||||
rsethorses(r, rhorses(r) + n);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
return -1; /* use the mechanism */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
give_money(unit * s, unit * d, const item_type * itype, int n,
|
give_money(unit * s, const item_type * itype, int n)
|
||||||
struct order *ord)
|
|
||||||
{
|
{
|
||||||
if (d == NULL) {
|
region *r = s->region;
|
||||||
region *r = s->region;
|
if (r->land) {
|
||||||
if (r->land) {
|
rsetmoney(r, rmoney(r) + n);
|
||||||
rsetmoney(r, rmoney(r) + n);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
return -1; /* use the mechanism */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -238,11 +228,11 @@ struct order *ord)
|
||||||
/* return horses to the region */
|
/* return horses to the region */
|
||||||
if (itype->construction && itype->flags & ITF_ANIMAL) {
|
if (itype->construction && itype->flags & ITF_ANIMAL) {
|
||||||
if (itype->construction->skill == SK_HORSE_TRAINING) {
|
if (itype->construction->skill == SK_HORSE_TRAINING) {
|
||||||
give_horses(src, dest, itype, n, ord);
|
give_horses(src, itype, n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (itype->rtype == get_resourcetype(R_SILVER)) {
|
else if (itype->rtype == get_resourcetype(R_SILVER)) {
|
||||||
give_money(src, dest, itype, n, ord);
|
give_money(src, itype, n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handle_event(src->attribs, "give", dest);
|
handle_event(src->attribs, "give", dest);
|
||||||
|
|
Loading…
Reference in New Issue