summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
authorpanikon <panikon@zoho.com>2014-05-07 19:41:46 -0300
committerpanikon <panikon@zoho.com>2014-05-07 19:41:46 -0300
commit095c47f5345f63da79495487ca58b7a21800fb6c (patch)
treecd3cd96f592e26782e9c627c6fb4d20a78077c35 /src/char
parentacf4079c828a56c5ba761698b425168110d3722f (diff)
downloadhercules-095c47f5345f63da79495487ca58b7a21800fb6c.tar.gz
hercules-095c47f5345f63da79495487ca58b7a21800fb6c.tar.bz2
hercules-095c47f5345f63da79495487ca58b7a21800fb6c.tar.xz
hercules-095c47f5345f63da79495487ca58b7a21800fb6c.zip
Follow up to 9a425c1
Special thanks to @MishimaHaruna
Diffstat (limited to 'src/char')
-rw-r--r--src/char/int_guild.c2
-rw-r--r--src/char/inter.c12
2 files changed, 8 insertions, 6 deletions
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index d8556f023..895cbbb94 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -1437,7 +1437,7 @@ int mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const void
switch(type) {
case GBI_EXP:
value = *((const int16 *)data);
- if( g->exp+value < 0 )
+ if( value < 0 && abs(value) > g->exp )
return 0;
g->exp += value;
guild_calcinfo(g);
diff --git a/src/char/inter.c b/src/char/inter.c
index a2ff556d9..6cb349fd3 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -453,8 +453,10 @@ const char* geoip_getcountry(uint32 ipnum){
* frees geoip.cache
**/
void geoip_final( void ) {
- if( geoip.cache )
+ if( geoip.cache ) {
aFree(geoip.cache);
+ geoip.cache = NULL;
+ }
if( geoip.active ) {
ShowStatus("GeoIP "CL_RED"disabled"CL_RESET".\n");
@@ -497,14 +499,14 @@ void geoip_init(void) {
}
// Search database type
- lseek(fno, -3l, SEEK_END);
+ fseek(db, -3l, SEEK_END);
for( i = 0; i < GEOIP_STRUCTURE_INFO_MAX_SIZE; i++ ) {
- read(fno, delim, 3);
+ fread(delim, sizeof(delim[0]), 3, db);
if( delim[0] == 255 && delim[1] == 255 && delim[2] == 255 ) {
- read(fno, &db_type, 1);
+ fread(&db_type, sizeof(db_type), 1, db);
break;
} else {
- lseek(fno, -4l, SEEK_CUR);
+ fseek(db, -4l, SEEK_CUR);
}
}