From d6c5689792b702d20e45d8198f24756c20a6d499 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Tue, 11 May 2021 18:41:40 +0200 Subject: [PATCH 10/12] Introduce effect_value_will_make_positive(). See osdn #42239 --- common/effects.c | 9 +++++++++ common/effects.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/common/effects.c b/common/effects.c index 7800f18c89..183fc79432 100644 --- a/common/effects.c +++ b/common/effects.c @@ -491,6 +491,15 @@ bool effect_universals_value_never_below(enum effect_type type, return guaranteed_min_effect_value >= min_value; } +/**********************************************************************//** + Returns a value that, if found in an effect value, always will make the + result of any evaluation where it is active positive. +**************************************************************************/ +int effect_value_will_make_positive(enum effect_type type) +{ + return 1 + (effect_cumulative_min(type, NULL) * -1); +} + /**********************************************************************//** Receives a new effect. This is called by the client when the packet arrives. diff --git a/common/effects.h b/common/effects.h index a40ae5498b..fe2fd6b9a6 100644 --- a/common/effects.h +++ b/common/effects.h @@ -393,6 +393,8 @@ bool effect_universals_value_never_below(enum effect_type type, size_t n_unis, int min_value); +int effect_value_will_make_positive(enum effect_type type); + bool is_building_replaced(const struct city *pcity, const struct impr_type *pimprove, const enum req_problem_type prob_type); -- 2.30.2