summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-05 14:11:12 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-05 14:11:12 +0000
commitc4da477460bb8efa6ff288d999692c17833dd5f3 (patch)
treee4ac77179044d3a9dacf43183706b7ef7ade75b3 /src/map/atcommand.c
parent2997372e752799d305566c3b5edfc0a40460ac42 (diff)
downloadhercules-c4da477460bb8efa6ff288d999692c17833dd5f3.tar.gz
hercules-c4da477460bb8efa6ff288d999692c17833dd5f3.tar.bz2
hercules-c4da477460bb8efa6ff288d999692c17833dd5f3.tar.xz
hercules-c4da477460bb8efa6ff288d999692c17833dd5f3.zip
- Updated @refine to take account of MAX_REFINE, thanks to Omega... GM Designer.
- Also optimized the @refine loop for better performance. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7537 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 9b8eda327..b3b7f42c6 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -3753,7 +3753,7 @@ int atcommand_refine(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
- int i, position = 0, refine = 0, current_position, final_refine;
+ int i,j, position = 0, refine = 0, current_position, final_refine;
int count;
nullpo_retr(-1, sd);
@@ -3764,34 +3764,34 @@ int atcommand_refine(
return -1;
}
- if (refine < -10)
- refine = -10;
- else if (refine > 10)
- refine = 10;
+ if (refine < -MAX_REFINE)
+ refine = -MAX_REFINE;
+ else if (refine > MAX_REFINE)
+ refine = MAX_REFINE;
else if (refine == 0)
refine = 1;
count = 0;
- for (i = 0; i < MAX_INVENTORY; i++) {
- if (sd->status.inventory[i].nameid && // 該当個所の装備を精錬する
- (sd->status.inventory[i].equip & position ||
- (sd->status.inventory[i].equip && !position))) {
- final_refine = sd->status.inventory[i].refine + refine;
- if (final_refine > 10)
- final_refine = 10;
- else if (final_refine < 0)
- final_refine = 0;
- if (sd->status.inventory[i].refine != final_refine) {
- sd->status.inventory[i].refine = final_refine;
- current_position = sd->status.inventory[i].equip;
- pc_unequipitem(sd, i, 3);
- clif_refine(fd, sd, 0, i, sd->status.inventory[i].refine);
- clif_delitem(sd, i, 1);
- clif_additem(sd, i, 1, 0);
- pc_equipitem(sd, i, current_position);
- clif_misceffect((struct block_list*)&sd->bl, 3);
- count++;
- }
+ for (j = 0; j < 10; j++) {
+ if ((i = sd->equip_index[j]) < 0)
+ continue;
+ if(position && !(sd->status.inventory[i].equip & position))
+ continue;
+ final_refine = sd->status.inventory[i].refine + refine;
+ if (final_refine > MAX_REFINE)
+ final_refine = MAX_REFINE;
+ else if (final_refine < 0)
+ final_refine = 0;
+ if (sd->status.inventory[i].refine != final_refine) {
+ sd->status.inventory[i].refine = final_refine;
+ current_position = sd->status.inventory[i].equip;
+ pc_unequipitem(sd, i, 3);
+ clif_refine(fd, sd, 0, i, sd->status.inventory[i].refine);
+ clif_delitem(sd, i, 1);
+ clif_additem(sd, i, 1, 0);
+ pc_equipitem(sd, i, current_position);
+ clif_misceffect(&sd->bl, 3);
+ count++;
}
}