mirror of
https://github.com/OpenMW/openmw.git
synced 2025-10-23 12:56:41 +00:00
Move wrap function to windowbase so all windows can use it
This commit is contained in:
parent
0aad0d379a
commit
f36401438f
3 changed files with 12 additions and 10 deletions
|
@ -23,16 +23,6 @@
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
int wrap(int index, int max)
|
|
||||||
{
|
|
||||||
if (index < 0)
|
|
||||||
return max - 1;
|
|
||||||
else if (index >= max)
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool sortRaces(const std::pair<ESM::RefId, std::string>& left, const std::pair<ESM::RefId, std::string>& right)
|
bool sortRaces(const std::pair<ESM::RefId, std::string>& left, const std::pair<ESM::RefId, std::string>& right)
|
||||||
{
|
{
|
||||||
return left.second.compare(right.second) < 0;
|
return left.second.compare(right.second) < 0;
|
||||||
|
|
|
@ -15,6 +15,16 @@
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
|
int MWGui::wrap(int index, int max)
|
||||||
|
{
|
||||||
|
if (index < 0)
|
||||||
|
return max - 1;
|
||||||
|
else if (index >= max)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
WindowBase::WindowBase(std::string_view parLayout)
|
WindowBase::WindowBase(std::string_view parLayout)
|
||||||
: Layout(parLayout)
|
: Layout(parLayout)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,6 +14,8 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
class DragAndDrop;
|
class DragAndDrop;
|
||||||
|
|
||||||
|
int wrap(int index, int max);
|
||||||
|
|
||||||
struct ControllerButtonStr
|
struct ControllerButtonStr
|
||||||
{
|
{
|
||||||
std::string a;
|
std::string a;
|
||||||
|
|
Loading…
Reference in a new issue