Main/src/MultiplayerScreen.cpp
// Set the selected map to a given map and difficulty (used by SongSelect)
Set the selected map to a given map and difficulty (used by SongSelect)
Set the selected map to a given map and difficulty ( used by SongSelect )
void MultiplayerScreen::SetSelectedMap(FolderIndex* folder, ChartIndex* chart)
{
	const SongSelectIndex song(folder, chart);
	const size_t last_slash_idx = song.GetFolder()->path.find_last_of("\\/");
	std::string short_path = song.GetFolder()->path.substr(last_slash_idx + 1);
	uint32 diff_index = (song.id % 10) - 1;
	const ChartIndex* newChart = m_getChartByHash(chart->hash, short_path, &diff_index, chart->level);
	if (newChart == nullptr)
	{
		m_hasSelectedMap = false;
		return;
	}
	m_selfPicked = true;
	m_updateSelectedMap(newChart->folderId, diff_index, true);
	m_selectedMapShortPath = short_path;
	m_selectedMapHash = chart->hash;
}
void MultiplayerScreen :: SetSelectedMap ( FolderIndex * folder , ChartIndex * chart ) { const SongSelectIndex song ( folder , chart ) ; const size_t last_slash_idx = song . GetFolder ( ) -> path . find_last_of ( " \\ " ) ; std :: string short_path = song . GetFolder ( ) -> path . substr ( last_slash_idx + 1 ) ; uint32 diff_index = ( song . id % 10 ) - 1 ; const ChartIndex * newChart = m_getChartByHash ( chart -> hash , short_path , & diff_index , chart -> level ) ; if ( newChart == nullptr ) { m_hasSelectedMap = false ; return ; } m_selfPicked = true ; m_updateSelectedMap ( newChart -> folderId , diff_index , true ) ; m_selectedMapShortPath = short_path ; m_selectedMapHash = chart -> hash ; }
Set the selected map to a given map and difficulty (used by SongSelect)
Set the selected map to a given map and difficulty ( used by SongSelect )
// Get the "short" path (basically the last part of the path) // Get the difficulty index into the selected map // Get the actual map id // Somehow we failed the round trip, so we can't use this map