diff options
author | Haru <haru@dotalux.com> | 2013-12-10 19:48:55 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-12-17 01:11:33 +0100 |
commit | 15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48 (patch) | |
tree | c5dd5b25003f8c21381c7a2e1f010dba71e40b90 /src/map/status.h | |
parent | a23d072a66d2569ba13921522be3c82ae9aad576 (diff) | |
download | hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.tar.gz hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.tar.bz2 hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.tar.xz hercules-15a0f6dea6f4f3c5adc9a1bc9e7e8be81cc49c48.zip |
Fixed several compiler warnings
- Warnings detected thanks to Xcode's compiler settings (more strict by
default) and clang, warnings mostly but not only related to data sizes
on 64 bit systems, that were silenced until now by very lax compiler
settings.
- This also decreases by a great deal the amount of warnings produced by
MSVC in x64 mode (for the adventurous ones who tried that)
- Also fixed (or silenced in case of false positives) the potential
issues pointed out by the (awesome) clang static analyzer.
- Patch co-produced with Ind, I'm merging and committing in his place!
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/status.h')
-rw-r--r-- | src/map/status.h | 15 |
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 |