summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-06-28 22:08:54 +0300
committerAndrei Karas <akaras@inbox.ru>2016-06-30 02:32:10 +0300
commit7c21376f8dea2b438cb9470f74acc157a1929f06 (patch)
tree396829d37d642103dbd98e39b00bed7b8e875461 /src/map/script.c
parent48064104f599a2dfa57440a1fda861c27bd55401 (diff)
downloadhercules-7c21376f8dea2b438cb9470f74acc157a1929f06.tar.gz
hercules-7c21376f8dea2b438cb9470f74acc157a1929f06.tar.bz2
hercules-7c21376f8dea2b438cb9470f74acc157a1929f06.tar.xz
hercules-7c21376f8dea2b438cb9470f74acc157a1929f06.zip
Use item attribute as flags varible. Now only ATTR_BROKEN flag exists.
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 64966f987..12f7dd43c 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -8604,7 +8604,7 @@ BUILDIN(getbrokenid)
num=script_getnum(st,2);
for(i=0; i<MAX_INVENTORY; i++) {
- if(sd->status.inventory[i].attribute) {
+ if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) {
brokencounter++;
if(num==brokencounter) {
id=sd->status.inventory[i].nameid;
@@ -8629,7 +8629,7 @@ BUILDIN(getbrokencount)
return true;
for (i = 0; i < MAX_INVENTORY; i++) {
- if (sd->status.inventory[i].attribute)
+ if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0)
counter++;
}
@@ -8651,10 +8651,11 @@ BUILDIN(repair)
num=script_getnum(st,2);
for(i=0; i<MAX_INVENTORY; i++) {
- if(sd->status.inventory[i].attribute) {
+ if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) {
repaircounter++;
if(num==repaircounter) {
- sd->status.inventory[i].attribute=0;
+ sd->status.inventory[i].attribute |= ATTR_BROKEN;
+ sd->status.inventory[i].attribute ^= ATTR_BROKEN;
clif->equiplist(sd);
clif->produce_effect(sd, 0, sd->status.inventory[i].nameid);
clif->misceffect(&sd->bl, 3);
@@ -8678,9 +8679,10 @@ BUILDIN(repairall)
for(i = 0; i < MAX_INVENTORY; i++)
{
- if(sd->status.inventory[i].nameid && sd->status.inventory[i].attribute)
+ if (sd->status.inventory[i].nameid && (sd->status.inventory[i].attribute & ATTR_BROKEN) != 0)
{
- sd->status.inventory[i].attribute = 0;
+ sd->status.inventory[i].attribute |= ATTR_BROKEN;
+ sd->status.inventory[i].attribute ^= ATTR_BROKEN;
clif->produce_effect(sd,0,sd->status.inventory[i].nameid);
repaircounter++;
}