summaryrefslogtreecommitdiff
path: root/src/window_gui.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-09-02 07:01:25 +0000
committerrubidium <rubidium@openttd.org>2009-09-02 07:01:25 +0000
commit4b9b85812781d4e1c23e503bde4ed5de9cdabca4 (patch)
tree1bdaa8c97f3b7a52370b6505a41e78290cefd68b /src/window_gui.h
parentb06e026f97012a82618317600520c429c1c1b013 (diff)
downloadopenttd-4b9b85812781d4e1c23e503bde4ed5de9cdabca4.tar.xz
(svn r17366) -Codechange: make the AI GUIs use the scrollbar wrappers
Diffstat (limited to 'src/window_gui.h')
-rw-r--r--src/window_gui.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/window_gui.h b/src/window_gui.h
index 97dccfd4c..2276092cb 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -218,6 +218,16 @@ public:
}
/**
+ * Checks whether given current item is visible in the list
+ * @param item to check
+ * @return true iff the item is visible
+ */
+ FORCEINLINE bool IsVisible(uint16 item) const
+ {
+ return IsInsideBS(item, this->GetPosition(), this->GetCapacity());
+ }
+
+ /**
* Sets the number of elements in the list
* @param num the number of elements in the list
* @note updates the position if needed
@@ -264,7 +274,7 @@ public:
void SetPosition(int position)
{
assert(position >= 0);
- assert(this->count <= this->cap ? (position == 0) : (position + this->cap < this->count));
+ assert(this->count <= this->cap ? (position == 0) : (position + this->cap <= this->count));
this->pos = position;
}