Make GUIList resort interval variable
This commit is contained in:
@@ -55,6 +55,7 @@ protected:
|
|||||||
uint8 sort_type; ///< what criteria to sort on
|
uint8 sort_type; ///< what criteria to sort on
|
||||||
uint8 filter_type; ///< what criteria to filter on
|
uint8 filter_type; ///< what criteria to filter on
|
||||||
uint16 resort_timer; ///< resort list after a given amount of ticks if set
|
uint16 resort_timer; ///< resort list after a given amount of ticks if set
|
||||||
|
uint16 resort_interval; ///< value to re-initialise resort_timer with after sorting
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the list is sortable
|
* Check if the list is sortable
|
||||||
@@ -71,8 +72,7 @@ protected:
|
|||||||
*/
|
*/
|
||||||
void ResetResortTimer()
|
void ResetResortTimer()
|
||||||
{
|
{
|
||||||
/* Resort every 10 days */
|
this->resort_timer = this->resort_interval;
|
||||||
this->resort_timer = DAY_TICKS * 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -82,7 +82,8 @@ public:
|
|||||||
flags(VL_NONE),
|
flags(VL_NONE),
|
||||||
sort_type(0),
|
sort_type(0),
|
||||||
filter_type(0),
|
filter_type(0),
|
||||||
resort_timer(1)
|
resort_timer(1),
|
||||||
|
resort_interval(DAY_TICKS * 10) /* Resort every 10 days by default */
|
||||||
{};
|
{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -215,6 +216,12 @@ public:
|
|||||||
SETBITS(this->flags, VL_RESORT);
|
SETBITS(this->flags, VL_RESORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetResortInterval(uint16 resort_interval)
|
||||||
|
{
|
||||||
|
this->resort_interval = std::max<uint16>(1, resort_interval);
|
||||||
|
this->resort_timer = std::min<uint16>(this->resort_timer, this->resort_interval);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the sort order is descending
|
* Check if the sort order is descending
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user