From b5bcd3c54bfe30e7602a92d4b39ee15973f3c46f Mon Sep 17 00:00:00 2001 From: ultramage Date: Wed, 20 Feb 2008 16:21:37 +0000 Subject: Changed pc_can_give_items() to use standard boolean logic instead of the inverted 1/0 one (bugreport:396) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12220 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/pc.c | 12 ++++-------- src/map/pc.h | 2 +- src/map/skill.c | 2 +- src/map/storage.c | 4 ++-- src/map/trade.c | 2 +- 5 files changed, 9 insertions(+), 13 deletions(-) (limited to 'src/map') diff --git a/src/map/pc.c b/src/map/pc.c index 97818bbf2..f76df3d0b 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -318,16 +318,12 @@ int pc_setrestartvalue(struct map_session_data *sd,int type) } /*========================================== - Determines if the GM can give / drop / trade / vend items [Lupus] + Determines if the GM can give / drop / trade / vend items Args: GM Level (current player GM level) - * Returns - 1 = this GM can't do it - 0 = this one can do it *------------------------------------------*/ -int pc_can_give_items(int level) +bool pc_can_give_items(int level) { - return ( level >= battle_config.gm_cant_drop_min_lv - && level <= battle_config.gm_cant_drop_max_lv); + return( level < battle_config.gm_cant_drop_min_lv || level > battle_config.gm_cant_drop_max_lv ); } /*========================================== @@ -5817,7 +5813,7 @@ int pc_setriding(TBL_PC* sd, int flag) int pc_candrop(struct map_session_data *sd,struct item *item) { int level = pc_isGM(sd); - if ( pc_can_give_items(level) ) //check if this GM level can drop items + if ( !pc_can_give_items(level) ) //check if this GM level can drop items return 0; return (itemdb_isdropable(item, level)); } diff --git a/src/map/pc.h b/src/map/pc.h index e9f300d9c..e3eb9afdb 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -140,7 +140,7 @@ extern int duel_count; int pc_class2idx(int class_); int pc_isGM(struct map_session_data *sd); int pc_getrefinebonus(int lv,int type); -int pc_can_give_items(int level); //[Lupus] +bool pc_can_give_items(int level); int pc_setrestartvalue(struct map_session_data *sd,int type); int pc_makesavestatus(struct map_session_data *); diff --git a/src/map/skill.c b/src/map/skill.c index b42bb13cc..706fd5bd1 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -3933,7 +3933,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case MC_VENDING: if(sd) { //Prevent vending of GMs with unnecessary Level to trade/drop. [Skotlex] - if ( pc_can_give_items(pc_isGM(sd)) ) + if ( !pc_can_give_items(pc_isGM(sd)) ) clif_skill_fail(sd,skillid,0,0); else clif_openvendingreq(sd,2+skilllv); diff --git a/src/map/storage.c b/src/map/storage.c index e4ff030b3..50024fbbe 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -138,7 +138,7 @@ int storage_storageopen(struct map_session_data *sd) if(sd->state.storage_flag) return 1; //Already open? - if(pc_can_give_items(pc_isGM(sd))) + if( !pc_can_give_items(pc_isGM(sd)) ) { //check is this GM level is allowed to put items to storage clif_displaymessage(sd->fd, msg_txt(246)); return 1; @@ -508,7 +508,7 @@ int storage_guild_storageopen(struct map_session_data *sd) if(sd->state.storage_flag) return 1; //Can't open both storages at a time. - if( pc_can_give_items(pc_isGM(sd)) ) { //check is this GM level can open guild storage and store items [Lupus] + if( !pc_can_give_items(pc_isGM(sd)) ) { //check is this GM level can open guild storage and store items [Lupus] clif_displaymessage(sd->fd, msg_txt(246)); return 1; } diff --git a/src/map/trade.c b/src/map/trade.c index fa092c49c..5c063621d 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -61,7 +61,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta } level = pc_isGM(sd); - if ( pc_can_give_items(level) || pc_can_give_items(pc_isGM(target_sd)) ) //check if both GMs are allowed to trade + if ( !pc_can_give_items(level) || !pc_can_give_items(pc_isGM(target_sd)) ) //check if both GMs are allowed to trade { clif_displaymessage(sd->fd, msg_txt(246)); clif_tradestart(sd, 2); // GM is not allowed to trade -- cgit v1.2.3-70-g09d2