@@ -1054,7 +1054,6 @@ void PauseMenuDataMgr::autoEquipLastAddedItem() {
10541054 }
10551055}
10561056
1057- // NON_MATCHING: branching
10581057const sead::SafeString& PauseMenuDataMgr::autoEquip (PouchItem* item,
10591058 const sead::OffsetList<PouchItem>& list) {
10601059 const auto type = item->getType ();
@@ -1064,20 +1063,30 @@ const sead::SafeString& PauseMenuDataMgr::autoEquip(PouchItem* item,
10641063 if (type >= PouchItemType::Material)
10651064 return sead::SafeString::cEmptyString;
10661065
1067- if (isPouchItemArmor (type)) {
1066+ switch (type) {
1067+ case PouchItemType::Sword:
1068+ case PouchItemType::Bow:
1069+ case PouchItemType::Shield:
1070+ case PouchItemType::Arrow:
10681071 for (auto & other : list) {
1069- if (other.getType () > PouchItemType::ArmorLower )
1072+ if (other.getType () > PouchItemType::Shield )
10701073 break ;
10711074 if (other.getType () == type)
10721075 other.mEquipped = false ;
10731076 }
1074- } else if (isPouchItemWeapon (type)) {
1077+ break ;
1078+ case PouchItemType::ArmorHead:
1079+ case PouchItemType::ArmorUpper:
1080+ case PouchItemType::ArmorLower:
10751081 for (auto & other : list) {
1076- if (other.getType () > PouchItemType::Shield )
1082+ if (other.getType () > PouchItemType::ArmorLower )
10771083 break ;
10781084 if (other.getType () == type)
10791085 other.mEquipped = false ;
10801086 }
1087+ break ;
1088+ default :
1089+ break ;
10811090 }
10821091
10831092 item->mEquipped = true ;
@@ -1086,27 +1095,25 @@ const sead::SafeString& PauseMenuDataMgr::autoEquip(PouchItem* item,
10861095 return sead::SafeString::cEmptyString;
10871096}
10881097
1089- // NON_MATCHING: harmless reordering
10901098void PauseMenuDataMgr::unequipAll (PouchItemType type) {
10911099 const auto lock = sead::makeScopedLock (mCritSection );
10921100
10931101 if (type == PouchItemType::Arrow)
10941102 return ;
10951103
10961104 for (auto & item : getItems ()) {
1097- if (type == PouchItemType::Invalid) {
1098- if (item.getType () > PouchItemType::ArmorLower)
1099- break ;
1100- if (item.isEquipped () && item.getType () != PouchItemType::Arrow)
1101- item.mEquipped = false ;
1105+ if (item.getType () > PouchItemType::ArmorLower)
1106+ break ;
1107+ if (!item.isEquipped ())
1108+ continue ;
11021109
1103- } else {
1104- if (item.getType () > PouchItemType::ArmorLower)
1105- break ;
1106- if (item.isEquipped () && item.getType () == type) {
1110+ if (type == PouchItemType::Invalid) {
1111+ if (item.getType () != PouchItemType::Arrow) {
11071112 item.mEquipped = false ;
1108- break ;
11091113 }
1114+ } else if (item.getType () == type) {
1115+ item.mEquipped = false ;
1116+ break ;
11101117 }
11111118 }
11121119}
@@ -2207,6 +2214,7 @@ const sead::SafeString* PauseMenuDataMgr::getEquippedItemName(PouchItemType type
22072214 if (item->isEquipped () && item->getType () == type)
22082215 return &item->getName ();
22092216 }
2217+
22102218 return nullptr ;
22112219}
22122220
0 commit comments