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

Public Member Functions

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

Detailed Description

Definition at line 164 of file itemcontainer.cpp.

Member Function Documentation

◆ operator()()

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

Definition at line 169 of file itemcontainer.cpp.

171  {
172  if ((pair1->mItem == nullptr) || (pair2->mItem == nullptr))
173  return false;
174 
175  const int c1 = pair1->mItem->getQuantity();
176  const int c2 = pair2->mItem->getQuantity();
177  if (c1 == c2)
178  {
179  const std::string name1 =
180  pair1->mItem->getInfo().getName();
181  const std::string name2 =
182  pair2->mItem->getInfo().getName();
183  if (name1 == name2)
184  {
185  return pair1->mItem->getInvIndex() <
186  pair2->mItem->getInvIndex();
187  }
188  return name1 < name2;
189  }
190  return c1 < c2;
191  }

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