do not use MIN/MAX

This commit is contained in:
Enno Rehling 2018-01-01 06:56:57 +01:00
parent 396e0f6bd7
commit 0022f48c39

View file

@ -16,7 +16,9 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/ **/
#ifdef _MSC_VER
#include <platform.h> #include <platform.h>
#endif
#include <kernel/config.h> #include <kernel/config.h>
#include "curse.h" #include "curse.h"
@ -324,7 +326,8 @@ const curse_type *ct_find(const char *c)
return type; return type;
} }
else { else {
size_t k = MIN(c_len, strlen(type->cname)); size_t k = strlen(type->cname);
if (k > c_len) k = c_len;
if (!memcmp(c, type->cname, k)) { if (!memcmp(c, type->cname, k)) {
return type; return type;
} }
@ -483,7 +486,7 @@ int get_cursedmen(const unit * u, const curse * c)
cursedmen = c->data.i; cursedmen = c->data.i;
} }
return MIN(u->number, cursedmen); return (u->number < cursedmen) ? u->number : cursedmen;
} }
/* setzt die Anzahl der betroffenen Personen auf cursedmen */ /* setzt die Anzahl der betroffenen Personen auf cursedmen */
@ -572,19 +575,19 @@ curse *create_curse(unit * magician, attrib ** ap, const curse_type * ct,
/* es gibt schon eins diese Typs */ /* es gibt schon eins diese Typs */
if (c && ct->mergeflags != NO_MERGE) { if (c && ct->mergeflags != NO_MERGE) {
if (ct->mergeflags & M_DURATION) { if (ct->mergeflags & M_DURATION) {
c->duration = MAX(c->duration, duration); if (c->duration < duration) c->duration = duration;
} }
else if (ct->mergeflags & M_SUMDURATION) { else if (ct->mergeflags & M_SUMDURATION) {
c->duration += duration; c->duration += duration;
} }
if (ct->mergeflags & M_MAXEFFECT) { if (ct->mergeflags & M_MAXEFFECT) {
c->effect = MAX(c->effect, effect); if (c->effect < effect) c->effect = effect;
} }
else if (ct->mergeflags & M_SUMEFFECT) { else if (ct->mergeflags & M_SUMEFFECT) {
c->effect += effect; c->effect += effect;
} }
if (ct->mergeflags & M_VIGOUR) { if (ct->mergeflags & M_VIGOUR) {
c->vigour = MAX(vigour, c->vigour); if (c->vigour < vigour) c->vigour = vigour;
} }
else if (ct->mergeflags & M_VIGOUR_ADD) { else if (ct->mergeflags & M_VIGOUR_ADD) {
c->vigour = vigour + c->vigour; c->vigour = vigour + c->vigour;