summaryrefslogtreecommitdiff
path: root/src/map/status.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-05-01 12:14:06 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-05-01 12:14:06 +0000
commit5524938f8650e659b3c838df44212de56bf72584 (patch)
tree9696c2ef858b4ebd81eda804389f8ece788a994b /src/map/status.c
parent3bba210cc5151bfc2971be296ab5c4391ea28639 (diff)
downloadhercules-5524938f8650e659b3c838df44212de56bf72584.tar.gz
hercules-5524938f8650e659b3c838df44212de56bf72584.tar.bz2
hercules-5524938f8650e659b3c838df44212de56bf72584.tar.xz
hercules-5524938f8650e659b3c838df44212de56bf72584.zip
Implemented get_percentage() for compact and safe calculation of percentual values.
Fixed integer arithmetic overflows that were occuring in several supernovice checks (bugreport:1135). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12679 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/status.c')
-rw-r--r--src/map/status.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/src/map/status.c b/src/map/status.c
index 70c1074d6..6f170bb96 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -929,16 +929,6 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per
return 1;
}
-//calculates the base/max ratio as a value between 0->100 (percent), using
-//different approaches to avoid overflows.
-//NOTE: The -1 case (0 max hp) should never trigger!
-char status_calc_life(unsigned int base, unsigned int max)
-{
- if (!max) return -1;
- if (max < 10000) return 100*base/max;
- return base/(max/100);
-}
-
/*==========================================
* Checks whether the src can use the skill on the target,
* taking into account status/option of both source/target. [Skotlex]