Преглед изворни кода

Fixed warning about favorite item (#8290)

Atemo пре 1 година
родитељ
комит
2ebdd50e08
3 измењених фајлова са 11 додато и 11 уклоњено
  1. 6 6
      src/map/clif.cpp
  2. 3 3
      src/map/npc.cpp
  3. 2 2
      src/map/pc.cpp

+ 6 - 6
src/map/clif.cpp

@@ -2810,7 +2810,7 @@ void clif_additem( map_session_data *sd, int n, int amount, unsigned char fail )
 #if PACKETVER >= 20150226
 		clif_add_random_options( p.option_data, sd->inventory.u.items_inventory[n] );
 #if PACKETVER >= 20160921
-		p.favorite = sd->inventory.u.items_inventory[n].favorite;
+		p.favorite = ( sd->inventory.u.items_inventory[n].favorite != 0 ) ? 1 : 0;
 		p.look = sd->inventory_data[n]->look;
 #if PACKETVER_MAIN_NUM >= 20200916 || PACKETVER_RE_NUM >= 20200724
 		p.grade = sd->inventory.u.items_inventory[n].enchantgrade;
@@ -2961,7 +2961,7 @@ static void clif_item_normal( short idx, struct NORMALITEM_INFO *p, struct item
 
 #if PACKETVER >= 20120925
 	p->Flag.IsIdentified = i->identify ? 1 : 0;
-	p->Flag.PlaceETCTab  = i->favorite ? 1 : 0;
+	p->Flag.PlaceETCTab  = ( i->favorite != 0 ) ? 1 : 0;
 	p->Flag.SpareBits    = 0;
 #endif
 }
@@ -3091,7 +3091,7 @@ void clif_inventorylist( map_session_data *sd ){
 		if( sd->inventory.u.items_inventory[i].nameid == 0 || sd->inventory_data[i] == NULL )
 			continue;
 
-		if ( sd->inventory.u.items_inventory[i].favorite )
+		if ( sd->inventory.u.items_inventory[i].favorite != 0 )
 			clif_favorite_item( *sd, i );
 	}
 #endif
@@ -15832,7 +15832,7 @@ void clif_Mail_setattachment( map_session_data* sd, int index, int amount, uint8
 
 			p.weight += sd->mail.item[i].amount * ( sd->inventory_data[sd->mail.item[i].index]->weight / 10 );
 		}
-		p.favorite = item->favorite;
+		p.favorite = ( item->favorite != 0 ) ? 1 : 0;
 		p.location = pc_equippoint( sd, server_index( index ) );
 #if PACKETVER_MAIN_NUM >= 20200916 || PACKETVER_RE_NUM >= 20200724
 		p.grade = item->enchantgrade;
@@ -19808,7 +19808,7 @@ void clif_parse_MoveItem( int fd, map_session_data* sd ){
 		return;
 	}
 
-	if ( sd->inventory.u.items_inventory[index].favorite && p->favorite == true )
+	if ( sd->inventory.u.items_inventory[index].favorite != 0 && p->favorite == true )
 		sd->inventory.u.items_inventory[index].favorite = 0;
 	else if( p->favorite == false )
 		sd->inventory.u.items_inventory[index].favorite = 1;
@@ -19829,7 +19829,7 @@ static void clif_favorite_item( map_session_data& sd, uint16 index ){
 
 	p.packetType = HEADER_ZC_INVENTORY_TAB;
 	p.index = client_index( index );
-	p.favorite = ( sd.inventory.u.items_inventory[index].favorite == true ) ? false : true;
+	p.favorite = ( sd.inventory.u.items_inventory[index].favorite == 1 ) ? false : true;
 
 	clif_send( &p, sizeof( p ), &sd.bl, SELF );
 #endif

+ 3 - 3
src/map/npc.cpp

@@ -3161,7 +3161,7 @@ e_purchase_result npc_barter_purchase( map_session_data& sd, std::shared_ptr<s_n
 						}
 
 						// Server is configured to hide favorite items on selling
-						if( battle_config.hide_fav_sell && sd.inventory.u.items_inventory[j].favorite ){
+						if( battle_config.hide_fav_sell && sd.inventory.u.items_inventory[j].favorite != 0 ){
 							continue;
 						}
 
@@ -3205,7 +3205,7 @@ e_purchase_result npc_barter_purchase( map_session_data& sd, std::shared_ptr<s_n
 							}
 
 							// Server is configured to hide favorite items on selling
-							if( battle_config.hide_fav_sell && sd.inventory.u.items_inventory[j].favorite ){
+							if( battle_config.hide_fav_sell && sd.inventory.u.items_inventory[j].favorite != 0 ){
 								continue;
 							}
 
@@ -3250,7 +3250,7 @@ e_purchase_result npc_barter_purchase( map_session_data& sd, std::shared_ptr<s_n
 										}
 
 										// Server is configured to hide favorite items on selling
-										if( battle_config.hide_fav_sell && sd.inventory.u.items_inventory[j].favorite ){
+										if( battle_config.hide_fav_sell && sd.inventory.u.items_inventory[j].favorite != 0 ){
 											continue;
 										}
 

+ 2 - 2
src/map/pc.cpp

@@ -1207,7 +1207,7 @@ bool pc_can_sell_item(map_session_data *sd, struct item *item, enum npc_subtype
 	if (item->equip > 0 || item->amount < 0)
 		return false;
 
-	if (battle_config.hide_fav_sell && item->favorite)
+	if (battle_config.hide_fav_sell && item->favorite != 0)
 		return false; //Cannot sell favs (optional config)
 
 	if (!battle_config.rental_transaction && item->expire_time)
@@ -5934,7 +5934,7 @@ enum e_additem_result pc_additem(map_session_data *sd,struct item *item,int amou
 		// clear equip and favorite fields first, just in case
 		if( item->equip )
 			sd->inventory.u.items_inventory[i].equip = 0;
-		if( item->favorite )
+		if( item->favorite != 0 )
 			sd->inventory.u.items_inventory[i].favorite = 0;
 		if( item->equipSwitch )
 			sd->inventory.u.items_inventory[i].equipSwitch = 0;