diff options
Diffstat (limited to 'engines/tsage/ringworld2/ringworld2_logic.cpp')
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 86014fb9c1..b7034fd49c 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -1456,12 +1456,12 @@ int MazeUI::getCellFromCellXY(const Common::Point &p) { } } -int MazeUI::pixelToCellXY(int &x, int &y) { - x /= _cellSize.x; - y /= _cellSize.y; +int MazeUI::pixelToCellXY(Common::Point &pt) { + pt.x /= _cellSize.x; + pt.y /= _cellSize.y; - if ((x >= 0) && (y >= 0) && (_mapCells.x > x) && (_mapCells.y > y)) { - return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * y + x) * 2); + if ((pt.x >= 0) && (pt.y >= 0) && (pt.x < _mapCells.x) && (pt.y < _mapCells.y)) { + return (int16)READ_LE_UINT16(_mapData + (_mapCells.x * pt.y + pt.x) * 2); } return -1; |