diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-21 18:30:39 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-21 18:30:39 +0000 |
commit | 2fffc25ea8895cbd7748b4a84565091a91490995 (patch) | |
tree | 5636e6c7a930c462adeec55f1e2029745db195d6 /src/map/chrif.c | |
parent | 30eb0d043dff54ee877e408c53d7ecd547686a22 (diff) | |
download | hercules-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/chrif.c')
-rw-r--r-- | src/map/chrif.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c index e95858df9..2396f5175 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -1415,14 +1415,14 @@ int chrif_disconnect(int fd) { }
void chrif_update_ip(int fd){
- struct hostent *h = map_server_dns?gethostbyname(map_server_dns):NULL;
+ char ip[4];
ShowInfo("IP Sync in progress...\n");
- if(h){
+ if (map_server_dns && resolve_hostbyname(map_server_dns, ip)) {
WFIFOW(fd, 0) = 0x2736;
- WFIFOB(fd, 2) = h->h_addr[0];
- WFIFOB(fd, 3) = h->h_addr[1];
- WFIFOB(fd, 4) = h->h_addr[2];
- WFIFOB(fd, 5) = h->h_addr[3];
+ WFIFOB(fd, 2) = ip[0];
+ WFIFOB(fd, 3) = ip[1];
+ WFIFOB(fd, 4) = ip[2];
+ WFIFOB(fd, 5) = ip[3];
WFIFOSET(fd, 6);
}
}
|