Change implementation of moving a cheat in the cheat list. (originally implemented in commit 24cdbf0)

This commit is contained in:
SuuperW 2018-08-25 16:05:04 -05:00
parent dee24cdbc1
commit 57bfbb1562
1 changed files with 5 additions and 2 deletions

View File

@ -78,10 +78,13 @@ BOOL CHEATS::move(u32 srcPos, u32 dstPos)
if (srcPos >= list.size() || dstPos > list.size()) return false; if (srcPos >= list.size() || dstPos > list.size()) return false;
if (srcPos < 0 || dstPos < 0) return false; if (srcPos < 0 || dstPos < 0) return false;
// get the item to move
CHEATS_LIST srcCheat = list[srcPos]; CHEATS_LIST srcCheat = list[srcPos];
list.insert(list._Make_iterator_offset(dstPos), srcCheat); // insert item in the new position
list.insert(list.begin() + dstPos, srcCheat);
// remove the original item
if (dstPos < srcPos) srcPos++; if (dstPos < srcPos) srcPos++;
remove(srcPos); list.erase(list.begin() + srcPos);
return true; return true;
} }