- Status Closed
- Percent Complete
- Task Type Bug Report
- Category Engine
-
Assigned To
Ralph Campbell - Operating System
- Severity Medium
- Priority
- Reported Version
- Due in Version Undecided
-
Due Date
Undecided
- Votes
- Private
Attached to Project: PlaneShift
Opened by Ralph Campbell - 17.07.2013
Last edited by Ralph Campbell - 20.11.2013
Opened by Ralph Campbell - 17.07.2013
Last edited by Ralph Campbell - 20.11.2013
FS#6073 - pawsContainerDescWindow::GetSlot() returns the wrong slot (fix included)
The code to get a pawsSlot from the container based on slotID is wrong since there can be more or less columns than 6.
Here is the fix.
Index: src/client/gui/pawscontainerdescwindow.cpp =================================================================== --- src/client/gui/pawscontainerdescwindow.cpp (revision 8702) +++ src/client/gui/pawscontainerdescwindow.cpp (working copy) @@ -341,10 +341,11 @@ pawsSlot* pawsContainerDescWindow::GetSlot(int slotID) { - int col = slotID%6; - int row = (slotID-col)/6; + int cols = contents->GetTotalColumns(); + int col = slotID % cols; + int row = slotID / cols; - if (col > 0 && col < contents->GetTotalColumns()) + if (col >= 0 && col < cols) { pawsListBoxRow* listRow = contents->GetRow(row); if (listRow)
will need to read related code and have a test strategy in place before changing this.
The reason this code wasn't causing a problem is that the
bug 6072wasn't calling this code. By removing the unnecessary code for 6072, there are no calls to pawsContainerDescWindow::GetSlot() so it is safer to remove this (now dead code) until it is needed.