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

Public Member Functions

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

Detailed Description

Definition at line 194 of file itemcontainer.cpp.

Member Function Documentation

◆ operator()()

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

Definition at line 199 of file itemcontainer.cpp.

201  {
202  if ((pair1->mItem == nullptr) || (pair2->mItem == nullptr))
203  return false;
204 
205  const ItemInfo &info1 = pair1->mItem->getInfo();
206  const ItemInfo &info2 = pair2->mItem->getInfo();
207  const ItemDbTypeT t1 = info1.getType();
208  const ItemDbTypeT t2 = info2.getType();
209  if (t1 == t2)
210  {
211  const std::string &name1 = info1.getName();
212  const std::string &name2 = info2.getName();
213  if (name1 == name2)
214  {
215  return pair1->mItem->getInvIndex() <
216  pair2->mItem->getInvIndex();
217  }
218  return name1 < name2;
219  }
220  return t1 < t2;
221  }
const std::string & getName() const
Definition: iteminfo.h:74
ItemDbTypeT getType() const
Definition: iteminfo.h:127
ItemDbType ::T ItemDbTypeT
Definition: itemdbtype.h:49

References ItemInfo::getName(), and ItemInfo::getType().


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