ManaPlus
Functions
modelistmodel.cpp File Reference

(986a3bf)

#include "render/graphics.h"
#include "utils/sdlhelper.h"
#include "utils/stringutils.h"
#include "gui/models/modelistmodel.h"
#include <algorithm>
#include "debug.h"

Go to the source code of this file.

Functions

static bool modeSorter (const std::string &mode1, const std::string &mode2)
 

Function Documentation

◆ modeSorter()

static bool modeSorter ( const std::string &  mode1,
const std::string &  mode2 
)
static

Definition at line 36 of file modelistmodel.cpp.

37 {
38  const int width1 = atoi(mode1.substr(0, mode1.find('x')).c_str());
39  const int height1 = atoi(mode1.substr(mode1.find('x') + 1).c_str());
40  if ((width1 == 0) || (height1 == 0))
41  return false;
42 
43  const int width2 = atoi(mode2.substr(0, mode2.find('x')).c_str());
44  const int height2 = atoi(mode2.substr(mode2.find('x') + 1).c_str());
45  if ((width2 == 0) || (height2 == 0))
46  return false;
47  if (width1 != width2)
48  return width1 < width2;
49 
50  if (height1 != height2)
51  return height1 < height2;
52 
53  return false;
54 }

Referenced by ModeListModel::ModeListModel().