summaryrefslogtreecommitdiff
path: root/src/char/int_party.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/char/int_party.cpp')
-rw-r--r--src/char/int_party.cpp424
1 files changed, 211 insertions, 213 deletions
diff --git a/src/char/int_party.cpp b/src/char/int_party.cpp
index 6602ce5..19c4fbd 100644
--- a/src/char/int_party.cpp
+++ b/src/char/int_party.cpp
@@ -15,24 +15,24 @@ char party_txt[1024] = "save/party.txt";
static struct dbt *party_db;
static int party_newid = 100;
-int mapif_party_broken (int party_id, int flag);
-int party_check_empty (struct party *p);
-int mapif_parse_PartyLeave (int fd, int party_id, int account_id);
+int mapif_party_broken(int party_id, int flag);
+int party_check_empty(struct party *p);
+int mapif_parse_PartyLeave(int fd, int party_id, int account_id);
// パーティデータの文字列への変換
static
-int inter_party_tostr (char *str, struct party *p)
+int inter_party_tostr(char *str, struct party *p)
{
- int i, len;
+ int i, len;
len =
- sprintf (str, "%d\t%s\t%d,%d\t", p->party_id, p->name, p->exp,
+ sprintf(str, "%d\t%s\t%d,%d\t", p->party_id, p->name, p->exp,
p->item);
for (i = 0; i < MAX_PARTY; i++)
{
struct party_member *m = &p->member[i];
len +=
- sprintf (str + len, "%d,%d\t%s\t", m->account_id, m->leader,
+ sprintf(str + len, "%d,%d\t%s\t", m->account_id, m->leader,
((m->account_id > 0) ? m->name : "NoMember"));
}
@@ -41,28 +41,27 @@ int inter_party_tostr (char *str, struct party *p)
// パーティデータの文字列からの変換
static
-int inter_party_fromstr (char *str, struct party *p)
+int inter_party_fromstr(char *str, struct party *p)
{
- int i, j;
- int tmp_int[16];
+ int i, j;
+ int tmp_int[16];
char tmp_str[256];
- memset (p, 0, sizeof (struct party));
+ memset(p, 0, sizeof(struct party));
// printf("sscanf party main info\n");
- if (sscanf
- (str, "%d\t%[^\t]\t%d,%d\t", &tmp_int[0], tmp_str, &tmp_int[1],
+ if (sscanf(str, "%d\t%[^\t]\t%d,%d\t", &tmp_int[0], tmp_str, &tmp_int[1],
&tmp_int[2]) != 4)
return 1;
p->party_id = tmp_int[0];
- strcpy (p->name, tmp_str);
+ strcpy(p->name, tmp_str);
p->exp = tmp_int[1];
p->item = tmp_int[2];
// printf("%d [%s] %d %d\n", tmp_int[0], tmp_str[0], tmp_int[1], tmp_int[2]);
for (j = 0; j < 3 && str != NULL; j++)
- str = strchr (str + 1, '\t');
+ str = strchr(str + 1, '\t');
for (i = 0; i < MAX_PARTY; i++)
{
@@ -71,64 +70,63 @@ int inter_party_fromstr (char *str, struct party *p)
return 1;
// printf("sscanf party member info %d\n", i);
- if (sscanf
- (str + 1, "%d,%d\t%[^\t]\t", &tmp_int[0], &tmp_int[1],
+ if (sscanf(str + 1, "%d,%d\t%[^\t]\t", &tmp_int[0], &tmp_int[1],
tmp_str) != 3)
return 1;
m->account_id = tmp_int[0];
m->leader = tmp_int[1];
- strncpy (m->name, tmp_str, sizeof (m->name));
+ strncpy(m->name, tmp_str, sizeof(m->name));
// printf(" %d %d [%s]\n", tmp_int[0], tmp_int[1], tmp_str);
for (j = 0; j < 2 && str != NULL; j++)
- str = strchr (str + 1, '\t');
+ str = strchr(str + 1, '\t');
}
return 0;
}
// パーティデータのロード
-int inter_party_init (void)
+int inter_party_init(void)
{
char line[8192];
struct party *p;
FILE *fp;
- int c = 0;
- int i, j;
+ int c = 0;
+ int i, j;
- party_db = numdb_init ();
+ party_db = numdb_init();
- if ((fp = fopen_ (party_txt, "r")) == NULL)
+ if ((fp = fopen_(party_txt, "r")) == NULL)
return 1;
- while (fgets (line, sizeof (line) - 1, fp))
+ while (fgets(line, sizeof(line) - 1, fp))
{
j = 0;
- if (sscanf (line, "%d\t%%newid%%\n%n", &i, &j) == 1 && j > 0
+ if (sscanf(line, "%d\t%%newid%%\n%n", &i, &j) == 1 && j > 0
&& party_newid <= i)
{
party_newid = i;
continue;
}
- CREATE (p, struct party, 1);
- if (inter_party_fromstr (line, p) == 0 && p->party_id > 0)
+ CREATE(p, struct party, 1);
+ if (inter_party_fromstr(line, p) == 0 && p->party_id > 0)
{
if (p->party_id >= party_newid)
party_newid = p->party_id + 1;
- numdb_insert (party_db, p->party_id, p);
- party_check_empty (p);
+ numdb_insert(party_db, p->party_id, p);
+ party_check_empty(p);
}
else
{
- printf ("int_party: broken data [%s] line %d\n", party_txt,
+ printf("int_party: broken data [%s] line %d\n", party_txt,
c + 1);
- free (p);
+ free(p);
}
c++;
}
- fclose_ (fp);
+ fclose_(fp);
// printf("int_party: %s read done (%d parties)\n", party_txt, c);
return 0;
@@ -136,31 +134,31 @@ int inter_party_init (void)
// パーティーデータのセーブ用
static
-void inter_party_save_sub (db_key_t key, db_val_t data, va_list ap)
+void inter_party_save_sub(db_key_t key, db_val_t data, va_list ap)
{
char line[8192];
FILE *fp;
- inter_party_tostr (line, (struct party *) data);
- fp = va_arg (ap, FILE *);
- fprintf (fp, "%s\n", line);
+ inter_party_tostr(line, (struct party *) data);
+ fp = va_arg(ap, FILE *);
+ fprintf(fp, "%s\n", line);
}
// パーティーデータのセーブ
-int inter_party_save (void)
+int inter_party_save(void)
{
FILE *fp;
- int lock;
+ int lock;
- if ((fp = lock_fopen (party_txt, &lock)) == NULL)
+ if ((fp = lock_fopen(party_txt, &lock)) == NULL)
{
- printf ("int_party: cant write [%s] !!! data is lost !!!\n",
+ printf("int_party: cant write [%s] !!! data is lost !!!\n",
party_txt);
return 1;
}
- numdb_foreach (party_db, inter_party_save_sub, fp);
+ numdb_foreach(party_db, inter_party_save_sub, fp);
// fprintf(fp, "%d\t%%newid%%\n", party_newid);
- lock_fclose (fp, party_txt, &lock);
+ lock_fclose(fp, party_txt, &lock);
// printf("int_party: %s saved.\n", party_txt);
return 0;
@@ -168,37 +166,37 @@ int inter_party_save (void)
// パーティ名検索用
static
-void search_partyname_sub (db_key_t key, db_val_t data, va_list ap)
+void search_partyname_sub(db_key_t key, db_val_t data, va_list ap)
{
struct party *p = (struct party *) data, **dst;
char *str;
- str = va_arg (ap, char *);
- dst = va_arg (ap, struct party **);
- if (strcasecmp (p->name, str) == 0)
+ str = va_arg(ap, char *);
+ dst = va_arg(ap, struct party **);
+ if (strcasecmp(p->name, str) == 0)
*dst = p;
}
// パーティ名検索
static
-struct party *search_partyname (const char *str)
+struct party *search_partyname(const char *str)
{
struct party *p = NULL;
- numdb_foreach (party_db, search_partyname_sub, str, &p);
+ numdb_foreach(party_db, search_partyname_sub, str, &p);
return p;
}
// EXP公平分配できるかチェック
static
-int party_check_exp_share (struct party *p)
+int party_check_exp_share(struct party *p)
{
- int i;
- int maxlv = 0, minlv = 0x7fffffff;
+ int i;
+ int maxlv = 0, minlv = 0x7fffffff;
for (i = 0; i < MAX_PARTY; i++)
{
- int lv = p->member[i].lv;
+ int lv = p->member[i].lv;
if (p->member[i].online)
{
if (lv < minlv)
@@ -212,9 +210,9 @@ int party_check_exp_share (struct party *p)
}
// パーティが空かどうかチェック
-int party_check_empty (struct party *p)
+int party_check_empty(struct party *p)
{
- int i;
+ int i;
// printf("party check empty %08X\n", (int)p);
for (i = 0; i < MAX_PARTY; i++)
@@ -226,24 +224,24 @@ int party_check_empty (struct party *p)
}
}
// 誰もいないので解散
- mapif_party_broken (p->party_id, 0);
- numdb_erase (party_db, p->party_id);
- free (p);
+ mapif_party_broken(p->party_id, 0);
+ numdb_erase(party_db, p->party_id);
+ free(p);
return 1;
}
// キャラの競合がないかチェック用
static
-void party_check_conflict_sub (db_key_t key, db_val_t data, va_list ap)
+void party_check_conflict_sub(db_key_t key, db_val_t data, va_list ap)
{
struct party *p = (struct party *) data;
- int party_id, account_id, i;
+ int party_id, account_id, i;
char *nick;
- party_id = va_arg (ap, int);
- account_id = va_arg (ap, int);
- nick = va_arg (ap, char *);
+ party_id = va_arg(ap, int);
+ account_id = va_arg(ap, int);
+ nick = va_arg(ap, char *);
if (p->party_id == party_id) // 本来の所属なので問題なし
return;
@@ -251,21 +249,21 @@ void party_check_conflict_sub (db_key_t key, db_val_t data, va_list ap)
for (i = 0; i < MAX_PARTY; i++)
{
if (p->member[i].account_id == account_id
- && strcmp (p->member[i].name, nick) == 0)
+ && strcmp(p->member[i].name, nick) == 0)
{
// 別のパーティに偽の所属データがあるので脱退
- printf ("int_party: party conflict! %d %d %d\n", account_id,
+ printf("int_party: party conflict! %d %d %d\n", account_id,
party_id, p->party_id);
- mapif_parse_PartyLeave (-1, p->party_id, account_id);
+ mapif_parse_PartyLeave(-1, p->party_id, account_id);
}
}
}
// キャラの競合がないかチェック
static
-int party_check_conflict (int party_id, int account_id, const char *nick)
+int party_check_conflict(int party_id, int account_id, const char *nick)
{
- numdb_foreach (party_db, party_check_conflict_sub, party_id, account_id,
+ numdb_foreach(party_db, party_check_conflict_sub, party_id, account_id,
nick);
return 0;
@@ -276,54 +274,54 @@ int party_check_conflict (int party_id, int account_id, const char *nick)
// パーティ作成可否
static
-int mapif_party_created (int fd, int account_id, struct party *p)
+int mapif_party_created(int fd, int account_id, struct party *p)
{
- WFIFOW (fd, 0) = 0x3820;
- WFIFOL (fd, 2) = account_id;
+ WFIFOW(fd, 0) = 0x3820;
+ WFIFOL(fd, 2) = account_id;
if (p != NULL)
{
- WFIFOB (fd, 6) = 0;
- WFIFOL (fd, 7) = p->party_id;
- memcpy (WFIFOP (fd, 11), p->name, 24);
- printf ("int_party: created! %d %s\n", p->party_id, p->name);
+ WFIFOB(fd, 6) = 0;
+ WFIFOL(fd, 7) = p->party_id;
+ memcpy(WFIFOP(fd, 11), p->name, 24);
+ printf("int_party: created! %d %s\n", p->party_id, p->name);
}
else
{
- WFIFOB (fd, 6) = 1;
- WFIFOL (fd, 7) = 0;
- memcpy (WFIFOP (fd, 11), "error", 24);
+ WFIFOB(fd, 6) = 1;
+ WFIFOL(fd, 7) = 0;
+ memcpy(WFIFOP(fd, 11), "error", 24);
}
- WFIFOSET (fd, 35);
+ WFIFOSET(fd, 35);
return 0;
}
// パーティ情報見つからず
static
-int mapif_party_noinfo (int fd, int party_id)
+int mapif_party_noinfo(int fd, int party_id)
{
- WFIFOW (fd, 0) = 0x3821;
- WFIFOW (fd, 2) = 8;
- WFIFOL (fd, 4) = party_id;
- WFIFOSET (fd, 8);
- printf ("int_party: info not found %d\n", party_id);
+ WFIFOW(fd, 0) = 0x3821;
+ WFIFOW(fd, 2) = 8;
+ WFIFOL(fd, 4) = party_id;
+ WFIFOSET(fd, 8);
+ printf("int_party: info not found %d\n", party_id);
return 0;
}
// パーティ情報まとめ送り
static
-int mapif_party_info (int fd, struct party *p)
+int mapif_party_info(int fd, struct party *p)
{
- unsigned char buf[4 + sizeof (struct party)];
+ unsigned char buf[4 + sizeof(struct party)];
- WBUFW (buf, 0) = 0x3821;
- memcpy (buf + 4, p, sizeof (struct party));
- WBUFW (buf, 2) = 4 + sizeof (struct party);
+ WBUFW(buf, 0) = 0x3821;
+ memcpy(buf + 4, p, sizeof(struct party));
+ WBUFW(buf, 2) = 4 + sizeof(struct party);
if (fd < 0)
- mapif_sendall (buf, WBUFW (buf, 2));
+ mapif_sendall(buf, WBUFW(buf, 2));
else
- mapif_send (fd, buf, WBUFW (buf, 2));
+ mapif_send(fd, buf, WBUFW(buf, 2));
// printf("int_party: info %d %s\n", p->party_id, p->name);
return 0;
@@ -331,35 +329,35 @@ int mapif_party_info (int fd, struct party *p)
// パーティメンバ追加可否
static
-int mapif_party_memberadded (int fd, int party_id, int account_id, int flag)
+int mapif_party_memberadded(int fd, int party_id, int account_id, int flag)
{
- WFIFOW (fd, 0) = 0x3822;
- WFIFOL (fd, 2) = party_id;
- WFIFOL (fd, 6) = account_id;
- WFIFOB (fd, 10) = flag;
- WFIFOSET (fd, 11);
+ WFIFOW(fd, 0) = 0x3822;
+ WFIFOL(fd, 2) = party_id;
+ WFIFOL(fd, 6) = account_id;
+ WFIFOB(fd, 10) = flag;
+ WFIFOSET(fd, 11);
return 0;
}
// パーティ設定変更通知
static
-int mapif_party_optionchanged (int fd, struct party *p, int account_id,
+int mapif_party_optionchanged(int fd, struct party *p, int account_id,
int flag)
{
unsigned char buf[15];
- WBUFW (buf, 0) = 0x3823;
- WBUFL (buf, 2) = p->party_id;
- WBUFL (buf, 6) = account_id;
- WBUFW (buf, 10) = p->exp;
- WBUFW (buf, 12) = p->item;
- WBUFB (buf, 14) = flag;
+ WBUFW(buf, 0) = 0x3823;
+ WBUFL(buf, 2) = p->party_id;
+ WBUFL(buf, 6) = account_id;
+ WBUFW(buf, 10) = p->exp;
+ WBUFW(buf, 12) = p->item;
+ WBUFB(buf, 14) = flag;
if (flag == 0)
- mapif_sendall (buf, 15);
+ mapif_sendall(buf, 15);
else
- mapif_send (fd, buf, 15);
- printf ("int_party: option changed %d %d %d %d %d\n", p->party_id,
+ mapif_send(fd, buf, 15);
+ printf("int_party: option changed %d %d %d %d %d\n", p->party_id,
account_id, p->exp, p->item, flag);
return 0;
@@ -367,62 +365,62 @@ int mapif_party_optionchanged (int fd, struct party *p, int account_id,
// パーティ脱退通知
static
-int mapif_party_leaved (int party_id, int account_id, char *name)
+int mapif_party_leaved(int party_id, int account_id, char *name)
{
unsigned char buf[34];
- WBUFW (buf, 0) = 0x3824;
- WBUFL (buf, 2) = party_id;
- WBUFL (buf, 6) = account_id;
- memcpy (WBUFP (buf, 10), name, 24);
- mapif_sendall (buf, 34);
- printf ("int_party: party leaved %d %d %s\n", party_id, account_id, name);
+ WBUFW(buf, 0) = 0x3824;
+ WBUFL(buf, 2) = party_id;
+ WBUFL(buf, 6) = account_id;
+ memcpy(WBUFP(buf, 10), name, 24);
+ mapif_sendall(buf, 34);
+ printf("int_party: party leaved %d %d %s\n", party_id, account_id, name);
return 0;
}
// パーティマップ更新通知
static
-int mapif_party_membermoved (struct party *p, int idx)
+int mapif_party_membermoved(struct party *p, int idx)
{
unsigned char buf[29];
- WBUFW (buf, 0) = 0x3825;
- WBUFL (buf, 2) = p->party_id;
- WBUFL (buf, 6) = p->member[idx].account_id;
- memcpy (WBUFP (buf, 10), p->member[idx].map, 16);
- WBUFB (buf, 26) = p->member[idx].online;
- WBUFW (buf, 27) = p->member[idx].lv;
- mapif_sendall (buf, 29);
+ WBUFW(buf, 0) = 0x3825;
+ WBUFL(buf, 2) = p->party_id;
+ WBUFL(buf, 6) = p->member[idx].account_id;
+ memcpy(WBUFP(buf, 10), p->member[idx].map, 16);
+ WBUFB(buf, 26) = p->member[idx].online;
+ WBUFW(buf, 27) = p->member[idx].lv;
+ mapif_sendall(buf, 29);
return 0;
}
// パーティ解散通知
-int mapif_party_broken (int party_id, int flag)
+int mapif_party_broken(int party_id, int flag)
{
unsigned char buf[7];
- WBUFW (buf, 0) = 0x3826;
- WBUFL (buf, 2) = party_id;
- WBUFB (buf, 6) = flag;
- mapif_sendall (buf, 7);
- printf ("int_party: broken %d\n", party_id);
+ WBUFW(buf, 0) = 0x3826;
+ WBUFL(buf, 2) = party_id;
+ WBUFB(buf, 6) = flag;
+ mapif_sendall(buf, 7);
+ printf("int_party: broken %d\n", party_id);
return 0;
}
// パーティ内発言
static
-int mapif_party_message (int party_id, int account_id, const char *mes, int len)
+int mapif_party_message(int party_id, int account_id, const char *mes, int len)
{
unsigned char buf[len + 12];
- WBUFW (buf, 0) = 0x3827;
- WBUFW (buf, 2) = len + 12;
- WBUFL (buf, 4) = party_id;
- WBUFL (buf, 8) = account_id;
- memcpy (WBUFP (buf, 12), mes, len);
- mapif_sendall (buf, len + 12);
+ WBUFW(buf, 0) = 0x3827;
+ WBUFW(buf, 2) = len + 12;
+ WBUFL(buf, 4) = party_id;
+ WBUFL(buf, 8) = account_id;
+ memcpy(WBUFP(buf, 12), mes, len);
+ mapif_sendall(buf, len + 12);
return 0;
}
@@ -432,70 +430,70 @@ int mapif_party_message (int party_id, int account_id, const char *mes, int len)
// パーティ
static
-int mapif_parse_CreateParty (int fd, int account_id, const char *name, const char *nick,
+int mapif_parse_CreateParty(int fd, int account_id, const char *name, const char *nick,
const char *map, int lv)
{
struct party *p;
- int i;
+ int i;
for (i = 0; i < 24 && name[i]; i++)
{
if (!(name[i] & 0xe0) || name[i] == 0x7f)
{
- printf ("int_party: illegal party name [%s]\n", name);
- mapif_party_created (fd, account_id, NULL);
+ printf("int_party: illegal party name [%s]\n", name);
+ mapif_party_created(fd, account_id, NULL);
return 0;
}
}
- if ((p = search_partyname (name)) != NULL)
+ if ((p = search_partyname(name)) != NULL)
{
- printf ("int_party: same name party exists [%s]\n", name);
- mapif_party_created (fd, account_id, NULL);
+ printf("int_party: same name party exists [%s]\n", name);
+ mapif_party_created(fd, account_id, NULL);
return 0;
}
- CREATE (p, struct party, 1);
+ CREATE(p, struct party, 1);
p->party_id = party_newid++;
- memcpy (p->name, name, 24);
+ memcpy(p->name, name, 24);
p->exp = 0;
p->item = 0;
p->member[0].account_id = account_id;
- memcpy (p->member[0].name, nick, 24);
- memcpy (p->member[0].map, map, 16);
+ memcpy(p->member[0].name, nick, 24);
+ memcpy(p->member[0].map, map, 16);
p->member[0].leader = 1;
p->member[0].online = 1;
p->member[0].lv = lv;
- numdb_insert (party_db, p->party_id, p);
+ numdb_insert(party_db, p->party_id, p);
- mapif_party_created (fd, account_id, p);
- mapif_party_info (fd, p);
+ mapif_party_created(fd, account_id, p);
+ mapif_party_info(fd, p);
return 0;
}
// パーティ情報要求
static
-int mapif_parse_PartyInfo (int fd, int party_id)
+int mapif_parse_PartyInfo(int fd, int party_id)
{
- struct party *p = (struct party *)numdb_search (party_db, party_id);
+ struct party *p = (struct party *)numdb_search(party_db, party_id);
if (p != NULL)
- mapif_party_info (fd, p);
+ mapif_party_info(fd, p);
else
- mapif_party_noinfo (fd, party_id);
+ mapif_party_noinfo(fd, party_id);
return 0;
}
// パーティ追加要求
static
-int mapif_parse_PartyAddMember (int fd, int party_id, int account_id,
+int mapif_parse_PartyAddMember(int fd, int party_id, int account_id,
const char *nick, const char *map, int lv)
{
- struct party *p = (struct party *)numdb_search (party_db, party_id);
+ struct party *p = (struct party *)numdb_search(party_db, party_id);
if (p == NULL)
{
- mapif_party_memberadded (fd, party_id, account_id, 1);
+ mapif_party_memberadded(fd, party_id, account_id, 1);
return 0;
}
@@ -503,44 +501,44 @@ int mapif_parse_PartyAddMember (int fd, int party_id, int account_id,
{
if (p->member[i].account_id == 0)
{
- int flag = 0;
+ int flag = 0;
p->member[i].account_id = account_id;
- memcpy (p->member[i].name, nick, 24);
- memcpy (p->member[i].map, map, 16);
+ memcpy(p->member[i].name, nick, 24);
+ memcpy(p->member[i].map, map, 16);
p->member[i].leader = 0;
p->member[i].online = 1;
p->member[i].lv = lv;
- mapif_party_memberadded (fd, party_id, account_id, 0);
- mapif_party_info (-1, p);
+ mapif_party_memberadded(fd, party_id, account_id, 0);
+ mapif_party_info(-1, p);
- if (p->exp > 0 && !party_check_exp_share (p))
+ if (p->exp > 0 && !party_check_exp_share(p))
{
p->exp = 0;
flag = 0x01;
}
if (flag)
- mapif_party_optionchanged (fd, p, 0, 0);
+ mapif_party_optionchanged(fd, p, 0, 0);
return 0;
}
}
- mapif_party_memberadded (fd, party_id, account_id, 1);
+ mapif_party_memberadded(fd, party_id, account_id, 1);
return 0;
}
// パーティー設定変更要求
static
-int mapif_parse_PartyChangeOption (int fd, int party_id, int account_id,
+int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id,
int exp, int item)
{
- struct party *p = (struct party *)numdb_search (party_db, party_id);
+ struct party *p = (struct party *)numdb_search(party_db, party_id);
if (p == NULL)
return 0;
p->exp = exp;
- int flag = 0;
- if (exp > 0 && !party_check_exp_share (p))
+ int flag = 0;
+ if (exp > 0 && !party_check_exp_share(p))
{
flag |= 0x01;
p->exp = 0;
@@ -548,25 +546,25 @@ int mapif_parse_PartyChangeOption (int fd, int party_id, int account_id,
p->item = item;
- mapif_party_optionchanged (fd, p, account_id, flag);
+ mapif_party_optionchanged(fd, p, account_id, flag);
return 0;
}
// パーティ脱退要求
-int mapif_parse_PartyLeave (int fd, int party_id, int account_id)
+int mapif_parse_PartyLeave(int fd, int party_id, int account_id)
{
- struct party *p = (struct party *)numdb_search (party_db, party_id);
+ struct party *p = (struct party *)numdb_search(party_db, party_id);
if (p != NULL)
{
for (int i = 0; i < MAX_PARTY; i++)
{
if (p->member[i].account_id == account_id)
{
- mapif_party_leaved (party_id, account_id, p->member[i].name);
+ mapif_party_leaved(party_id, account_id, p->member[i].name);
- memset (&p->member[i], 0, sizeof (struct party_member));
- if (party_check_empty (p) == 0)
- mapif_party_info (-1, p); // まだ人がいるのでデータ送信
+ memset(&p->member[i], 0, sizeof(struct party_member));
+ if (party_check_empty(p) == 0)
+ mapif_party_info(-1, p); // まだ人がいるのでデータ送信
return 0;
}
}
@@ -577,10 +575,10 @@ int mapif_parse_PartyLeave (int fd, int party_id, int account_id)
// パーティマップ更新要求
static
-int mapif_parse_PartyChangeMap (int fd, int party_id, int account_id,
+int mapif_parse_PartyChangeMap(int fd, int party_id, int account_id,
const char *map, int online, int lv)
{
- struct party *p = (struct party *)numdb_search (party_db, party_id);
+ struct party *p = (struct party *)numdb_search(party_db, party_id);
if (p == NULL)
return 0;
@@ -588,20 +586,20 @@ int mapif_parse_PartyChangeMap (int fd, int party_id, int account_id,
{
if (p->member[i].account_id == account_id)
{
- int flag = 0;
+ int flag = 0;
- memcpy (p->member[i].map, map, 16);
+ memcpy(p->member[i].map, map, 16);
p->member[i].online = online;
p->member[i].lv = lv;
- mapif_party_membermoved (p, i);
+ mapif_party_membermoved(p, i);
- if (p->exp > 0 && !party_check_exp_share (p))
+ if (p->exp > 0 && !party_check_exp_share(p))
{
p->exp = 0;
flag = 1;
}
if (flag)
- mapif_party_optionchanged (fd, p, 0, 0);
+ mapif_party_optionchanged(fd, p, 0, 0);
break;
}
}
@@ -611,31 +609,31 @@ int mapif_parse_PartyChangeMap (int fd, int party_id, int account_id,
// パーティ解散要求
static
-int mapif_parse_BreakParty (int fd, int party_id)
+int mapif_parse_BreakParty(int fd, int party_id)
{
- struct party *p = (struct party *)numdb_search (party_db, party_id);
+ struct party *p = (struct party *)numdb_search(party_db, party_id);
if (p == NULL)
return 0;
- numdb_erase (party_db, party_id);
- mapif_party_broken (fd, party_id);
+ numdb_erase(party_db, party_id);
+ mapif_party_broken(fd, party_id);
return 0;
}
// パーティメッセージ送信
static
-int mapif_parse_PartyMessage (int fd, int party_id, int account_id, const char *mes,
+int mapif_parse_PartyMessage(int fd, int party_id, int account_id, const char *mes,
int len)
{
- return mapif_party_message (party_id, account_id, mes, len);
+ return mapif_party_message(party_id, account_id, mes, len);
}
// パーティチェック要求
static
-int mapif_parse_PartyCheck (int fd, int party_id, int account_id, const char *nick)
+int mapif_parse_PartyCheck(int fd, int party_id, int account_id, const char *nick)
{
- return party_check_conflict (party_id, account_id, nick);
+ return party_check_conflict(party_id, account_id, nick);
}
// map server からの通信
@@ -643,45 +641,45 @@ int mapif_parse_PartyCheck (int fd, int party_id, int account_id, const char *ni
// ・パケット長データはinter.cにセットしておくこと
// ・パケット長チェックや、RFIFOSKIPは呼び出し元で行われるので行ってはならない
// ・エラーなら0(false)、そうでないなら1(true)をかえさなければならない
-int inter_party_parse_frommap (int fd)
+int inter_party_parse_frommap(int fd)
{
- switch (RFIFOW (fd, 0))
+ switch (RFIFOW(fd, 0))
{
case 0x3020:
- mapif_parse_CreateParty (fd, RFIFOL (fd, 2), (const char *)RFIFOP (fd, 6),
- (const char *)RFIFOP (fd, 30), (const char *)RFIFOP (fd, 54),
- RFIFOW (fd, 70));
+ mapif_parse_CreateParty(fd, RFIFOL(fd, 2), (const char *)RFIFOP(fd, 6),
+ (const char *)RFIFOP(fd, 30), (const char *)RFIFOP(fd, 54),
+ RFIFOW(fd, 70));
break;
case 0x3021:
- mapif_parse_PartyInfo (fd, RFIFOL (fd, 2));
+ mapif_parse_PartyInfo(fd, RFIFOL(fd, 2));
break;
case 0x3022:
- mapif_parse_PartyAddMember (fd, RFIFOL (fd, 2), RFIFOL (fd, 6),
- (const char *)RFIFOP (fd, 10), (const char *)RFIFOP (fd, 34),
- RFIFOW (fd, 50));
+ mapif_parse_PartyAddMember(fd, RFIFOL(fd, 2), RFIFOL(fd, 6),
+ (const char *)RFIFOP(fd, 10), (const char *)RFIFOP(fd, 34),
+ RFIFOW(fd, 50));
break;
case 0x3023:
- mapif_parse_PartyChangeOption (fd, RFIFOL (fd, 2), RFIFOL (fd, 6),
- RFIFOW (fd, 10), RFIFOW (fd, 12));
+ mapif_parse_PartyChangeOption(fd, RFIFOL(fd, 2), RFIFOL(fd, 6),
+ RFIFOW(fd, 10), RFIFOW(fd, 12));
break;
case 0x3024:
- mapif_parse_PartyLeave (fd, RFIFOL (fd, 2), RFIFOL (fd, 6));
+ mapif_parse_PartyLeave(fd, RFIFOL(fd, 2), RFIFOL(fd, 6));
break;
case 0x3025:
- mapif_parse_PartyChangeMap (fd, RFIFOL (fd, 2), RFIFOL (fd, 6),
- (const char *)RFIFOP (fd, 10), RFIFOB (fd, 26),
- RFIFOW (fd, 27));
+ mapif_parse_PartyChangeMap(fd, RFIFOL(fd, 2), RFIFOL(fd, 6),
+ (const char *)RFIFOP(fd, 10), RFIFOB(fd, 26),
+ RFIFOW(fd, 27));
break;
case 0x3026:
- mapif_parse_BreakParty (fd, RFIFOL (fd, 2));
+ mapif_parse_BreakParty(fd, RFIFOL(fd, 2));
break;
case 0x3027:
- mapif_parse_PartyMessage (fd, RFIFOL (fd, 4), RFIFOL (fd, 8),
- (const char *)RFIFOP (fd, 12), RFIFOW (fd, 2) - 12);
+ mapif_parse_PartyMessage(fd, RFIFOL(fd, 4), RFIFOL(fd, 8),
+ (const char *)RFIFOP(fd, 12), RFIFOW(fd, 2) - 12);
break;
case 0x3028:
- mapif_parse_PartyCheck (fd, RFIFOL (fd, 2), RFIFOL (fd, 6),
- (const char *)RFIFOP (fd, 10));
+ mapif_parse_PartyCheck(fd, RFIFOL(fd, 2), RFIFOL(fd, 6),
+ (const char *)RFIFOP(fd, 10));
break;
default:
return 0;
@@ -691,7 +689,7 @@ int inter_party_parse_frommap (int fd)
}
// サーバーから脱退要求(キャラ削除用)
-int inter_party_leave (int party_id, int account_id)
+int inter_party_leave(int party_id, int account_id)
{
- return mapif_parse_PartyLeave (-1, party_id, account_id);
+ return mapif_parse_PartyLeave(-1, party_id, account_id);
}