diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 9 | ||||
-rw-r--r-- | src/map/guild.c | 55 | ||||
-rw-r--r-- | src/map/pc.c | 18 |
3 files changed, 45 insertions, 37 deletions
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) |