mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
added demo loading speed enhancement by MAP94. Closes #555
This commit is contained in:
parent
2aa1bda97e
commit
4d5443affa
|
@ -242,6 +242,7 @@ public:
|
|||
*/
|
||||
void set_size(int new_size)
|
||||
{
|
||||
if(list_size < new_size)
|
||||
alloc(new_size);
|
||||
num_elements = new_size;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,17 @@ public:
|
|||
return parent::insert(item, partition_binary(all(), item));
|
||||
}
|
||||
|
||||
int add_unsorted(const T& item)
|
||||
{
|
||||
return parent::add(item);
|
||||
}
|
||||
|
||||
void sort_range()
|
||||
{
|
||||
sort(all());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Function: all
|
||||
Returns a sorted range that contains the whole array.
|
||||
|
|
|
@ -457,7 +457,7 @@ int CMenus::DemolistFetchCallback(const char *pName, int IsDir, int StorageType,
|
|||
}
|
||||
Item.m_IsDir = IsDir != 0;
|
||||
Item.m_StorageType = StorageType;
|
||||
pSelf->m_lDemos.add(Item);
|
||||
pSelf->m_lDemos.add_unsorted(Item);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -468,6 +468,7 @@ void CMenus::DemolistPopulate()
|
|||
if(!str_comp(m_aCurrentDemoFolder, "demos"))
|
||||
m_DemolistStorageType = IStorage::TYPE_ALL;
|
||||
Storage()->ListDirectory(m_DemolistStorageType, m_aCurrentDemoFolder, DemolistFetchCallback, this);
|
||||
m_lDemos.sort_range();
|
||||
}
|
||||
|
||||
void CMenus::DemolistOnUpdate(bool Reset)
|
||||
|
|
Loading…
Reference in a new issue