diff options
author | Torbjörn Andersson | 2005-10-16 15:06:51 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2005-10-16 15:06:51 +0000 |
commit | 8b1e22e964f2389851615bbd8a407e5d5bc094b9 (patch) | |
tree | 7bbd1c4ae0d08febeaeb364ae3bb3ce0aec75c1c /sword1/control.cpp | |
parent | c6a6d8945330c332219251bd58e379c5da5816f5 (diff) | |
download | scummvm-rg350-8b1e22e964f2389851615bbd8a407e5d5bc094b9.tar.gz scummvm-rg350-8b1e22e964f2389851615bbd8a407e5d5bc094b9.tar.bz2 scummvm-rg350-8b1e22e964f2389851615bbd8a407e5d5bc094b9.zip |
Be more careful when subtracting from unsigned values. Fixes bug #1327972.
svn-id: r19110
Diffstat (limited to 'sword1/control.cpp')
-rw-r--r-- | sword1/control.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sword1/control.cpp b/sword1/control.cpp index 0beda6890f..f3221b1e14 100644 --- a/sword1/control.cpp +++ b/sword1/control.cpp @@ -833,13 +833,17 @@ void Control::saveNameScroll(uint8 scroll, bool saving) { if (_saveScrollPos >= 1) _saveScrollPos--; } else if (scroll == BUTTON_SCROLL_DOWN_SLOW) { - if (_saveScrollPos < maxScroll - 8) + if (_saveScrollPos + 8 < maxScroll) _saveScrollPos++; } else if (scroll == BUTTON_SCROLL_DOWN_FAST) { - if (_saveScrollPos < maxScroll - 16) + if (_saveScrollPos + 16 < maxScroll) _saveScrollPos += 8; - else - _saveScrollPos = maxScroll - 8; + else { + if (maxScroll >= 8) + _saveScrollPos = maxScroll - 8; + else + _saveScrollPos = 0; + } } _selectedSavegame = 255; // deselect savegame deselectSaveslots(); |