Issue information

Issue ID
#43
Status
Fixed
Severity
None
Started
Hercules Elf Bot
Sep 12, 2007 2:53
Last Post
Hercules Elf Bot
Sep 12, 2007 2:53
Confirmation
Yes (1)
No (0)

Hercules Elf Bot - Sep 12, 2007 2:53

Originally posted by [b]Bison[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=43

The problem here is that party leaders cannot invite anyone into their party. It's kind of a confusing problem for me, but taking a glance at the code and doing a little trial/error debug printing, I found a temp fix as well. I'd assume this affects trunk as well, but I'm not sure since I just use Stable.

Anyway, inside party.c under the party_invite function. Starting at line 270 we have:

[codebox]
//Only leader can invite.
ARR_FIND(0, MAX_PARTY, i, i < MAX_PARTY && p->data[i].sd != sd);
if (i == MAX_PARTY || !p->party.member[i].leader)
{ //TODO: Find the correct reply packet.
clif_displaymessage(sd->fd, msg_txt(282));
return 0;
}
[/codebox]

With some testing, I found out that the value of "p->party.member[i].leader" is 1 before the ARR_FIND() is called. Once that is called, then the value becomes 0, which contradicts the if statement. If not 0, then it's 1, which I understand it to prevent party leaders from inviting.

Anyway, my temp fix just involved removing the ! from the if statement as shown below:

Before:
if (i == MAX_PARTY || !p->party.member[i].leader)

After:
if (i == MAX_PARTY || p->party.member[i].leader)

This should take care of the problem for now, though, not sure if this is the recommended way of correcting it. (IMG:style_emoticons/default/wink.gif)

Edit: Just to save a little time, I will also add in that if a non-party leader tries to invite a player into the party, the value of "p->party.member[i].leader" comes out to be 1, so it appears the values are being swapped 0->1, 1->0 etc after ARR_FIND().

This post has been edited by Bison: Sep 11 2007, 10:08 PM