From cb2452c0149e4a4d1f9fa08bf1aafd146f3ca2de Mon Sep 17 00:00:00 2001 From: ultramage Date: Sat, 7 Apr 2007 21:15:34 +0000 Subject: - Fixed the platform-specific stricmp compilation problem - Fixed inverted vending tax equation (venders getting only 2% zeny instead of 98%), and made it more precise git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10182 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 2 ++ src/common/cbasetypes.h | 6 ++++++ src/common/mmo.h | 19 ------------------- src/map/clif.c | 6 +++--- src/map/vending.c | 2 +- src/tool/mapcache.c | 6 +++--- 6 files changed, 15 insertions(+), 26 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 329a56020..e080546c1 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -5,6 +5,8 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2007/04/08 + * Fixed the platform-specific stricmp compilation problem + * Fixed inverted vending tax equation (!) and made it more precise * Moved e_mail_check() and config_switch() to strlib.h * Synchronized the login servers a bit 2007/04/07 diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h index b513b7fa3..6db351b67 100644 --- a/src/common/cbasetypes.h +++ b/src/common/cbasetypes.h @@ -198,8 +198,14 @@ typedef unsigned long long uint64; #if defined(_MSC_VER) || defined(__BORLANDC__) #define strcasecmp stricmp #define strncasecmp strnicmp +#define strncmpi strnicmp #define snprintf _snprintf #define vsnprintf _vsnprintf +#else +#define strcmpi strcasecmp +#define stricmp strcasecmp +#define strncmpi strncasecmp +#define strnicmp strncasecmp #endif // keyword replacement in windows diff --git a/src/common/mmo.h b/src/common/mmo.h index 75b741697..bd5a067d9 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -489,23 +489,4 @@ enum { JOB_SOUL_LINKER, }; -#ifndef __WIN32 - #ifndef strcmpi - #define strcmpi strcasecmp - #endif - #ifndef stricmp - #define stricmp strcasecmp - #endif - #ifndef strncmpi - #define strncmpi strncasecmp - #endif - #ifndef strnicmp - #define strnicmp strncasecmp - #endif -#else - #ifndef strncmpi - #define strncmpi strnicmp - #endif -#endif - #endif /* _MMO_H_ */ diff --git a/src/map/clif.c b/src/map/clif.c index 36ae1d658..92361d4e9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5593,9 +5593,9 @@ int clif_openvending(struct map_session_data *sd,int id,struct vending *vending) nullpo_retr(0, sd); fd=sd->fd; - WFIFOHEAD(fd, 8+sd->vend_num*22); + WFIFOHEAD(fd, 8+sd->vend_num*22); buf = WFIFOP(fd,0); - for(i=0,n=0;ivend_num;i++){ + for(i = 0, n = 0; i < sd->vend_num; i++) { if (sd->vend_num > 2+pc_checkskill(sd,MC_VENDING)) return 0; WBUFL(buf,8+n*22)=vending[i].value; WBUFW(buf,12+n*22)=(index=vending[i].index)+2; @@ -5615,7 +5615,7 @@ int clif_openvending(struct map_session_data *sd,int id,struct vending *vending) clif_addcards(WBUFP(buf, 22+n*22), &sd->status.cart[index]); n++; } - if(n > 0){ + if(n > 0) { WBUFW(buf,0)=0x136; WBUFW(buf,2)=8+n*22; WBUFL(buf,4)=id; diff --git a/src/map/vending.c b/src/map/vending.c index 44f1a0f11..23a7d9ce8 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -159,7 +159,7 @@ void vending_purchasereq(struct map_session_data *sd,int len,int id,unsigned cha pc_payzeny(sd, (int)z); if (battle_config.vending_tax) - z = z*battle_config.vending_tax/10000; + z = z*(1 - battle_config.vending_tax/10000); pc_getzeny(vsd, (int)z); for(i = 0; 8 + 4 * i < len; i++) { diff --git a/src/tool/mapcache.c b/src/tool/mapcache.c index a1b537a56..d8f37d2b9 100644 --- a/src/tool/mapcache.c +++ b/src/tool/mapcache.c @@ -218,9 +218,9 @@ char *remove_extension(char *mapname) if (ptr) { //Check and remove extension. while (ptr[1] && (ptr2 = strchr(ptr+1, '.'))) ptr = ptr2; //Skip to the last dot. - if(strcmp(ptr,".gat") == 0 || - strcmp(ptr,".afm") == 0 || - strcmp(ptr,".af2") == 0) + if(stricmp(ptr,".gat") == 0 || + stricmp(ptr,".afm") == 0 || + stricmp(ptr,".af2") == 0) *ptr = '\0'; //Remove extension. } return mapname; -- cgit v1.2.3-60-g2f50