summaryrefslogtreecommitdiff
path: root/src/map/status.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/status.h')
-rw-r--r--src/map/status.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/map/status.h b/src/map/status.h
index 2a281aef4..cdf3e03d6 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -14,6 +14,21 @@ struct homun_data;
struct mercenary_data;
struct status_change;
+//Change the equation when the values are high enough to discard the
+//imprecision in exchange of overflow protection [Skotlex]
+//Also add 100% checks since those are the most used cases where we don't
+//want aproximation errors.
+#define APPLY_RATE(value, rate) ( \
+ (rate) == 100 ? \
+ (value) \
+ : ( \
+ (value) > 100000 ? \
+ (rate) * ( (value) / 100 ) \
+ : \
+ (value) * (rate) / 100 \
+ ) \
+)
+
/**
* Max Refine available to your server
* Changing this limit requires edits to refine_db.txt