diff options
author | Haru <haru@dotalux.com> | 2016-12-03 06:19:35 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2017-09-17 17:48:16 +0200 |
commit | 20caa41aeae6e49375aeb187c06dc077e330b414 (patch) | |
tree | 9e96d78a78005c979e8204da8dd806fc706c6ceb /src/map/pc.c | |
parent | a681d759cc887e8adccbd30d3b7a7ca355bbda96 (diff) | |
download | hercules-20caa41aeae6e49375aeb187c06dc077e330b414.tar.gz hercules-20caa41aeae6e49375aeb187c06dc077e330b414.tar.bz2 hercules-20caa41aeae6e49375aeb187c06dc077e330b414.tar.xz hercules-20caa41aeae6e49375aeb187c06dc077e330b414.zip |
Differentiate variables that hold a ViewSprite and a Subtype (part 2)
`sd->status.shield` is renamed to `sd->status.look.shield` and only
holds ViewSprite IDs. Its previous other meaning is now transferred to
`sd->has_shield`, of boolean type (to detect the presence of a shield)
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index c30161a0c..a8a715a70 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -895,10 +895,19 @@ int pc_setequipindex(struct map_session_data *sd) } if (sd->status.inventory[i].equip & EQP_HAND_L) { - if (sd->inventory_data[i] != NULL && sd->inventory_data[i]->type == IT_WEAPON) - sd->weapontype2 = sd->inventory_data[i]->subtype; - else + if (sd->inventory_data[i] != NULL) { + if (sd->inventory_data[i]->type == IT_WEAPON) + sd->weapontype2 = sd->inventory_data[i]->subtype; + else + sd->weapontype2 = W_FIST; + if (sd->inventory_data[i]->type == IT_ARMOR) + sd->has_shield = true; + else + sd->has_shield = false; + } else { sd->weapontype2 = W_FIST; + sd->has_shield = false; + } } } } @@ -5947,7 +5956,7 @@ int pc_checkallowskill(struct map_session_data *sd) // Spurt requires bare hands (feet, in fact xD) status_change_end(&sd->bl, SC_STRUP, INVALID_TIMER); - if(sd->status.shield <= 0) { // Skills requiring a shield + if (!sd->has_shield) { // Skills requiring a shield for (i = 0; i < ARRAYLENGTH(scs_list); i++) if(sd->sc.data[scs_list[i]]) status_change_end(&sd->bl, scs_list[i], INVALID_TIMER); @@ -8891,7 +8900,7 @@ int pc_changelook(struct map_session_data *sd,int type,int val) sd->status.clothes_color=val; break; case LOOK_SHIELD: - sd->status.shield=val; + sd->status.look.shield = val; break; case LOOK_SHOES: break; @@ -9772,18 +9781,21 @@ void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int n, (pos & EQP_HAND_L)) { if (id != NULL) { if (id->type == IT_WEAPON) { - sd->status.shield = 0; + sd->has_shield = false; + sd->status.look.shield = 0; sd->weapontype2 = id->subtype; } else if (id->type == IT_ARMOR) { - sd->status.shield = id->view_sprite; + sd->has_shield = true; + sd->status.look.shield = id->view_sprite; sd->weapontype2 = W_FIST; } } else { - sd->status.shield = 0; + sd->has_shield = false; + sd->status.look.shield = 0; sd->weapontype2 = W_FIST; } pc->calcweapontype(sd); - clif->changelook(&sd->bl,LOOK_SHIELD,sd->status.shield); + clif->changelook(&sd->bl, LOOK_SHIELD, sd->status.look.shield); } //Added check to prevent sending the same look on multiple slots -> //causes client to redraw item on top of itself. (suggested by Lupus) @@ -10001,10 +10013,11 @@ void pc_unequipitem_pos(struct map_session_data *sd, int n, int pos) status_change_end(&sd->bl, SC_DANCING, INVALID_TIMER); // Unequipping => stop dancing. } if (pos & EQP_HAND_L) { - sd->status.shield = 0; + sd->has_shield = false; + sd->status.look.shield = 0; sd->weapontype2 = W_FIST; pc->calcweapontype(sd); - clif->changelook(&sd->bl,LOOK_SHIELD,sd->status.shield); + clif->changelook(&sd->bl, LOOK_SHIELD, sd->status.look.shield); } if (pos & EQP_HEAD_LOW && pc->checkequip(sd,EQP_COSTUME_HEAD_LOW) == -1) { sd->status.head_bottom = 0; |