diff options
author | Max Horn | 2004-12-18 02:33:37 +0000 |
---|---|---|
committer | Max Horn | 2004-12-18 02:33:37 +0000 |
commit | 0894f8380436a7ae5bd3b55c1d58e576fb4fd597 (patch) | |
tree | 4d2f24538fa6adab5415704460993620e6d84555 /backends/fs/fs.cpp | |
parent | 06315c1ce1cc8fbf2d05637603d27f6dbc6c0cf2 (diff) | |
download | scummvm-rg350-0894f8380436a7ae5bd3b55c1d58e576fb4fd597.tar.gz scummvm-rg350-0894f8380436a7ae5bd3b55c1d58e576fb4fd597.tar.bz2 scummvm-rg350-0894f8380436a7ae5bd3b55c1d58e576fb4fd597.zip |
Ensure that the file list in the browser is always sorted
svn-id: r16108
Diffstat (limited to 'backends/fs/fs.cpp')
-rw-r--r-- | backends/fs/fs.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/backends/fs/fs.cpp b/backends/fs/fs.cpp index 983263b37d..d1e514621c 100644 --- a/backends/fs/fs.cpp +++ b/backends/fs/fs.cpp @@ -20,7 +20,21 @@ #include "stdafx.h" -#include "fs.h" +#include "backends/fs/fs.h" +#include "common/util.h" + +void FSList::sort() { + // Simple selection sort + for (int i = 0; i < _size-1; i++) { + int min = i; + for (int j = i+1; j < _size; j++) + if (_data[j] < _data[min]) + min = j; + if (min != i) + SWAP(_data[min], _data[i]); + } +} + FilesystemNode AbstractFilesystemNode::wrap(AbstractFilesystemNode *node) { FilesystemNode wrapper; |