mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-10 13:38:08 -05:00
Small improvement to sfx randomize button. (#2219)
Should result in less allocations.
This commit is contained in:
parent
1a10d8f627
commit
8c8111c7b8
@ -303,10 +303,9 @@ void Draw_SfxTab(const std::string& tabId, const std::map<u16, std::tuple<std::s
|
||||
ImGui::SameLine();
|
||||
ImGui::PushItemWidth(-FLT_MIN);
|
||||
if (ImGui::Button(randomizeButton.c_str())) {
|
||||
while (true) {
|
||||
auto it = map.begin();
|
||||
std::advance(it, rand() % map.size());
|
||||
const auto& [value, seqData] = *it;
|
||||
while (true) {
|
||||
const auto& [value, seqData] = *std::next(it, rand() % map.size());
|
||||
const auto& [name, sfxKey, seqType] = seqData;
|
||||
if (seqType & type) {
|
||||
CVar_SetS32(cvarKey.c_str(), value);
|
||||
|
Loading…
Reference in New Issue
Block a user