From 780a0d771edbe21dcfa3405163ffbdf7f7fa4604 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Mon, 13 Oct 2014 13:16:34 -0700 Subject: Convert container lookups to use Option> --- src/map/chrif.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/map/chrif.cpp') diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp index 0ebdf1c..090cccf 100644 --- a/src/map/chrif.cpp +++ b/src/map/chrif.cpp @@ -960,7 +960,6 @@ void ladmin_itemfrob_c2(dumb_ptr bl, ItemNameId source_id, ItemNameI case BL::PC: { dumb_ptr pc = bl->is_player(); - Storage *stor = account2storage2(pc->status_key.account_id); for (IOff0 j : IOff0::iter()) IFIX(pc->status.inventory[j].nameid); @@ -971,7 +970,8 @@ void ladmin_itemfrob_c2(dumb_ptr bl, ItemNameId source_id, ItemNameI IFIX(pc->status.head_mid); IFIX(pc->status.head_bottom); - if (stor) + Option> stor_ = account2storage2(pc->status_key.account_id); + if OPTION_IS_SOME(stor, stor_) { for (SOff0 j : SOff0::iter()) FIX(stor->storage_[j]); @@ -979,8 +979,8 @@ void ladmin_itemfrob_c2(dumb_ptr bl, ItemNameId source_id, ItemNameI for (IOff0 j : IOff0::iter()) { - struct item_data *item = pc->inventory_data[j]; - if (item && item->nameid == source_id) + P item = TRY_UNWRAP(pc->inventory_data[j], continue); + if (item->nameid == source_id) { item->nameid = dest_id; if (bool(item->equip)) -- cgit v1.2.3-70-g09d2