diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2014-10-13 13:16:34 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2014-10-13 14:03:46 -0700 |
commit | 780a0d771edbe21dcfa3405163ffbdf7f7fa4604 (patch) | |
tree | ac202254d015d2a2a28ab5bca60c3f5474d168ba /src/map/battle.cpp | |
parent | a5e0fe8204a8b3299507a645f3479e9ead6c6110 (diff) | |
download | tmwa-780a0d771edbe21dcfa3405163ffbdf7f7fa4604.tar.gz tmwa-780a0d771edbe21dcfa3405163ffbdf7f7fa4604.tar.bz2 tmwa-780a0d771edbe21dcfa3405163ffbdf7f7fa4604.tar.xz tmwa-780a0d771edbe21dcfa3405163ffbdf7f7fa4604.zip |
Convert container lookups to use Option<Borrowed<T>>
Diffstat (limited to 'src/map/battle.cpp')
-rw-r--r-- | src/map/battle.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/map/battle.cpp b/src/map/battle.cpp index 07210fd..ce10c5c 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -1417,8 +1417,11 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, IOff0 widx = sd->equip_index_maybe[EQUIP::WEAPON]; - if (widx.ok() && sd->inventory_data[widx]) - atkmin = atkmin * (80 + sd->inventory_data[widx]->wlv * 20) / 100; + if (widx.ok()) + { + if OPTION_IS_SOME(sdidw, sd->inventory_data[widx]) + atkmin = atkmin * (80 + sdidw->wlv * 20) / 100; + } if (sd->status.weapon == ItemLook::BOW) { //武器が弓矢の場合 atkmin = watk * ((atkmin < watk) ? atkmin : watk) / 100; //弓用最低ATK計算 @@ -1935,9 +1938,16 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target, { IOff0 weapon_index = sd->equip_index_maybe[EQUIP::WEAPON]; ItemNameId weapon; - 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; + if (weapon_index.ok()) + { + if OPTION_IS_SOME(sdidw, sd->inventory_data[weapon_index]) + { + if (bool(sd->status.inventory[weapon_index].equip & EPOS::WEAPON)) + { + weapon = sdidw->nameid; + } + } + } MAP_LOG("PC%d %s:%d,%d WPNDMG %s%d %d FOR %d WPN %d"_fmt, sd->status_key.char_id, src->bl_m->name_, src->bl_x, src->bl_y, |