From 4b9b85812781d4e1c23e503bde4ed5de9cdabca4 Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 2 Sep 2009 07:01:25 +0000 Subject: (svn r17366) -Codechange: make the AI GUIs use the scrollbar wrappers --- src/window_gui.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/window_gui.h') 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 @@ -217,6 +217,16 @@ public: return this->pos; } + /** + * 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 @@ -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; } -- cgit v1.2.3-54-g00ecf