Pārlūkot izejas kodu

Changed pc_can_give_items() to use standard boolean logic instead of the inverted 1/0 one (bugreport:396)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12220 54d463be-8e91-2dee-dedb-b68131a5f0ec
ultramage 17 gadi atpakaļ
vecāks
revīzija
76c27942f6
5 mainītis faili ar 9 papildinājumiem un 13 dzēšanām
  1. 4 8
      src/map/pc.c
  2. 1 1
      src/map/pc.h
  3. 1 1
      src/map/skill.c
  4. 2 2
      src/map/storage.c
  5. 1 1
      src/map/trade.c

+ 4 - 8
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));
 }

+ 1 - 1
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 *);

+ 1 - 1
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);

+ 2 - 2
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;
 	}

+ 1 - 1
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