Browse Source

Fixed cashshop removal issue

Fixes #1971
Thanks to @RadianFord
Lemongrass3110 8 years ago
parent
commit
03ffd99c4d
1 changed files with 7 additions and 9 deletions
  1. 7 9
      src/map/cashshop.c

+ 7 - 9
src/map/cashshop.c

@@ -316,7 +316,9 @@ bool sale_remove_item( uint16 nameid ){
 	int i;
 
 	// Check if there is an entry for this item id
-	if( !sale_find_item(nameid, false) ){
+	sale_item = sale_find_item(nameid, false);
+
+	if( sale_item == NULL ){
 		return false;
 	}
 
@@ -326,22 +328,18 @@ bool sale_remove_item( uint16 nameid ){
 		return false;
 	}
 
-	// Check if the sale is currently running
-	sale_item = sale_find_item(nameid, true);
-
-	if( sale_item != NULL && sale_item->timer_end != INVALID_TIMER ){
-		// Notify all clients that the sale has ended
-		clif_sale_end(sale_item, NULL, ALL_CLIENT);
-	}
-
 	if( sale_item->timer_start != INVALID_TIMER ){
 		delete_timer(sale_item->timer_start, sale_start_timer);
 		sale_item->timer_start = INVALID_TIMER;
 	}
 
+	// Check if the sale is currently running
 	if( sale_item->timer_end != INVALID_TIMER ){
 		delete_timer(sale_item->timer_end, sale_end_timer);
 		sale_item->timer_end = INVALID_TIMER;
+
+		// Notify all clients that the sale has ended
+		clif_sale_end(sale_item, NULL, ALL_CLIENT);
 	}
 
 	// Find the original pointer in the array