Add conditional song prompt

This commit is contained in:
Jack Andersen 2016-05-31 17:05:13 -10:00
parent 08de4873f4
commit 44204d7b08
1 changed files with 63 additions and 28 deletions

View File

@ -696,9 +696,41 @@ struct AppCallback : boo::IApplicationCallback
#else
const char* utf8Path = m_argv[2];
#endif
songs = amuse::ContainerRegistry::LoadSongs(utf8Path);
}
else
songs = amuse::ContainerRegistry::LoadSongs(utf8Path);
if (songs.size())
{
bool play = true;
if (m_argc <= 2)
{
bool prompt = true;
while (true)
{
if (prompt)
{
printf("Play Song? (Y/N): ");
prompt = false;
}
char userSel;
if (scanf("%c", &userSel) <= 0 || userSel == '\n')
continue;
userSel = tolower(userSel);
if (userSel == 'n')
play = false;
else if (userSel != 'y')
{
prompt = true;
continue;
}
break;
}
}
if (play)
{
/* Get song selection from user */
if (songs.size() > 1)
{
@ -738,6 +770,7 @@ struct AppCallback : boo::IApplicationCallback
m_setupId = m_arrData->m_setupId;
}
}
}
/* Get group selection from user */
if (m_groupId != -1)
@ -859,6 +892,8 @@ struct AppCallback : boo::IApplicationCallback
SFXLoop(*sfxIndex);
else
SongLoop(*songIndex);
printf("\n\n");
}
return 0;