Browse Source

Corrected some MAX_SEARCH results (fixes #1345)
* The count was already being capped by itemdb_searchname_array() so the check was never hit.
* Adjusted the return message to match the corrected result.

aleos89 9 years ago
parent
commit
604e805c03

+ 1 - 1
conf/msg_conf/map_msg.conf

@@ -279,7 +279,7 @@
 266: Some of your items cannot be vended and were removed from the shop.
 267: '%s' designated maps reset.
 268: Reloaded the Message of the Day.
-269: Displaying first %d out of %d matches
+269: Displaying first %d matches
 //@me output format
 270: * :%s %s: *
 271: You can't drop items on this map.

+ 1 - 1
conf/msg_conf/map_msg_chn.conf

@@ -283,7 +283,7 @@
 266: 你的某些物品不能被出售,它將從你的商店中被取消掉
 267: '%s' 該地圖被重置
 268: 重新載入今天的訊息
-269: 顯示 %d 分之 %d 關聯
+269: 顯示 %d 關聯
 //@me output format
 270: * :%s %s: *
 271: 在這張地圖你無法丟棄物品

+ 1 - 1
conf/msg_conf/map_msg_frn.conf

@@ -283,7 +283,7 @@
 266: Certains de vos objets ne peuvent pas être vendus et ont été supprimés du magasin.
 267: Carte '%s' réinitialisée.
 268: Re-lancement du message du jour.
-269: Affichage des premiers %d parmis %d trouvés
+269: Affichage des %d premiers résultats trouvés
 //@me output format
 270: * :%s %s: *
 271: Vous ne pouvez pas déposer d'objets sur cette carte.

+ 1 - 1
conf/msg_conf/map_msg_grm.conf

@@ -282,7 +282,7 @@
 266: Manche Items können nicht verkauft werden und werden aus dem Shop entfernt.
 267: '%s' bezeichnetete Maps resettet.
 268: Läd die Nachrichten vom Tag neu.
-269: Zeigt erst %d von %d treffern
+269: Zeigt erst %d treffern
 //@me output format
 270: * :%s %s: *
 271: Du kannst auf dieser Map keine Items droppen.

+ 1 - 1
conf/msg_conf/map_msg_idn.conf

@@ -279,7 +279,7 @@
 266: Beberapa item tidak dapat ditransaksikan dan telah dikeluarkan dari toko.
 267: '%s' map yang dipilih sudah diatur ulang.
 268: 'Pesan Hari Ini' sudah dimuat ulang.
-269: Menampilkan hasil %d dari %d
+269: Menampilkan hasil %d
 //@me format keluaran
 270: * :%s %s: *
 271: Kamu tidak bisa membuang item di map ini.

+ 1 - 1
conf/msg_conf/map_msg_por.conf

@@ -288,7 +288,7 @@
 266: Alguns de seus itens não podem ser vendidos e foram removidos de sua venda.
 267: '%s' mapas designados redefinidos.
 268: Recarregada Mensagem do Dia.
-269: Exibindo o primeiro %d de %d resultados
+269: Exibindo o primeiro %d resultados
 //Formato de saída do @me
 270: * :%s %s: *
 271: Você não pode derrubar itens neste mapa

+ 1 - 1
conf/msg_conf/map_msg_rus.conf

@@ -281,7 +281,7 @@
 266: Некоторые из ваших товаров не могут быть проданы, поэтому они удалены из магазина.
 267: '%s' обозначеных карт сброшено.
 268: Сообщение дня перезагружено.
-269: Показаны первые %d из %d результатов
+269: Показаны первые %d результатов
 // Сообщение команды @me
 270: * :%s %s: *
 271: Вы не можете выбрасывать предметы на этой локации.

+ 1 - 1
conf/msg_conf/map_msg_spn.conf

@@ -283,7 +283,7 @@
 266: Algunos de tus objetos se han retirado de la tienda porque no pueden venderse.
 267: Se han reiniciado los mapas designados a '%s'.
 268: Has actualizado el mensaje del día.
-269: Se muestran %d de un total de %d resultados.
+269: Se muestran %d resultados
 //Formato de @me
 270: * :%s %s: *
 271: No puedes tirar objetos al suelo en este mapa.

+ 1 - 1
conf/msg_conf/map_msg_tha.conf

@@ -283,7 +283,7 @@
 266: ÁÕºÒ§ Item ¢Í§¤Ø³äÁèÊÒÁÒö¹ÓÁÒµÑé§ÃéÒ¹¢Ò¢ͧä´é ¡ÃسҹÓÍÍ¡¨Ò¡ÃÒ¡ÒõÑé§ÃéÒ¹.
 267: '%s' designated maps reset.
 268: ¢éͤÇÒÁ»ÃШÓÇѹ ä´é¶Ù¡âËÅ´ãËÁèàÃÕºÃéÍÂáÅéÇ.
-269: áÊ´§¼Å¡Òäé¹ËÒ %d Íѹ´Ñºáá¨Ò¡·Ñé§ËÁ´ %d ·Õ辺
+269: áÊ´§¼Å¡Òäé¹ËÒ %d ·Õ辺
 //@me output format
 270: * :%s %s: *
 271: ¤Ø³äÁèÊÒÁÒöâ¹ item ŧ¾×é¹ã¹á¼¹·Õè¹Õéä´é.

+ 10 - 15
src/map/atcommand.c

@@ -3569,10 +3569,9 @@ ACMD_FUNC(idsearch)
 	sprintf(atcmd_output, msg_txt(sd,77), item_name); // The reference result of '%s' (name: id):
 	clif_displaymessage(fd, atcmd_output);
 	match = itemdb_searchname_array(item_array, MAX_SEARCH, item_name);
-	if (match > MAX_SEARCH) {
-		sprintf(atcmd_output, msg_txt(sd,269), MAX_SEARCH, match);
+	if (match == MAX_SEARCH) {
+		sprintf(atcmd_output, msg_txt(sd,269), MAX_SEARCH); // Displaying first %d matches
 		clif_displaymessage(fd, atcmd_output);
-		match = MAX_SEARCH;
 	}
 	for(i = 0; i < match; i++) {
 		sprintf(atcmd_output, msg_txt(sd,78), item_array[i]->jname, item_array[i]->nameid); // %s: %d
@@ -7071,10 +7070,9 @@ ACMD_FUNC(mobinfo)
 		return -1;
 	}
 
-	if (count > MAX_SEARCH) {
-		sprintf(atcmd_output, msg_txt(sd,269), MAX_SEARCH, count);
+	if (count == MAX_SEARCH) {
+		sprintf(atcmd_output, msg_txt(sd,269), MAX_SEARCH); // Displaying first %d matches
 		clif_displaymessage(fd, atcmd_output);
-		count = MAX_SEARCH;
 	}
 	for (k = 0; k < count; k++) {
 		unsigned int j,base_exp,job_exp;
@@ -7594,10 +7592,9 @@ ACMD_FUNC(iteminfo)
 		return -1;
 	}
 
-	if (count > MAX_SEARCH) {
-		sprintf(atcmd_output, msg_txt(sd,269), MAX_SEARCH, count); // Displaying first %d out of %d matches
+	if (count == MAX_SEARCH) {
+		sprintf(atcmd_output, msg_txt(sd,269), MAX_SEARCH); // Displaying first %d matches
 		clif_displaymessage(fd, atcmd_output);
-		count = MAX_SEARCH;
 	}
 	for (i = 0; i < count; i++) {
 		struct item_data * item_data = item_array[i];
@@ -7646,10 +7643,9 @@ ACMD_FUNC(whodrops)
 		return -1;
 	}
 
-	if (count > MAX_SEARCH) {
-		sprintf(atcmd_output, msg_txt(sd,269), MAX_SEARCH, count); // Displaying first %d out of %d matches
+	if (count == MAX_SEARCH) {
+		sprintf(atcmd_output, msg_txt(sd,269), MAX_SEARCH); // Displaying first %d matches
 		clif_displaymessage(fd, atcmd_output);
-		count = MAX_SEARCH;
 	}
 	for (i = 0; i < count; i++) {
 		item_data = item_array[i];
@@ -7708,10 +7704,9 @@ ACMD_FUNC(whereis)
 		return -1;
 	}
 
-	if (count > MAX_SEARCH) {
-		sprintf(atcmd_output, msg_txt(sd,269), MAX_SEARCH, count);
+	if (count == MAX_SEARCH) {
+		sprintf(atcmd_output, msg_txt(sd,269), MAX_SEARCH); // Displaying first %d matches
 		clif_displaymessage(fd, atcmd_output);
-		count = MAX_SEARCH;
 	}
 	for (k = 0; k < count; k++) {
 		struct mob_db *mob = mob_array[k];

+ 1 - 3
src/map/script.c

@@ -16581,10 +16581,8 @@ BUILDIN_FUNC(searchitem)
 
 	if ((items[0] = itemdb_exists(atoi(itemname))))
 		count = 1;
-	else {
+	else
 		count = itemdb_searchname_array(items, ARRAYLENGTH(items), itemname);
-		if (count > MAX_SEARCH) count = MAX_SEARCH;
-	}
 
 	if (!count) {
 		script_pushint(st, 0);