Added changes missing from the previous update (followup to r12710).
Corrected party invite failure not informing the inviting player. Cleaned up some foreach() code int_party.c. git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12711 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
3931c2db42
commit
d9e5150a44
@ -243,24 +243,25 @@ int inter_party_save() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// パ?ティ名?索用
|
// Search for the party according to its name
|
||||||
int search_partyname_sub(DBKey key,void *data,va_list ap) {
|
struct party_data* search_partyname(char *str)
|
||||||
struct party_data *p = (struct party_data *)data,**dst;
|
{
|
||||||
char *str;
|
struct DBIterator* iter;
|
||||||
|
struct party_data* p;
|
||||||
|
struct party_data* result = NULL;
|
||||||
|
|
||||||
str = va_arg(ap, char *);
|
iter = party_db->iterator(party_db);
|
||||||
dst = va_arg(ap, struct party_data **);
|
for( p = (struct party_data*)iter->first(iter,NULL); iter->exists(iter); p = (struct party_data*)iter->next(iter,NULL) )
|
||||||
if (strncmpi(p->party.name, str, NAME_LENGTH) == 0)
|
{
|
||||||
*dst = p;
|
if( strncmpi(p->party.name, str, NAME_LENGTH) == 0 )
|
||||||
|
{
|
||||||
|
result = p;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
iter->destroy(iter);
|
||||||
|
|
||||||
return 0;
|
return result;
|
||||||
}
|
|
||||||
|
|
||||||
// パ?ティ名?索
|
|
||||||
struct party_data* search_partyname(char *str) {
|
|
||||||
struct party_data *p = NULL;
|
|
||||||
party_db->foreach(party_db, search_partyname_sub, str, &p);
|
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns whether this party can keep having exp share or not.
|
// Returns whether this party can keep having exp share or not.
|
||||||
@ -283,41 +284,37 @@ int party_check_empty(struct party *p) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// キャラの競合がないかチェック用
|
// キャラの競合がないかチェック
|
||||||
int party_check_conflict_sub(DBKey key, void *data, va_list ap) {
|
int party_check_conflict(int party_id, int account_id, int char_id)
|
||||||
struct party_data *p = (struct party_data *)data;
|
{
|
||||||
int party_id, account_id, char_id, i;
|
DBIterator* iter;
|
||||||
|
struct party_data* p;
|
||||||
|
int i;
|
||||||
|
|
||||||
party_id=va_arg(ap, int);
|
iter = party_db->iterator(party_db);
|
||||||
account_id=va_arg(ap, int);
|
for( p = (struct party_data*)iter->first(iter,NULL); iter->exists(iter); p = (struct party_data*)iter->next(iter,NULL) )
|
||||||
char_id=va_arg(ap, int);
|
{
|
||||||
|
if (p->party.party_id == party_id) //No conflict to check
|
||||||
if (p->party.party_id == party_id) //No conflict to check
|
continue;
|
||||||
return 0;
|
|
||||||
|
|
||||||
for(i = 0; i < MAX_PARTY; i++) {
|
ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == account_id && p->party.member[i].char_id == char_id );
|
||||||
if(p->party.member[i].account_id == account_id &&
|
if( i < MAX_PARTY )
|
||||||
p->party.member[i].char_id == char_id)
|
{
|
||||||
{
|
|
||||||
ShowWarning("int_party: party conflict! %d %d %d\n", account_id, party_id, p->party.party_id);
|
ShowWarning("int_party: party conflict! %d %d %d\n", account_id, party_id, p->party.party_id);
|
||||||
mapif_parse_PartyLeave(-1, p->party.party_id, account_id, char_id);
|
mapif_parse_PartyLeave(-1, p->party.party_id, account_id, char_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
iter->destroy(iter);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// キャラの競合がないかチェック
|
|
||||||
int party_check_conflict(int party_id, int account_id, int char_id) {
|
|
||||||
party_db->foreach(party_db, party_check_conflict_sub, party_id, account_id, char_id);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// map serverへの通信
|
// map serverへの通信
|
||||||
|
|
||||||
// パ?ティ作成可否
|
// パ?ティ作成可否
|
||||||
int mapif_party_created(int fd,int account_id, int char_id, struct party *p) {
|
int mapif_party_created(int fd,int account_id, int char_id, struct party *p)
|
||||||
|
{
|
||||||
WFIFOHEAD(fd, 39);
|
WFIFOHEAD(fd, 39);
|
||||||
WFIFOW(fd,0) = 0x3820;
|
WFIFOW(fd,0) = 0x3820;
|
||||||
WFIFOL(fd,2) = account_id;
|
WFIFOL(fd,2) = account_id;
|
||||||
@ -450,10 +447,12 @@ int mapif_party_message(int party_id, int account_id, char *mes, int len, int sf
|
|||||||
|
|
||||||
|
|
||||||
// パ?ティ
|
// パ?ティ
|
||||||
int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct party_member *leader) {
|
int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct party_member *leader)
|
||||||
|
{
|
||||||
struct party_data *p;
|
struct party_data *p;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
//FIXME: this should be removed once the savefiles can handle all symbols
|
||||||
for(i = 0; i < NAME_LENGTH && name[i]; i++) {
|
for(i = 0; i < NAME_LENGTH && name[i]; i++) {
|
||||||
if (!(name[i] & 0xe0) || name[i] == 0x7f) {
|
if (!(name[i] & 0xe0) || name[i] == 0x7f) {
|
||||||
ShowInfo("int_party: illegal party name [%s]\n", name);
|
ShowInfo("int_party: illegal party name [%s]\n", name);
|
||||||
|
@ -408,7 +408,12 @@ int party_member_added(int party_id,int account_id,int char_id, int flag)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( flag ) return 0;
|
if( flag )
|
||||||
|
{// failed
|
||||||
|
if( sd2 != NULL )
|
||||||
|
clif_party_inviteack(sd2,sd->status.name,3);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
sd->status.party_id = party_id;
|
sd->status.party_id = party_id;
|
||||||
|
|
||||||
@ -420,13 +425,13 @@ int party_member_added(int party_id,int account_id,int char_id, int flag)
|
|||||||
p->data[i].sd = sd;
|
p->data[i].sd = sd;
|
||||||
}
|
}
|
||||||
|
|
||||||
party_check_conflict(sd);
|
party_check_conflict(sd); //FIXME: is this neccessary?
|
||||||
clif_party_member_info(p,sd);
|
clif_party_member_info(p,sd);
|
||||||
clif_party_option(p,sd,0x100);
|
clif_party_option(p,sd,0x100);
|
||||||
clif_party_info(p,sd);
|
clif_party_info(p,sd);
|
||||||
|
|
||||||
if( sd2 != NULL )
|
if( sd2 != NULL )
|
||||||
clif_party_inviteack(sd2,sd->status.name,flag?3:2);
|
clif_party_inviteack(sd2,sd->status.name,2);
|
||||||
|
|
||||||
for( i = 0; i < ARRAYLENGTH(p->data); ++i )
|
for( i = 0; i < ARRAYLENGTH(p->data); ++i )
|
||||||
{// hp of the other party members
|
{// hp of the other party members
|
||||||
@ -751,14 +756,6 @@ int party_send_xy_timer(int tid, unsigned int tick, int id, intptr data)
|
|||||||
{
|
{
|
||||||
struct map_session_data* sd = p->data[i].sd;
|
struct map_session_data* sd = p->data[i].sd;
|
||||||
if( !sd ) continue;
|
if( !sd ) continue;
|
||||||
if( !malloc_verify(sd) )
|
|
||||||
{
|
|
||||||
ShowError("party_send_xy_timer: party member zombie reference '0x%8.8x'!\n", (uint32)sd);
|
|
||||||
ShowDebug("party info: id='%d', name='%s', member count='%d'\n", p->party.party_id, p->party.name, p->party.count);
|
|
||||||
ShowDebug("member info: charid='%d', name='%s', member no.='%d', online='%d', coords='%s,%d,%d'\n", p->party.member[i].char_id, p->party.member[i].name, i, p->party.member[i].online, mapindex_id2name(p->party.member[i].map), p->data[i].x, p->data[i].y);
|
|
||||||
p->data[i].sd = NULL;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( p->data[i].x != sd->bl.x || p->data[i].y != sd->bl.y )
|
if( p->data[i].x != sd->bl.x || p->data[i].y != sd->bl.y )
|
||||||
{// perform position update
|
{// perform position update
|
||||||
|
@ -295,7 +295,9 @@ struct map_session_data {
|
|||||||
int zeny, weight;
|
int zeny, weight;
|
||||||
} deal;
|
} deal;
|
||||||
|
|
||||||
int party_invite,party_invite_account;
|
bool party_creating; // whether the char is requesting party creation
|
||||||
|
bool party_joining; // whether the char is accepting party invitation
|
||||||
|
int party_invite, party_invite_account; // for handling party invitation (holds party id and account id)
|
||||||
int adopt_invite; // Adoption
|
int adopt_invite; // Adoption
|
||||||
|
|
||||||
int guild_invite,guild_invite_account;
|
int guild_invite,guild_invite_account;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user