diff options
author | MadCamel <madcamel@gmail.com> | 2010-11-27 21:04:08 -0500 |
---|---|---|
committer | MadCamel <madcamel@gmail.com> | 2010-11-27 21:04:08 -0500 |
commit | 882f5e91d20f6c0c9fda9e1ce7cb3cf39c5c06e7 (patch) | |
tree | b6df7c8a511ac746f3b1427d3b27c5142b75240b | |
parent | 5c3b1b3ed36194a2d0d23169f1b9f3282ab0104a (diff) | |
parent | 6b07d219170dcfefe86facea14037ffeb825f015 (diff) | |
download | tmwa-882f5e91d20f6c0c9fda9e1ce7cb3cf39c5c06e7.tar.gz tmwa-882f5e91d20f6c0c9fda9e1ce7cb3cf39c5c06e7.tar.bz2 tmwa-882f5e91d20f6c0c9fda9e1ce7cb3cf39c5c06e7.tar.xz tmwa-882f5e91d20f6c0c9fda9e1ce7cb3cf39c5c06e7.zip |
Merge branch 'master' of git://gitorious.org/tmw-eathena/mainline
-rw-r--r-- | src/char/int_guild.c | 38 | ||||
-rw-r--r-- | src/map/clif.c | 9 | ||||
-rw-r--r-- | src/map/guild.c | 55 | ||||
-rw-r--r-- | src/map/pc.c | 18 |
4 files changed, 62 insertions, 58 deletions
diff --git a/src/char/int_guild.c b/src/char/int_guild.c index 4b4bfba..49bb238 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -150,7 +150,7 @@ int inter_guild_fromstr (char *str, struct guild *g) &tmp_int[8], &tmp_int[9], tmp_str[0]) < 11) return 1; m->account_id = tmp_int[0]; - m->char_id = tmp_int[1]; + m->char_id = 0 /*tmp_int[1]*/; m->hair = tmp_int[2]; m->hair_color = tmp_int[3]; m->gender = tmp_int[4]; @@ -674,13 +674,12 @@ int guild_check_conflict_sub (void *key, void *data, va_list ap) for (i = 0; i < MAX_GUILD; i++) { - if (g->member[i].account_id == account_id - && g->member[i].char_id == char_id) + if (g->member[i].account_id == account_id) { // 別のギルドに偽の所属データがあるので脱退 printf ("int_guild: guild conflict! %d,%d %d!=%d\n", account_id, char_id, guild_id, g->guild_id); - mapif_parse_GuildLeave (-1, g->guild_id, account_id, char_id, 0, + mapif_parse_GuildLeave (-1, g->guild_id, account_id, 0 /*char_id*/, 0, "**データ競合**"); } } @@ -692,7 +691,7 @@ int guild_check_conflict_sub (void *key, void *data, va_list ap) int guild_check_conflict (int guild_id, int account_id, int char_id) { numdb_foreach (guild_db, guild_check_conflict_sub, guild_id, account_id, - char_id); + 0 /*char_id*/); return 0; } @@ -828,7 +827,7 @@ int mapif_guild_memberadded (int fd, int guild_id, int account_id, WFIFOW (fd, 0) = 0x3832; WFIFOL (fd, 2) = guild_id; WFIFOL (fd, 6) = account_id; - WFIFOL (fd, 10) = char_id; + WFIFOL (fd, 10) = 0 /*char_id*/; WFIFOB (fd, 14) = flag; WFIFOSET (fd, 15); @@ -844,7 +843,7 @@ int mapif_guild_leaved (int guild_id, int account_id, int char_id, int flag, WBUFW (buf, 0) = 0x3834; WBUFL (buf, 2) = guild_id; WBUFL (buf, 6) = account_id; - WBUFL (buf, 10) = char_id; + WBUFL (buf, 10) = 0 /*char_id*/; WBUFB (buf, 14) = flag; memcpy (WBUFP (buf, 15), mes, 40); memcpy (WBUFP (buf, 55), name, 24); @@ -863,7 +862,7 @@ int mapif_guild_memberinfoshort (struct guild *g, int idx) WBUFW (buf, 0) = 0x3835; WBUFL (buf, 2) = g->guild_id; WBUFL (buf, 6) = g->member[idx].account_id; - WBUFL (buf, 10) = g->member[idx].char_id; + WBUFL (buf, 10) = 0 /*g->member[idx].char_id*/; WBUFB (buf, 14) = g->member[idx].online; WBUFW (buf, 15) = g->member[idx].lv; WBUFW (buf, 17) = g->member[idx].class; @@ -925,7 +924,7 @@ int mapif_guild_memberinfochanged (int guild_id, int account_id, int char_id, WBUFW (buf, 2) = len + 18; WBUFL (buf, 4) = guild_id; WBUFL (buf, 8) = account_id; - WBUFL (buf, 12) = char_id; + WBUFL (buf, 12) = 0 /*char_id*/; WBUFW (buf, 16) = type; memcpy (WBUFP (buf, 18), data, len); mapif_sendall (buf, len + 18); @@ -1150,7 +1149,7 @@ int mapif_parse_GuildAddMember (int fd, int guild_id, struct guild_member *m) g = numdb_search (guild_db, guild_id); if (g == NULL) { - mapif_guild_memberadded (fd, guild_id, m->account_id, m->char_id, 1); + mapif_guild_memberadded (fd, guild_id, m->account_id, 0 /*char_id*/, 1); return 0; } @@ -1159,7 +1158,7 @@ int mapif_parse_GuildAddMember (int fd, int guild_id, struct guild_member *m) if (g->member[i].account_id == 0) { memcpy (&g->member[i], m, sizeof (struct guild_member)); - mapif_guild_memberadded (fd, guild_id, m->account_id, m->char_id, + mapif_guild_memberadded (fd, guild_id, m->account_id, 0 /*char_id*/, 0); guild_calcinfo (g); mapif_guild_info (-1, g); @@ -1167,7 +1166,7 @@ int mapif_parse_GuildAddMember (int fd, int guild_id, struct guild_member *m) return 0; } } - mapif_guild_memberadded (fd, guild_id, m->account_id, m->char_id, 1); + mapif_guild_memberadded (fd, guild_id, m->account_id, 0 /*char_id*/, 1); return 0; } @@ -1184,8 +1183,7 @@ int mapif_parse_GuildLeave (int fd, int guild_id, int account_id, int char_id, { for (i = 0; i < MAX_GUILD; i++) { - if (g->member[i].account_id == account_id - && g->member[i].char_id == char_id) + if (g->member[i].account_id == account_id) { // printf("%d %d\n", i, (int)(&g->member[i])); // printf("%d %s\n", i, g->member[i].name); @@ -1209,7 +1207,7 @@ int mapif_parse_GuildLeave (int fd, int guild_id, int account_id, int char_id, memcpy (g->explusion[j].mes, mes, 40); } - mapif_guild_leaved (guild_id, account_id, char_id, flag, + mapif_guild_leaved (guild_id, account_id, 0 /*char_id*/, flag, g->member[i].name, mes); // printf("%d %d\n", i, (int)(&g->member[i])); // printf("%d %s\n", i, (&g->member[i])->name); @@ -1243,8 +1241,7 @@ int mapif_parse_GuildChangeMemberInfoShort (int fd, int guild_id, c = 0; for (i = 0; i < MAX_GUILD; i++) { - if (g->member[i].account_id == account_id - && g->member[i].char_id == char_id) + if (g->member[i].account_id == account_id) { g->member[i].online = online; g->member[i].lv = lv; @@ -1353,8 +1350,7 @@ int mapif_parse_GuildMemberInfoChange (int fd, int guild_id, int account_id, return 0; for (i = 0; i < g->max_member; i++) - if (g->member[i].account_id == account_id - && g->member[i].char_id == char_id) + if (g->member[i].account_id == account_id) break; if (i == g->max_member) { @@ -1704,7 +1700,7 @@ int mapif_parse_GuildCastleDataSave (int fd, int castle_id, int index, // ギルドチェック要求 int mapif_parse_GuildCheck (int fd, int guild_id, int account_id, int char_id) { - return guild_check_conflict (guild_id, account_id, char_id); + return guild_check_conflict (guild_id, account_id, 0 /*char_id*/); } // map server からの通信 @@ -1812,6 +1808,6 @@ int inter_guild_mapif_init (int fd) // サーバーから脱退要求(キャラ削除用) int inter_guild_leave (int guild_id, int account_id, int char_id) { - return mapif_parse_GuildLeave (-1, guild_id, account_id, char_id, 0, + return mapif_parse_GuildLeave (-1, guild_id, account_id, 0 /*char_id*/, 0, "**サーバー命令**"); } diff --git a/src/map/clif.c b/src/map/clif.c index 1a1acf9..2eeee35 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -5806,7 +5806,7 @@ int clif_guild_memberlogin_notice (struct guild *g, int idx, int flag) WBUFW (buf, 0) = 0x16d; WBUFL (buf, 2) = g->member[idx].account_id; - WBUFL (buf, 6) = g->member[idx].char_id; + WBUFL (buf, 6) = 0; WBUFL (buf, 10) = flag; if (g->member[idx].sd == NULL) { @@ -5996,7 +5996,7 @@ int clif_guild_memberlist (struct map_session_data *sd) if (m->account_id == 0) continue; WFIFOL (fd, c * 104 + 4) = m->account_id; - WFIFOL (fd, c * 104 + 8) = m->char_id; + WFIFOL (fd, c * 104 + 8) = 0; WFIFOW (fd, c * 104 + 12) = m->hair; WFIFOW (fd, c * 104 + 14) = m->hair_color; WFIFOW (fd, c * 104 + 16) = m->gender; @@ -6106,7 +6106,7 @@ int clif_guild_memberpositionchanged (struct guild *g, int idx) WBUFW (buf, 0) = 0x156; WBUFW (buf, 2) = 16; WBUFL (buf, 4) = g->member[idx].account_id; - WBUFL (buf, 8) = g->member[idx].char_id; + WBUFL (buf, 8) = 0; WBUFL (buf, 12) = g->member[idx].position; if ((sd = guild_getavailablesd (g)) != NULL) clif_send (buf, WBUFW (buf, 2), &sd->bl, GUILD); @@ -7079,8 +7079,7 @@ void clif_parse_GetCharNameRequest (int fd, struct map_session_data *sd) int i, ps = -1; for (i = 0; i < g->max_member; i++) { - if (g->member[i].account_id == ssd->status.account_id && - g->member[i].char_id == ssd->status.char_id) + if (g->member[i].account_id == ssd->status.account_id) ps = g->member[i].position; } if (ps >= 0 && ps < MAX_GUILDPOSITION) diff --git a/src/map/guild.c b/src/map/guild.c index db92dd3..edee837 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -230,8 +230,7 @@ int guild_getindex (struct guild *g, int account_id, int char_id) if (g == NULL) return -1; for (i = 0; i < g->max_member; i++) - if (g->member[i].account_id == account_id && - g->member[i].char_id == char_id) + if (g->member[i].account_id == account_id) return i; return -1; } @@ -246,8 +245,7 @@ int guild_getposition (struct map_session_data *sd, struct guild *g) if (g == NULL && (g = guild_search (sd->status.guild_id)) == NULL) return -1; for (i = 0; i < g->max_member; i++) - if (g->member[i].account_id == sd->status.account_id && - g->member[i].char_id == sd->status.char_id) + if (g->member[i].account_id == sd->status.account_id) return g->member[i].position; return -1; } @@ -259,7 +257,7 @@ void guild_makemember (struct guild_member *m, struct map_session_data *sd) memset (m, 0, sizeof (struct guild_member)); m->account_id = sd->status.account_id; - m->char_id = sd->status.char_id; + m->char_id = 0; m->hair = sd->status.hair; m->hair_color = sd->status.hair_color; m->gender = sd->sex; @@ -279,7 +277,7 @@ int guild_check_conflict (struct map_session_data *sd) nullpo_retr (0, sd); intif_guild_checkconflict (sd->status.guild_id, - sd->status.account_id, sd->status.char_id); + sd->status.account_id, 0 /*char_id*/); return 0; } @@ -298,11 +296,11 @@ int guild_payexp_timer_sub (void *key, void *data, va_list ap) if (*delp >= GUILD_PAYEXP_LIST || (g = guild_search (c->guild_id)) == NULL) return 0; - if ((i = guild_getindex (g, c->account_id, c->char_id)) < 0) + if ((i = guild_getindex (g, c->account_id, 0 /*c->char_id*/)) < 0) return 0; g->member[i].exp += c->exp; - intif_guild_change_memberinfo (g->guild_id, c->account_id, c->char_id, + intif_guild_change_memberinfo (g->guild_id, c->account_id, 0 /*char_id*/, GMI_EXP, &g->member[i].exp, sizeof (g->member[i].exp)); c->exp = 0; @@ -451,8 +449,7 @@ int guild_check_member (const struct guild *g) int j, f = 1; for (j = 0; j < MAX_GUILD; j++) { // データがあるか - if (g->member[j].account_id == sd->status.account_id && - g->member[j].char_id == sd->status.char_id) + if (g->member[j].account_id == sd->status.account_id) f = 0; } if (f) @@ -514,7 +511,6 @@ int guild_recv_info (struct guild *sg) { struct map_session_data *sd = map_id2sd (g->member[i].account_id); g->member[i].sd = (sd != NULL && - sd->status.char_id == g->member[i].char_id && sd->status.guild_id == g->guild_id) ? sd : NULL; m++; @@ -679,7 +675,7 @@ int guild_member_added (int guild_id, int account_id, int char_id, int flag) if (battle_config.error_log) printf ("guild: member added error %d is not online\n", account_id); - intif_guild_leave (guild_id, account_id, char_id, 0, "**登録失敗**"); + intif_guild_leave (guild_id, account_id, 0 /*char_id*/, 0, "**登録失敗**"); return 0; } sd->guild_invite = 0; @@ -722,13 +718,12 @@ int guild_leave (struct map_session_data *sd, int guild_id, return 0; if (sd->status.account_id != account_id || - sd->status.char_id != char_id || sd->status.guild_id != guild_id) + sd->status.guild_id != guild_id) return 0; for (i = 0; i < g->max_member; i++) { // 所属しているか - if (g->member[i].account_id == sd->status.account_id && - g->member[i].char_id == sd->status.char_id) + if (g->member[i].account_id == sd->status.account_id) { intif_guild_leave (g->guild_id, sd->status.account_id, sd->status.char_id, 0, mes); @@ -761,10 +756,9 @@ int guild_explusion (struct map_session_data *sd, int guild_id, for (i = 0; i < g->max_member; i++) { // 所属しているか - if (g->member[i].account_id == account_id && - g->member[i].char_id == char_id) + if (g->member[i].account_id == account_id) { - intif_guild_leave (g->guild_id, account_id, char_id, 1, mes); + intif_guild_leave (g->guild_id, account_id, 0 /*char_id*/, 1, mes); return 0; } } @@ -783,8 +777,7 @@ int guild_member_leaved (int guild_id, int account_id, int char_id, int flag, { int i; for (i = 0; i < g->max_member; i++) - if (g->member[i].account_id == account_id && - g->member[i].char_id == char_id) + if (g->member[i].account_id == account_id) { struct map_session_data *sd2 = sd; if (sd2 == NULL) @@ -833,14 +826,14 @@ int guild_send_memberinfoshort (struct map_session_data *sd, int online) return 0; intif_guild_memberinfoshort (g->guild_id, - sd->status.account_id, sd->status.char_id, + sd->status.account_id, 0 /*char_id*/, online, sd->status.base_level, sd->status.class); if (!online) { // ログアウトするならsdをクリアして終了 int i = - guild_getindex (g, sd->status.account_id, sd->status.char_id); + guild_getindex (g, sd->status.account_id, 0 /*char_id*/); if (i >= 0) g->member[i].sd = NULL; return 0; @@ -878,7 +871,7 @@ int guild_recv_memberinfoshort (int guild_id, int account_id, int char_id, for (i = 0, alv = 0, c = 0, om = 0; i < g->max_member; i++) { struct guild_member *m = &g->member[i]; - if (m->account_id == account_id && m->char_id == char_id) + if (m->account_id == account_id) { oldonline = m->online; m->online = online; @@ -911,7 +904,6 @@ int guild_recv_memberinfoshort (int guild_id, int account_id, int char_id, { // sd再設定 struct map_session_data *sd = map_id2sd (g->member[i].account_id); g->member[i].sd = (sd != NULL && - sd->status.char_id == g->member[i].char_id && sd->status.guild_id == guild_id) ? sd : NULL; } @@ -946,7 +938,7 @@ int guild_recv_message (int guild_id, int account_id, char *mes, int len) int guild_change_memberposition (int guild_id, int account_id, int char_id, int idx) { - return intif_guild_change_memberinfo (guild_id, account_id, char_id, + return intif_guild_change_memberinfo (guild_id, account_id, 0 /*char_id*/, GMI_POSITION, &idx, sizeof (idx)); } @@ -1100,16 +1092,16 @@ int guild_payexp (struct map_session_data *sd, int exp) if ((exp2 = exp * per / 100) <= 0) return 0; - if ((c = numdb_search (guild_expcache_db, sd->status.char_id)) == NULL) + if ((c = numdb_search (guild_expcache_db, sd->status.account_id /*char_id*/)) == NULL) { c = (struct guild_expcache *) aCalloc (1, sizeof (struct guild_expcache)); c->guild_id = sd->status.guild_id; c->account_id = sd->status.account_id; - c->char_id = sd->status.char_id; + c->char_id = 0; c->exp = exp2; - numdb_insert (guild_expcache_db, c->char_id, c); + numdb_insert (guild_expcache_db, c->account_id /*char_id*/, c); } else { @@ -1332,9 +1324,9 @@ int guild_delalliance (struct map_session_data *sd, int guild_id, int flag) } // ギルド敵対 -int guild_opposition (struct map_session_data *sd, int char_id) +int guild_opposition (struct map_session_data *sd, int account_id /*char_id*/) { - struct map_session_data *tsd = map_id2sd (char_id); + struct map_session_data *tsd = map_id2sd (account_id /*char_id*/); struct guild *g; int i, ps; @@ -1528,8 +1520,7 @@ int guild_break (struct map_session_data *sd, char *name) for (i = 0; i < g->max_member; i++) { if (g->member[i].account_id > 0 - && (g->member[i].account_id != sd->status.account_id - || g->member[i].char_id != sd->status.char_id)) + && (g->member[i].account_id != sd->status.account_id)) break; } if (i < g->max_member) diff --git a/src/map/pc.c b/src/map/pc.c index 2b5dc3e..11cd864 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3808,8 +3808,14 @@ int pc_putitemtocart (struct map_session_data *sd, int idx, int amount) struct item *item_data; nullpo_retr (0, sd); + + if (idx < 0 || idx >= MAX_INVENTORY) + return 1; + nullpo_retr (0, item_data = &sd->status.inventory[idx]); + if (!pc_iscarton (sd)) + return 1; if (item_data->nameid == 0 || item_data->amount < amount) return 1; if (pc_cart_additem (sd, item_data, amount) == 0) @@ -3827,8 +3833,14 @@ int pc_cartitem_amount (struct map_session_data *sd, int idx, int amount) struct item *item_data; nullpo_retr (-1, sd); + + if (idx < 0 || idx >= MAX_CART) + return -1; + nullpo_retr (-1, item_data = &sd->status.cart[idx]); + if (!pc_iscarton (sd)) + return -1; if (item_data->nameid == 0 || !item_data->amount) return -1; return item_data->amount - amount; @@ -3845,8 +3857,14 @@ int pc_getitemfromcart (struct map_session_data *sd, int idx, int amount) int flag; nullpo_retr (0, sd); + + if (idx < 0 || idx >= MAX_CART) + return 1; + nullpo_retr (0, item_data = &sd->status.cart[idx]); + if (!pc_iscarton (sd)) + return 1; if (item_data->nameid == 0 || item_data->amount < amount) return 1; if ((flag = pc_additem (sd, item_data, amount)) == 0) |