Replace common pattern by new LIMIT_TO()

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2013-01-14 22:34:05 +01:00
parent aa870f5d91
commit 726b9380d1
11 changed files with 73 additions and 162 deletions

View file

@ -51,11 +51,7 @@ hap_fact(struct natstr *tnat, struct natstr *vnat)
hap_fact = 2.0;
else /* Target has no happy, worse fighting */
hap_fact = 0.8;
if (hap_fact > 2.0)
hap_fact = 2.0;
if (hap_fact < 0.8)
hap_fact = 0.8;
return hap_fact;
return LIMIT_TO(hap_fact, 0.8, 2.0);
}
/* Return happiness required to keep NP's citizens happy. */