From 34807ca9fccc7425573256645024722571ef4442 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Thu, 26 Jun 2014 10:27:47 -0700 Subject: specialize inventory/storage indices --- src/map/battle.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/map/battle.cpp') diff --git a/src/map/battle.cpp b/src/map/battle.cpp index 99252e3..a653cac 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -1327,9 +1327,9 @@ int battle_is_unarmed(dumb_ptr bl) { dumb_ptr sd = bl->is_player(); - int sidx = sd->equip_index_maybe[EQUIP::SHIELD]; - int widx = sd->equip_index_maybe[EQUIP::WEAPON]; - return sidx == -1 && widx == -1; + IOff0 sidx = sd->equip_index_maybe[EQUIP::SHIELD]; + IOff0 widx = sd->equip_index_maybe[EQUIP::WEAPON]; + return !sidx.ok() && !widx.ok(); } else return 0; @@ -1449,12 +1449,12 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr src, atkmin = atkmin_ = dex; //最低ATKはDEXで初期化? sd->state.arrow_atk = 0; //arrow_atk初期化 - int widx = sd->equip_index_maybe[EQUIP::WEAPON]; - int sidx = sd->equip_index_maybe[EQUIP::SHIELD]; + IOff0 widx = sd->equip_index_maybe[EQUIP::WEAPON]; + IOff0 sidx = sd->equip_index_maybe[EQUIP::SHIELD]; - if (widx >= 0 && sd->inventory_data[widx]) + if (widx.ok() && sd->inventory_data[widx]) atkmin = atkmin * (80 + sd->inventory_data[widx]->wlv * 20) / 100; - if (sidx >= 0 && sd->inventory_data[sidx]) + if (sidx.ok() && sd->inventory_data[sidx]) atkmin_ = atkmin_ * (80 + sd->inventory_data[sidx]->wlv * 20) / 100; if (sd->status.weapon == ItemLook::BOW) { //武器が弓矢の場合 @@ -2010,8 +2010,8 @@ ATK battle_weapon_attack(dumb_ptr src, dumb_ptr target, // 攻撃対象となりうるので攻撃 if (sd && sd->status.weapon == ItemLook::BOW) { - int aidx = sd->equip_index_maybe[EQUIP::ARROW]; - if (aidx >= 0) + IOff0 aidx = sd->equip_index_maybe[EQUIP::ARROW]; + if (aidx.ok()) { if (battle_config.arrow_decrement) pc_delitem(sd, aidx, 1, 0); @@ -2058,9 +2058,9 @@ ATK battle_weapon_attack(dumb_ptr src, dumb_ptr target, if (src->bl_type == BL::PC) { - int weapon_index = sd->equip_index_maybe[EQUIP::WEAPON]; + IOff0 weapon_index = sd->equip_index_maybe[EQUIP::WEAPON]; ItemNameId weapon; - if (weapon_index >= 0 && sd->inventory_data[weapon_index] + if (weapon_index.ok() && sd->inventory_data[weapon_index] && bool(sd->status.inventory[weapon_index].equip & EPOS::WEAPON)) weapon = sd->inventory_data[weapon_index]->nameid; -- cgit v1.2.3-70-g09d2