1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-23 14:26:37 +00:00

Move wrap function to windowbase so all windows can use it

This commit is contained in:
Andrew Lanzone 2025-05-19 23:43:28 -07:00
parent 0aad0d379a
commit f36401438f
3 changed files with 12 additions and 10 deletions

View file

@ -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;

View file

@ -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)
{ {

View file

@ -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;