summaryrefslogtreecommitdiff
path: root/src/map/status.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-21 18:30:39 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-21 18:30:39 +0000
commit2fffc25ea8895cbd7748b4a84565091a91490995 (patch)
tree5636e6c7a930c462adeec55f1e2029745db195d6 /src/map/status.c
parent30eb0d043dff54ee877e408c53d7ecd547686a22 (diff)
downloadhercules-2fffc25ea8895cbd7748b4a84565091a91490995.tar.gz
hercules-2fffc25ea8895cbd7748b4a84565091a91490995.tar.bz2
hercules-2fffc25ea8895cbd7748b4a84565091a91490995.tar.xz
hercules-2fffc25ea8895cbd7748b4a84565091a91490995.zip
- Added function parse_hostbyname() which takes a hostname and a char[4]. The hostname is resolved to an ip, whose individual components are stored in char[], the return value of the function is the inet_addr result of the lookup (or returns 0 when failed). Meant to be used in the rest of the code without the need to do socket/network related includes.
- Applied use of parse_hostbyname() in chrif.c to fix compilation errors. - status_percent_change will now account for when the target's max hp/sp is above INT_MAX. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7281 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/status.c')
-rw-r--r--src/map/status.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/map/status.c b/src/map/status.c
index 8fe79f999..98a6ad652 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -767,6 +767,22 @@ int status_percent_change(struct block_list *src,struct block_list *target,signe
if (sp_rate && !sp)
sp = 1;
+ //Ugly check in case damage dealt is too much for the received args of
+ //status_heal / status_damage. [Skotlex]
+ if (hp > INT_MAX) {
+ hp -= INT_MAX;
+ if (flag)
+ status_heal(target, INT_MAX, 0, 0);
+ else
+ status_damage(src, target, INT_MAX, 0, 0, (!src||src==target?5:1));
+ }
+ if (sp > INT_MAX) {
+ sp -= INT_MAX;
+ if (flag)
+ status_heal(target, 0, INT_MAX, 0);
+ else
+ status_damage(src, target, 0, INT_MAX, 0, (!src||src==target?5:1));
+ }
if (flag) return status_heal(target, hp, sp, 0);
return status_damage(src, target, hp, sp, 0, (!src||src==target?5:1));
}