]> git.localhorst.tv Git - l2e.git/commitdiff
third column menu hack for cursor
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Sat, 17 Nov 2012 13:28:25 +0000 (14:28 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Sat, 17 Nov 2012 13:28:25 +0000 (14:28 +0100)
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;