]> git.localhorst.tv Git - l2e.git/blobdiff - src/graphics/Menu.h
third column menu hack for cursor
[l2e.git] / src / graphics / Menu.h
index b29e9687cc58bd7019bc9f879bea14c9e3b24340..179c457d6f9f4a2639f7f8ce416851fb1eeb3990 100644 (file)
@@ -109,6 +109,7 @@ public:
        void Enable(int index) { entries[index].enabled = true; }
        void Reserve(int n) { entries.reserve(n); }
        void Clear() { entries.clear(); }
+       void ClearEntry(int at) { entries[at] = Entry(0, T(), false); }
 
        void Draw(SDL_Surface *dest, const geometry::Vector<int> &position) const;
 
@@ -279,6 +280,11 @@ void Menu<T>::Draw(SDL_Surface *dest, const geometry::Vector<int> &position) con
        geometry::Vector<int> cursorOffset(
                        (selected % cols) * (ColWidth() + colGap) - cursor->Width(),
                        ((selected - start) / cols) * RowHeight());
+       // Third column hack!
+       // This fixes the position of the "DROP" item in the inventory menu.
+       if (selected % cols == 2) {
+               cursorOffset += geometry::Vector<int>(font->CharWidth(), 0);
+       }
        switch (state) {
                case STATE_INACTIVE:
                        break;