I noticed that they all adress the same variable with the same uid, thus the data is overwriting each other in each loop. SO all the individual playerdata is lost. It feels to me like that is not intentional and neither going to work out well.
I placed this in scripting topic as using mapreg is obviously relevant to scripting.
This directly leads to the question how to best adress to that variable in script. Is there a way to create an array with mapreg->setreg? that way we can iterate through the arrays and process the data accordingly for each member of the queue
hi, I'm currently reviewing battleground.c
but I'm stuck at this part of the code.
for (i = 0; i < VECTOR_LENGTH(queue->entries); i++) { struct map_session_data *sd = map->id2sd(VECTOR_INDEX(queue->entries, i)); if (sd == NULL || sd->bg_queue.ready != 1) continue; int uid = reference_uid(script->add_str("$@bg_member"), count); #ifdef TRACE ShowXilero("BG begin uid $@bg_member %d\n", uid); #endif mapreg->setreg(uid, sd->status.account_id); mapreg->setreg(reference_uid(script->add_str("$@bg_member_group"), count), sd->bg_queue.type == BGQT_GUILD ? sd->status.guild_id : sd->bg_queue.type == BGQT_PARTY ? sd->status.party_id : 0 ); mapreg->setreg(reference_uid(script->add_str("$@bg_member_type"), count), sd->bg_queue.type == BGQT_GUILD ? 1 : sd->bg_queue.type == BGQT_PARTY ? 2 : 0 ); count++; } mapreg->setreg(script->add_str("$@bg_member_size"),count);
particularly
mapreg->setreg(reference_uid(script->add_str("$@bg_member"), count), sd->status.account_id);
i pieced that up to debug what is happening.
I noticed that they all adress the same variable with the same uid, thus the data is overwriting each other in each loop. SO all the individual playerdata is lost. It feels to me like that is not intentional and neither going to work out well.
I placed this in scripting topic as using mapreg is obviously relevant to scripting.
This directly leads to the question how to best adress to that variable in script. Is there a way to create an array with mapreg->setreg? that way we can iterate through the arrays and process the data accordingly for each member of the queue
thanks if anyone can clear that up for me
Share this post
Link to post
Share on other sites