summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-04-27 10:36:35 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-04-27 14:09:22 -0700
commit7a9cee6ac24f5cfaaa73c97e5fef733eadba09ad (patch)
tree77120b9a83ceda3fa845cad457199de62a0a94b7
parentd18f5bdb682a1d9c6e3a191926bfd46d36e813c1 (diff)
downloadtmwa-7a9cee6ac24f5cfaaa73c97e5fef733eadba09ad.tar.gz
tmwa-7a9cee6ac24f5cfaaa73c97e5fef733eadba09ad.tar.bz2
tmwa-7a9cee6ac24f5cfaaa73c97e5fef733eadba09ad.tar.xz
tmwa-7a9cee6ac24f5cfaaa73c97e5fef733eadba09ad.zip
Enumize ItemLook
-rw-r--r--src/char/char.cpp6
-rw-r--r--src/common/mmo.hpp25
-rw-r--r--src/map/battle.cpp19
-rw-r--r--src/map/chrif.cpp2
-rw-r--r--src/map/clif.cpp2
-rw-r--r--src/map/itemdb.cpp2
-rw-r--r--src/map/itemdb.hpp4
-rw-r--r--src/map/magic-stmt.cpp3
-rw-r--r--src/map/map.hpp2
-rw-r--r--src/map/npc.cpp1
-rw-r--r--src/map/pc.cpp132
-rw-r--r--src/map/script.cpp2
12 files changed, 124 insertions, 76 deletions
diff --git a/src/char/char.cpp b/src/char/char.cpp
index a03687d..86a25c3 100644
--- a/src/char/char.cpp
+++ b/src/char/char.cpp
@@ -817,7 +817,7 @@ int make_new_char(int fd, const uint8_t *dat)
char_dat[i].inventory[1].equip = EPOS::MISC1;
char_dat[i].inventory[1].identify = 1;
char_dat[i].inventory[1].broken = 0;
- char_dat[i].weapon = 1;
+ char_dat[i].weapon = ItemLook::BLADE;
char_dat[i].shield = 0;
char_dat[i].head_top = 0;
char_dat[i].head_mid = 0;
@@ -1425,7 +1425,7 @@ void parse_tologin(int fd)
&& bool(char_dat[i].inventory[j].equip))
char_dat[i].inventory[j].equip = EPOS::ZERO;
}
- char_dat[i].weapon = 0;
+ char_dat[i].weapon = ItemLook::NONE;
char_dat[i].shield = 0;
char_dat[i].head_top = 0;
char_dat[i].head_mid = 0;
@@ -1553,7 +1553,7 @@ void parse_tologin(int fd)
FIX(c->inventory[j].nameid);
for (j = 0; j < MAX_CART; j++)
FIX(c->cart[j].nameid);
- FIX(c->weapon);
+ // FIX(c->weapon);
FIX(c->shield);
FIX(c->head_top);
FIX(c->head_mid);
diff --git a/src/common/mmo.hpp b/src/common/mmo.hpp
index 34f3047..32d4285 100644
--- a/src/common/mmo.hpp
+++ b/src/common/mmo.hpp
@@ -131,6 +131,28 @@ constexpr ATTR ATTRs[6] =
ATTR::LUK,
};
+enum class ItemLook : uint16_t
+{
+ NONE = 0,
+ BLADE = 1, // or some other common weapons
+ _2,
+ SETZER_AND_SCYTHE = 3,
+ _6,
+ STAFF = 10,
+ BOW = 11,
+ _13 = 13,
+ _14 = 14,
+ _16 = 16,
+ SINGLE_HANDED_COUNT = 17,
+
+ DUAL_BLADE = 0x11,
+ DUAL_2 = 0x12,
+ DUAL_6 = 0x13,
+ DUAL_12 = 0x14,
+ DUAL_16 = 0x15,
+ DUAL_26 = 0x16,
+};
+
struct mmo_charstatus
{
int char_id;
@@ -147,7 +169,8 @@ struct mmo_charstatus
short hair, hair_color, clothes_color;
int party_id;
- short weapon, shield;
+ ItemLook weapon;
+ short shield;
short head_top, head_mid, head_bottom;
char name[24];
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index dad78cb..97edeb3 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -1422,7 +1422,7 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
atkmin_ * (80 +
sd->inventory_data[sd->equip_index[EQUIP::SHIELD]]->wlv * 20) /
100;
- if (sd->status.weapon == 11)
+ if (sd->status.weapon == ItemLook::BOW)
{ //武器が弓矢の場合
atkmin = watk * ((atkmin < watk) ? atkmin : watk) / 100; //弓用最低ATK計算
flag = (flag & ~BF::RANGEMASK) | BF::LONG; //遠距離攻撃フラグを有効
@@ -1455,7 +1455,7 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
if (sd->state.arrow_atk)
cri += sd->arrow_cri;
- if (sd->status.weapon == 16)
+ if (sd->status.weapon == ItemLook::_16)
// カタールの場合、クリティカルを倍に
cri <<= 1;
cri -= battle_get_luk(target) * 3;
@@ -1645,13 +1645,14 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
// pc_calcstatus()でデータを入力しています
//左手のみ武器装備
- if (sd->weapontype1 == 0 && sd->weapontype2 > 0)
+ if (sd->weapontype1 == ItemLook::NONE
+ && sd->weapontype2 != ItemLook::NONE)
{
damage = damage2;
damage2 = 0;
}
// 右手、左手修練の適用
- if (sd->status.weapon > 16)
+ if (sd->status.weapon >= ItemLook::SINGLE_HANDED_COUNT)
{ // 二刀流か?
int dmg = damage, dmg2 = damage2;
// 右手修練(60% 〜 100%) 右手全般
@@ -1674,7 +1675,7 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
type = DamageType::DOUBLED;
}
- if (sd->status.weapon == 16)
+ if (sd->status.weapon == ItemLook::_16)
{
// カタール追撃ダメージ
damage2 = damage * 1 / 100;
@@ -1982,7 +1983,7 @@ ATK battle_weapon_attack(struct block_list *src, struct block_list *target,
battle_check_range(src, target, 0))
{
// 攻撃対象となりうるので攻撃
- if (sd && sd->status.weapon == 11)
+ if (sd && sd->status.weapon == ItemLook::BOW)
{
if (sd->equip_index[EQUIP::ARROW] >= 0)
{
@@ -2019,8 +2020,10 @@ ATK battle_weapon_attack(struct block_list *src, struct block_list *target,
{
clif_damage(src, target, tick, wd.amotion, wd.dmotion,
wd.damage, wd.div_, wd.type, wd.damage2);
- //二刀流左手とカタール追撃のミス表示(無理やり〜)
- if (sd && sd->status.weapon >= 16 && wd.damage2 == 0)
+ if (sd
+ && (sd->status.weapon == ItemLook::_16
+ || sd->status.weapon >= ItemLook::SINGLE_HANDED_COUNT)
+ && wd.damage2 == 0)
clif_damage(src, target, tick + std::chrono::milliseconds(10),
wd.amotion, wd.dmotion, 0, 1, DamageType::NORMAL, 0);
}
diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp
index 8926780..6742f88 100644
--- a/src/map/chrif.cpp
+++ b/src/map/chrif.cpp
@@ -961,7 +961,7 @@ void ladmin_itemfrob_c2(struct block_list *bl, int source_id, int dest_id)
IFIX(pc->status.inventory[j].nameid);
for (j = 0; j < MAX_CART; j++)
IFIX(pc->status.cart[j].nameid);
- IFIX(pc->status.weapon);
+ // IFIX(pc->status.weapon);
IFIX(pc->status.shield);
IFIX(pc->status.head_top);
IFIX(pc->status.head_mid);
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index f009a23..838c1f4 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -3829,7 +3829,7 @@ void clif_parse_LoadEndAck(int, struct map_session_data *sd)
sd->state.connect_new = 0;
// view equipment item
- clif_changelook(&sd->bl, LOOK::WEAPON, 0);
+ clif_changelook(&sd->bl, LOOK::WEAPON, static_cast<uint16_t>(ItemLook::NONE));
if (battle_config.save_clothcolor == 1 && sd->status.clothes_color > 0)
clif_changelook(&sd->bl, LOOK::CLOTHES_COLOR,
sd->status.clothes_color);
diff --git a/src/map/itemdb.cpp b/src/map/itemdb.cpp
index 115893b..f60dc53 100644
--- a/src/map/itemdb.cpp
+++ b/src/map/itemdb.cpp
@@ -233,7 +233,7 @@ int itemdb_readdb(void)
id->equip = EPOS(atoi(str[13]));
id->wlv = atoi(str[14]);
id->elv = atoi(str[15]);
- id->look = atoi(str[16]);
+ id->look = static_cast<ItemLook>(atoi(str[16]));
id->flag.available = 1;
id->flag.value_notdc = 0;
id->flag.value_notoc = 0;
diff --git a/src/map/itemdb.hpp b/src/map/itemdb.hpp
index 056213e..279c7a8 100644
--- a/src/map/itemdb.hpp
+++ b/src/map/itemdb.hpp
@@ -23,7 +23,7 @@ struct item_data
int range;
int magic_bonus;
int slot;
- int look;
+ ItemLook look;
int elv;
int wlv;
int refine;
@@ -57,7 +57,7 @@ ItemType itemdb_type(int n)
return itemdb_search(n)->type;
}
inline
-int itemdb_look(int n)
+ItemLook itemdb_look(int n)
{
return itemdb_search(n)->look;
}
diff --git a/src/map/magic-stmt.cpp b/src/map/magic-stmt.cpp
index 0bef054..f132ca6 100644
--- a/src/map/magic-stmt.cpp
+++ b/src/map/magic-stmt.cpp
@@ -151,7 +151,8 @@ void char_set_weapon_icon(character_t *subject, int count,
else
{
/* Set it to `normal' */
- clif_changelook(&subject->bl, LOOK::WEAPON, subject->status.weapon);
+ clif_changelook(&subject->bl, LOOK::WEAPON,
+ static_cast<uint16_t>(subject->status.weapon));
}
}
diff --git a/src/map/map.hpp b/src/map/map.hpp
index caffab0..374282d 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -180,7 +180,7 @@ struct map_session_data
interval_t hp_sub, sp_sub;
interval_t inchealhptick, inchealsptick;
- short weapontype1, weapontype2;
+ ItemLook weapontype1, weapontype2;
earray<int, ATTR, ATTR::COUNT> paramb, paramc, parame, paramcard;
int hit, flee, flee2;
interval_t aspd, amotion, dmotion;
diff --git a/src/map/npc.cpp b/src/map/npc.cpp
index fb4f79e..c08a0e7 100644
--- a/src/map/npc.cpp
+++ b/src/map/npc.cpp
@@ -740,6 +740,7 @@ int npc_buysellsel(struct map_session_data *sd, int id, int type)
*
*------------------------------------------
*/
+// TODO enumify return type
int npc_buylist(struct map_session_data *sd, int n,
const uint16_t *item_list)
{
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 772c673..255dc90 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -82,8 +82,8 @@ int sp_coefficient_0 = 100;
// coefficients for each weapon type
// (not all used)
static //const
-interval_t aspd_base_0[17] =
-{
+earray<interval_t, ItemLook, ItemLook::SINGLE_HANDED_COUNT> aspd_base_0 //=
+{{
std::chrono::milliseconds(650),
std::chrono::milliseconds(700),
std::chrono::milliseconds(750),
@@ -101,7 +101,7 @@ std::chrono::milliseconds(2000),
std::chrono::milliseconds(2000),
std::chrono::milliseconds(2000),
std::chrono::milliseconds(2000),
-};
+}};
static const
int exp_table_0[MAX_LEVEL] =
{
@@ -501,22 +501,38 @@ int pc_calcweapontype(struct map_session_data *sd)
{
nullpo_ret(sd);
- if (sd->weapontype1 != 0 && sd->weapontype2 == 0)
+ if (sd->weapontype1 != ItemLook::NONE
+ && sd->weapontype2 == ItemLook::NONE)
sd->status.weapon = sd->weapontype1;
- if (sd->weapontype1 == 0 && sd->weapontype2 != 0) // 左手武器 Only
+ if (sd->weapontype1 == ItemLook::NONE
+ && sd->weapontype2 != ItemLook::NONE)
sd->status.weapon = sd->weapontype2;
- else if (sd->weapontype1 == 1 && sd->weapontype2 == 1) // 双短剣
- sd->status.weapon = 0x11;
- else if (sd->weapontype1 == 2 && sd->weapontype2 == 2) // 双単手剣
- sd->status.weapon = 0x12;
- else if (sd->weapontype1 == 6 && sd->weapontype2 == 6) // 双単手斧
- sd->status.weapon = 0x13;
- else if ((sd->weapontype1 == 1 && sd->weapontype2 == 2) || (sd->weapontype1 == 2 && sd->weapontype2 == 1)) // 短剣 - 単手剣
- sd->status.weapon = 0x14;
- else if ((sd->weapontype1 == 1 && sd->weapontype2 == 6) || (sd->weapontype1 == 6 && sd->weapontype2 == 1)) // 短剣 - 斧
- sd->status.weapon = 0x15;
- else if ((sd->weapontype1 == 2 && sd->weapontype2 == 6) || (sd->weapontype1 == 6 && sd->weapontype2 == 2)) // 単手剣 - 斧
- sd->status.weapon = 0x16;
+ else if (sd->weapontype1 == ItemLook::BLADE
+ && sd->weapontype2 == ItemLook::BLADE)
+ sd->status.weapon = ItemLook::DUAL_BLADE;
+ else if (sd->weapontype1 == ItemLook::_2
+ && sd->weapontype2 == ItemLook::_2)
+ sd->status.weapon = ItemLook::DUAL_2;
+ else if (sd->weapontype1 == ItemLook::_6
+ && sd->weapontype2 == ItemLook::_6)
+ sd->status.weapon = ItemLook::DUAL_6;
+ else if ((sd->weapontype1 == ItemLook::BLADE
+ && sd->weapontype2 == ItemLook::_2)
+ || (sd->weapontype1 == ItemLook::_2
+ && sd->weapontype2 == ItemLook::BLADE))
+ sd->status.weapon = ItemLook::DUAL_12;
+ else if (
+ (sd->weapontype1 == ItemLook::BLADE
+ && sd->weapontype2 == ItemLook::_6)
+ || (sd->weapontype1 == ItemLook::_6
+ && sd->weapontype2 == ItemLook::BLADE))
+ sd->status.weapon = ItemLook::DUAL_16;
+ else if (
+ (sd->weapontype1 == ItemLook::_2
+ && sd->weapontype2 == ItemLook::_6)
+ || (sd->weapontype1 == ItemLook::_6
+ && sd->weapontype2 == ItemLook::_2))
+ sd->status.weapon = ItemLook::DUAL_26;
else
sd->status.weapon = sd->weapontype1;
@@ -545,7 +561,7 @@ int pc_setequipindex(struct map_session_data *sd)
if (sd->inventory_data[i])
sd->weapontype1 = sd->inventory_data[i]->look;
else
- sd->weapontype1 = 0;
+ sd->weapontype1 = ItemLook::NONE;
}
if (bool(sd->status.inventory[i].equip & EPOS::SHIELD))
{
@@ -556,13 +572,13 @@ int pc_setequipindex(struct map_session_data *sd)
if (sd->status.inventory[i].equip == EPOS::SHIELD)
sd->weapontype2 = sd->inventory_data[i]->look;
else
- sd->weapontype2 = 0;
+ sd->weapontype2 = ItemLook::NONE;
}
else
- sd->weapontype2 = 0;
+ sd->weapontype2 = ItemLook::NONE;
}
else
- sd->weapontype2 = 0;
+ sd->weapontype2 = ItemLook::NONE;
}
}
}
@@ -639,7 +655,7 @@ int pc_authok(int id, int login_id2, TimeT connect_until_time,
sd->state.connect_new = 1;
sd->bl.prev = sd->bl.next = NULL;
- sd->weapontype1 = sd->weapontype2 = 0;
+ sd->weapontype1 = sd->weapontype2 = ItemLook::NONE;
sd->speed = DEFAULT_WALK_SPEED;
sd->state.dead_sit = 0;
sd->dir = DIR::S;
@@ -879,9 +895,10 @@ void pc_set_weapon_look(struct map_session_data *sd)
{
if (sd->attack_spell_override)
clif_changelook(&sd->bl, LOOK::WEAPON,
- sd->attack_spell_look_override);
+ sd->attack_spell_look_override);
else
- clif_changelook(&sd->bl, LOOK::WEAPON, sd->status.weapon);
+ clif_changelook(&sd->bl, LOOK::WEAPON,
+ static_cast<uint16_t>(sd->status.weapon));
}
/*==========================================
@@ -1221,7 +1238,7 @@ int pc_calcstatus(struct map_session_data *sd, int first)
sd->attackrange_ = 1;
if (sd->attackrange < sd->attackrange_)
sd->attackrange = sd->attackrange_;
- if (sd->status.weapon == 11)
+ if (sd->status.weapon == ItemLook::BOW)
sd->attackrange += sd->arrow_range;
sd->double_rate += sd->double_add_rate;
sd->perfect_hit += sd->perfect_hit_add;
@@ -1238,8 +1255,9 @@ int pc_calcstatus(struct map_session_data *sd, int first)
for (ATTR attr : ATTRs)
sd->paramc[attr] = max(0, sd->status.attrs[attr] + sd->paramb[attr] + sd->parame[attr]);
- if (sd->status.weapon == 11 || sd->status.weapon == 13
- || sd->status.weapon == 14)
+ if (sd->status.weapon == ItemLook::BOW
+ || sd->status.weapon == ItemLook::_13
+ || sd->status.weapon == ItemLook::_14)
{
str = sd->paramc[ATTR::DEX];
dex = sd->paramc[ATTR::STR];
@@ -1328,7 +1346,7 @@ int pc_calcstatus(struct map_session_data *sd, int first)
sd->mdef2 = 1;
// 二刀流 ASPD 修正
- if (sd->status.weapon <= 16)
+ if (sd->status.weapon < ItemLook::SINGLE_HANDED_COUNT)
sd->aspd += aspd_base_0[sd->status.weapon]
- (sd->paramc[ATTR::AGI] * 4 + sd->paramc[ATTR::DEX])
* aspd_base_0[sd->status.weapon] / 1000;
@@ -2890,7 +2908,7 @@ void pc_attack_timer(TimerData *, tick_t tick, int id)
{
dist = distance(sd->bl.x, sd->bl.y, bl->x, bl->y);
range = sd->attackrange;
- if (sd->status.weapon != 11)
+ if (sd->status.weapon != ItemLook::BOW)
range++;
if (dist > range)
{ // 届 かないので移動
@@ -4128,7 +4146,7 @@ int pc_changelook(struct map_session_data *sd, LOOK type, int val)
sd->status.hair = val;
break;
case LOOK::WEAPON:
- sd->status.weapon = val;
+ sd->status.weapon = static_cast<ItemLook>(static_cast<uint16_t>(val));
break;
case LOOK::HEAD_BOTTOM:
sd->status.head_bottom = val;
@@ -4549,7 +4567,7 @@ int pc_signal_advanced_equipment_change(struct map_session_data *sd, int n)
int pc_equipitem(struct map_session_data *sd, int n, EPOS)
{
- int nameid, arrow, view;
+ int nameid;
struct item_data *id;
//ソス]ソスソスソスソスソス{ソスqソスフ場合ソスフ鯉ソスソスフ職ソスニゑソスソスZソスoソスソスソスソス
@@ -4563,6 +4581,8 @@ int pc_equipitem(struct map_session_data *sd, int n, EPOS)
nameid = sd->status.inventory[n].nameid;
id = sd->inventory_data[n];
+ if (!id) // can't actually happen - the only caller checks this.
+ return 0;
EPOS pos = pc_equippoint(sd, n);
if (battle_config.battle_log)
@@ -4588,9 +4608,6 @@ int pc_equipitem(struct map_session_data *sd, int n, EPOS)
pos = (epor == EPOS::CAPE ? EPOS::MISC2 : EPOS::CAPE);
}
-#warning "TODO: make this code do what it's supposed to do, instead of what it does"
- // https://trac.paradoxsystems.net/changeset/7550/trunk/src/map/pc.c
- arrow = pc_search_inventory(sd, pc_checkequip(sd, EPOS::LEGS | EPOS::CAPE)); // Added by RoVeRT
for (EQUIP i : EQUIPs)
{
if (bool(pos & equip_pos[i]))
@@ -4620,20 +4637,24 @@ int pc_equipitem(struct map_session_data *sd, int n, EPOS)
}
sd->status.inventory[n].equip = pos;
+ int view_i = 0;
+ ItemLook view_l = ItemLook::NONE;
+ // TODO: This is ugly.
if (sd->inventory_data[n])
{
- view = sd->inventory_data[n]->look;
- if (view == 0)
- view = sd->inventory_data[n]->nameid;
- }
- else
- {
- view = 0;
+ bool look_not_weapon = sd->inventory_data[n]->look == ItemLook::NONE;
+ bool equip_is_weapon = bool(sd->status.inventory[n].equip & EPOS::WEAPON);
+ assert (look_not_weapon != equip_is_weapon);
+
+ if (look_not_weapon)
+ view_i = sd->inventory_data[n]->nameid;
+ else
+ view_l = sd->inventory_data[n]->look;
}
if (bool(sd->status.inventory[n].equip & EPOS::WEAPON))
{
- sd->weapontype1 = view;
+ sd->weapontype1 = view_l;
pc_calcweapontype(sd);
pc_set_weapon_look(sd);
}
@@ -4645,41 +4666,39 @@ int pc_equipitem(struct map_session_data *sd, int n, EPOS)
{
sd->status.shield = 0;
if (sd->status.inventory[n].equip == EPOS::SHIELD)
- sd->weapontype2 = view;
+ sd->weapontype2 = view_l;
}
else if (sd->inventory_data[n]->type == ItemType::ARMOR)
{
- sd->status.shield = view;
- sd->weapontype2 = 0;
+ sd->status.shield = view_i;
+ sd->weapontype2 = ItemLook::NONE;
}
}
else
- sd->status.shield = sd->weapontype2 = 0;
+ {
+ sd->status.shield = 0;
+ sd->weapontype2 = ItemLook::NONE;
+ }
pc_calcweapontype(sd);
clif_changelook(&sd->bl, LOOK::SHIELD, sd->status.shield);
}
if (bool(sd->status.inventory[n].equip & EPOS::LEGS))
{
- sd->status.head_bottom = view;
+ sd->status.head_bottom = view_i;
clif_changelook(&sd->bl, LOOK::HEAD_BOTTOM, sd->status.head_bottom);
}
if (bool(sd->status.inventory[n].equip & EPOS::HAT))
{
- sd->status.head_top = view;
+ sd->status.head_top = view_i;
clif_changelook(&sd->bl, LOOK::HEAD_TOP, sd->status.head_top);
}
if (bool(sd->status.inventory[n].equip & EPOS::TORSO))
{
- sd->status.head_mid = view;
+ sd->status.head_mid = view_i;
clif_changelook(&sd->bl, LOOK::HEAD_MID, sd->status.head_mid);
}
pc_signal_advanced_equipment_change(sd, n);
- if (itemdb_look(sd->status.inventory[n].nameid) == 11 && arrow)
- { // Added by RoVeRT
- clif_arrowequip(sd, arrow);
- sd->status.inventory[arrow].equip = EPOS::ARROW;
- }
pc_calcstatus(sd, 0);
return 0;
@@ -4708,14 +4727,15 @@ int pc_unequipitem(struct map_session_data *sd, int n, CalcStatus type)
}
if (bool(sd->status.inventory[n].equip & EPOS::WEAPON))
{
- sd->weapontype1 = 0;
+ sd->weapontype1 = ItemLook::NONE;
sd->status.weapon = sd->weapontype2;
pc_calcweapontype(sd);
pc_set_weapon_look(sd);
}
if (bool(sd->status.inventory[n].equip & EPOS::SHIELD))
{
- sd->status.shield = sd->weapontype2 = 0;
+ sd->status.shield = 0;
+ sd->weapontype2 = ItemLook::NONE;
pc_calcweapontype(sd);
clif_changelook(&sd->bl, LOOK::SHIELD, sd->status.shield);
}
diff --git a/src/map/script.cpp b/src/map/script.cpp
index 55c7d42..a76563f 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -4144,7 +4144,7 @@ void builtin_getlook(ScriptState *st)
val = sd->status.hair;
break;
case LOOK::WEAPON: //2
- val = sd->status.weapon;
+ val = static_cast<uint16_t>(sd->status.weapon);
break;
case LOOK::HEAD_BOTTOM: //3
val = sd->status.head_bottom;