From 925d65c206e37d70a2cf5e060d2e76d4bcb5434d Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 22 Nov 2016 12:22:07 +0100 Subject: [PATCH] move entertainmoney to economy --- src/economy.c | 17 +++++++++++++++++ src/economy.h | 1 + src/items.c | 4 ++-- src/kernel/config.c | 17 ----------------- src/kernel/config.h | 1 - 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/economy.c b/src/economy.c index a7d6740dd..d3f6189fc 100644 --- a/src/economy.c +++ b/src/economy.c @@ -112,6 +112,23 @@ static void recruit_init(void) } } +int entertainmoney(const region * r) +{ + double n; + + if (is_cursed(r->attribs, C_DEPRESSION, 0)) { + return 0; + } + + n = rmoney(r) / (double)ENTERTAINFRACTION; + + if (is_cursed(r->attribs, C_GENEROUS, 0)) { + n *= get_curseeffect(r->attribs, C_GENEROUS, 0); + } + + return (int)n; +} + int income(const unit * u) { const race *rc = u_race(u); diff --git a/src/economy.h b/src/economy.h index 4bce314a9..5549e13cb 100644 --- a/src/economy.h +++ b/src/economy.h @@ -48,6 +48,7 @@ extern "C" { struct request; int income(const struct unit *u); + int entertainmoney(const struct region *r); void economics(struct region *r); void produce(struct region *r); diff --git a/src/items.c b/src/items.c index 081f29c14..6fbf957b3 100644 --- a/src/items.c +++ b/src/items.c @@ -1,8 +1,8 @@ #include -#include #include "items.h" #include "study.h" +#include "economy.h" #include "move.h" #include "magic.h" @@ -137,7 +137,7 @@ struct order *ord) while (*ap && force > 0) { curse *c; attrib *a = *ap; - if (!fval(a->type, ATF_CURSE)) { + if (!(a->type->flags & ATF_CURSE)) { do { ap = &(*ap)->next; } while (*ap && a->type == (*ap)->type); diff --git a/src/kernel/config.c b/src/kernel/config.c index d100dd40c..0047744af 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -941,23 +941,6 @@ order *default_order(const struct locale *lang) return result ? copy_order(result) : 0; } -int entertainmoney(const region * r) -{ - double n; - - if (is_cursed(r->attribs, C_DEPRESSION, 0)) { - return 0; - } - - n = rmoney(r) / (double)ENTERTAINFRACTION; - - if (is_cursed(r->attribs, C_GENEROUS, 0)) { - n *= get_curseeffect(r->attribs, C_GENEROUS, 0); - } - - return (int)n; -} - int rule_give(void) { static int config; diff --git a/src/kernel/config.h b/src/kernel/config.h index 1e6b7f743..61a5f2f64 100644 --- a/src/kernel/config.h +++ b/src/kernel/config.h @@ -147,7 +147,6 @@ struct param; struct order *default_order(const struct locale *lang); - int entertainmoney(const struct region *r); void init_parameters(struct locale *lang); void free_gamedata(void);