pull in project-slippi/Ishiiruka/commit/525bca0be46205b7b98877d8c5d37b37454780c5

rename singlesStages to legalStages
This commit is contained in:
Nikhil Narayana 2021-12-18 17:32:46 -08:00
commit 1ca31ca6ae
2 changed files with 8 additions and 9 deletions

View file

@ -1838,9 +1838,8 @@ void CEXISlippi::startFindMatch(u8* payload)
} }
// Stage check // Stage check
if (localSelections.isStageSelected && if (localSelections.isStageSelected && std::find(legalStages.begin(), legalStages.end(),
std::find(singlesStages.begin(), singlesStages.end(), localSelections.stageId) == localSelections.stageId) == legalStages.end())
singlesStages.end())
{ {
forcedError = "The stage being requested is not allowed in this mode"; forcedError = "The stage being requested is not allowed in this mode";
return; return;
@ -2121,7 +2120,7 @@ void CEXISlippi::prepareOnlineMatchState()
return; return;
} }
if (std::find(singlesStages.begin(), singlesStages.end(), stageId) == singlesStages.end()) if (std::find(legalStages.begin(), legalStages.end(), stageId) == legalStages.end())
{ {
handleConnectionCleanup(); handleConnectionCleanup();
prepareOnlineMatchState(); prepareOnlineMatchState();
@ -2280,7 +2279,7 @@ void CEXISlippi::prepareOnlineMatchState()
m_read_queue.insert(m_read_queue.end(), onlineMatchBlock.begin(), onlineMatchBlock.end()); m_read_queue.insert(m_read_queue.end(), onlineMatchBlock.begin(), onlineMatchBlock.end());
} }
std::vector<u16> CEXISlippi::singlesStages = { std::vector<u16> CEXISlippi::legalStages = {
0x2, // FoD 0x2, // FoD
0x3, // Pokemon 0x3, // Pokemon
0x8, // Yoshi's Story 0x8, // Yoshi's Story
@ -2295,7 +2294,7 @@ u16 CEXISlippi::getRandomStage(u8 onlineMode)
// Reset stage pool if it's empty // Reset stage pool if it's empty
if (stagePool.empty()) if (stagePool.empty())
stagePool.insert(stagePool.end(), singlesStages.begin(), singlesStages.end()); stagePool.insert(stagePool.end(), legalStages.begin(), legalStages.end());
// Get random stage // Get random stage
int randIndex = generator() % stagePool.size(); int randIndex = generator() % stagePool.size();
@ -2305,8 +2304,8 @@ u16 CEXISlippi::getRandomStage(u8 onlineMode)
stagePool.erase(stagePool.begin() + randIndex); stagePool.erase(stagePool.begin() + randIndex);
// If the mode is teams, don't allow FoD to be selected, re-roll instead. Note that this will // If the mode is teams, don't allow FoD to be selected, re-roll instead. Note that this will
// cause a stack overflow exception/infinite recursion in the case the FoD is the only stage in // cause a stack overflow exception/infinite recursion in the case where a dev removes all
// the singlesStages vector // stages but FoD from the legalStages vector
if (onlineMode == (u8)SlippiMatchmaking::OnlinePlayMode::TEAMS && selectedStage == 0x2) if (onlineMode == (u8)SlippiMatchmaking::OnlinePlayMode::TEAMS && selectedStage == 0x2)
{ {
return getRandomStage(onlineMode); return getRandomStage(onlineMode);

View file

@ -252,6 +252,6 @@ private:
std::map<s32, std::unique_ptr<SlippiSavestate>> activeSavestates; std::map<s32, std::unique_ptr<SlippiSavestate>> activeSavestates;
std::deque<std::unique_ptr<SlippiSavestate>> availableSavestates; std::deque<std::unique_ptr<SlippiSavestate>> availableSavestates;
static std::vector<u16> singlesStages; static std::vector<u16> legalStages;
}; };
} // namespace ExpansionInterface } // namespace ExpansionInterface