summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/map/script.c42
2 files changed, 22 insertions, 21 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 89064891a..106abfd04 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,6 +1,7 @@
Date Added
2010/12/21
+ * Replaced in-place generation of uid of script array elements with reference_uid macro (follow up to r10813). [Ai4rei]
* Fixed dynamic shop arrays @bought_nameid, @bought_quantity, @sold_nameid and @sold_quantity not getting reset to zero before use, thus providing attached script with wrong/old data, if it did not clear them by itself in previous call (bugreport:1574, since r5841). [Ai4rei]
* Removed 'strsignal' forward-declaration from 'sig' plugin to prevent random gcc distributions from failing to compile due to mismatched declaration already present in <string.h> (bugreport:4644, topic:262284, follow up to r14591). [Ai4rei]
- Removed WIN32 conditions in non-WIN32 code in 'sig' plugin (follow up to r4380).
diff --git a/src/map/script.c b/src/map/script.c
index 73be737cc..6d0f8d81a 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -6134,13 +6134,13 @@ BUILDIN_FUNC(getpartymember)
if(p->party.member[i].account_id){
switch (type) {
case 2:
- mapreg_setreg(add_str("$@partymemberaid")+(j<<24),p->party.member[i].account_id);
+ mapreg_setreg(reference_uid(add_str("$@partymemberaid"), j),p->party.member[i].account_id);
break;
case 1:
- mapreg_setreg(add_str("$@partymembercid")+(j<<24),p->party.member[i].char_id);
+ mapreg_setreg(reference_uid(add_str("$@partymembercid"), j),p->party.member[i].char_id);
break;
default:
- mapreg_setregstr(add_str("$@partymembername$")+(j<<24),p->party.member[i].name);
+ mapreg_setregstr(reference_uid(add_str("$@partymembername$"), j),p->party.member[i].name);
}
j++;
}
@@ -7706,8 +7706,8 @@ BUILDIN_FUNC(getmobdrops)
if( itemdb_exists(mob->dropitem[i].nameid) == NULL )
continue;
- mapreg_setreg(add_str("$@MobDrop_item") + (j<<24), mob->dropitem[i].nameid);
- mapreg_setreg(add_str("$@MobDrop_rate") + (j<<24), mob->dropitem[i].p);
+ mapreg_setreg(reference_uid(add_str("$@MobDrop_item"), j), mob->dropitem[i].nameid);
+ mapreg_setreg(reference_uid(add_str("$@MobDrop_rate"), j), mob->dropitem[i].p);
j++;
}
@@ -9240,11 +9240,11 @@ BUILDIN_FUNC(warpwaitingpc)
if( sd == NULL )
{
ShowDebug("script:warpwaitingpc: no user in chat room position 0 (cd->users=%d,%d/%d)\n", cd->users, i, n);
- mapreg_setreg(add_str("$@warpwaitingpc")+(i<<24), 0);
+ mapreg_setreg(reference_uid(add_str("$@warpwaitingpc"), i), 0);
continue;// Broken npc chat room?
}
- mapreg_setreg(add_str("$@warpwaitingpc")+(i<<24), sd->bl.id);
+ mapreg_setreg(reference_uid(add_str("$@warpwaitingpc"), i), sd->bl.id);
if( strcmp(map_name,"Random") == 0 )
pc_randomwarp(sd,CLR_TELEPORT);
@@ -10740,18 +10740,18 @@ BUILDIN_FUNC(getinventorylist)
if(!sd) return 0;
for(i=0;i<MAX_INVENTORY;i++){
if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].amount > 0){
- pc_setreg(sd,add_str("@inventorylist_id")+(j<<24),sd->status.inventory[i].nameid);
- pc_setreg(sd,add_str("@inventorylist_amount")+(j<<24),sd->status.inventory[i].amount);
- pc_setreg(sd,add_str("@inventorylist_equip")+(j<<24),sd->status.inventory[i].equip);
- pc_setreg(sd,add_str("@inventorylist_refine")+(j<<24),sd->status.inventory[i].refine);
- pc_setreg(sd,add_str("@inventorylist_identify")+(j<<24),sd->status.inventory[i].identify);
- pc_setreg(sd,add_str("@inventorylist_attribute")+(j<<24),sd->status.inventory[i].attribute);
+ pc_setreg(sd,reference_uid(add_str("@inventorylist_id"), j),sd->status.inventory[i].nameid);
+ pc_setreg(sd,reference_uid(add_str("@inventorylist_amount"), j),sd->status.inventory[i].amount);
+ pc_setreg(sd,reference_uid(add_str("@inventorylist_equip"), j),sd->status.inventory[i].equip);
+ pc_setreg(sd,reference_uid(add_str("@inventorylist_refine"), j),sd->status.inventory[i].refine);
+ pc_setreg(sd,reference_uid(add_str("@inventorylist_identify"), j),sd->status.inventory[i].identify);
+ pc_setreg(sd,reference_uid(add_str("@inventorylist_attribute"), j),sd->status.inventory[i].attribute);
for (k = 0; k < MAX_SLOTS; k++)
{
sprintf(card_var, "@inventorylist_card%d",k+1);
- pc_setreg(sd,add_str(card_var)+(j<<24),sd->status.inventory[i].card[k]);
+ pc_setreg(sd,reference_uid(add_str(card_var), j),sd->status.inventory[i].card[k]);
}
- pc_setreg(sd,add_str("@inventorylist_expire")+(j<<24),sd->status.inventory[i].expire_time);
+ pc_setreg(sd,reference_uid(add_str("@inventorylist_expire"), j),sd->status.inventory[i].expire_time);
j++;
}
}
@@ -10766,9 +10766,9 @@ BUILDIN_FUNC(getskilllist)
if(!sd) return 0;
for(i=0;i<MAX_SKILL;i++){
if(sd->status.skill[i].id > 0 && sd->status.skill[i].lv > 0){
- pc_setreg(sd,add_str("@skilllist_id")+(j<<24),sd->status.skill[i].id);
- pc_setreg(sd,add_str("@skilllist_lv")+(j<<24),sd->status.skill[i].lv);
- pc_setreg(sd,add_str("@skilllist_flag")+(j<<24),sd->status.skill[i].flag);
+ pc_setreg(sd,reference_uid(add_str("@skilllist_id"), j),sd->status.skill[i].id);
+ pc_setreg(sd,reference_uid(add_str("@skilllist_lv"), j),sd->status.skill[i].lv);
+ pc_setreg(sd,reference_uid(add_str("@skilllist_flag"), j),sd->status.skill[i].flag);
j++;
}
}
@@ -12545,7 +12545,7 @@ BUILDIN_FUNC(getd)
elem = 0;
// Push the 'pointer' so it's more flexible [Lance]
- push_val(st->stack, C_NAME, (elem<<24) | add_str(varname));
+ push_val(st->stack, C_NAME, reference_uid(add_str(varname), elem));
return 0;
}
@@ -13908,9 +13908,9 @@ BUILDIN_FUNC(waitingroom2bg)
for( i = 0; i < n && i < MAX_BG_MEMBERS; i++ )
{
if( (sd = cd->usersd[i]) != NULL && bg_team_join(bg_id, sd) )
- mapreg_setreg(add_str("$@arenamembers") + (i<<24), sd->bl.id);
+ mapreg_setreg(reference_uid(add_str("$@arenamembers"), i), sd->bl.id);
else
- mapreg_setreg(add_str("$@arenamembers") + (i<<24), 0);
+ mapreg_setreg(reference_uid(add_str("$@arenamembers"), i), 0);
}
mapreg_setreg(add_str("$@arenamembersnum"), i);