From aa619ea97772afaaba3a1ec55802fd758ad029a7 Mon Sep 17 00:00:00 2001 From: Christian Schlittchen Date: Sun, 28 Apr 2002 07:53:07 +0000 Subject: [PATCH] =?UTF-8?q?-=20rhorses/sethorses=20regul=C3=A4re=20Funktio?= =?UTF-8?q?n.=20Besseres=20Debugging.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/gamecode/economy.c | 2 +- src/common/kernel/region.c | 13 +++++++++++++ src/common/kernel/region.h | 5 ++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index 2990a8340..a664f821c 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -504,7 +504,7 @@ addgive(unit * u, unit * u2, int n, resource_t res, const char * cmd, int error) /* Derzeit fallen nur Silber und Pferde an die Region * */ - void +void give_peasants(int n, const item_type * itype, unit * src) { region *r = src->region; diff --git a/src/common/kernel/region.c b/src/common/kernel/region.c index e0b8605fd..18da9af0d 100644 --- a/src/common/kernel/region.c +++ b/src/common/kernel/region.c @@ -613,6 +613,19 @@ rmoney(const region * r) return ((r)->land?(r)->land->money:0); } +void +rsethorses(region *r, int value) +{ + assert(r->land != NULL && value >= 0); + r->land->horses = value; +} + +int +rhorses(region *r) +{ + return r->land?r->land->horses:0; +} + void rsetmoney(region * r, int value) { diff --git a/src/common/kernel/region.h b/src/common/kernel/region.h index e3860112c..d53b7d26b 100644 --- a/src/common/kernel/region.h +++ b/src/common/kernel/region.h @@ -171,9 +171,8 @@ int rpeasants(const struct region * r); void rsetpeasants(struct region * r, int value); int rmoney(const struct region * r); void rsetmoney(struct region * r, int value); - -#define rhorses(r) ((r)->land?(r)->land->horses:0) -#define rsethorses(r, value) ((r)->land?((r)->land->horses=(value)):(assert((value)>=0), (value)),0) +int rhorses(struct region * r); +void rsethorses(struct region * r, int value); #define rbuildings(r) ((r)->buildings)