ManaPlus
Public Member Functions
anonymous_namespace{itemcontainer.cpp}::SortItemWeightFunctor Class Reference

Public Member Functions

bool operator() (const ItemIdPair *const pair1, const ItemIdPair *const pair2) const
 

Detailed Description

Definition at line 134 of file itemcontainer.cpp.

Member Function Documentation

◆ operator()()

bool anonymous_namespace{itemcontainer.cpp}::SortItemWeightFunctor::operator() ( const ItemIdPair *const  pair1,
const ItemIdPair *const  pair2 
) const
inline

Definition at line 139 of file itemcontainer.cpp.

141  {
142  if ((pair1->mItem == nullptr) || (pair2->mItem == nullptr))
143  return false;
144 
145  const int w1 = pair1->mItem->getInfo().getWeight();
146  const int w2 = pair2->mItem->getInfo().getWeight();
147  if (w1 == w2)
148  {
149  const std::string name1 =
150  pair1->mItem->getInfo().getName();
151  const std::string name2 =
152  pair2->mItem->getInfo().getName();
153  if (name1 == name2)
154  {
155  return pair1->mItem->getInvIndex() <
156  pair2->mItem->getInvIndex();
157  }
158  return name1 < name2;
159  }
160  return w1 < w2;
161  }

The documentation for this class was generated from the following file: