Changed GetFirstCompatibleStyle to not crash SM so it can be used to check whether joining is allowed. JoinPlayer and PlayersCanJoin now use GetFirstCompatibleStyle to check whether there will be a style to change to. Changed logic in PlayersCanJoin to return false at the first failed requirement.

This commit is contained in:
Kyzentun
2015-05-02 23:36:28 -06:00
parent a8f4278a54
commit 236947b346
3 changed files with 61 additions and 34 deletions
+8
View File
@@ -3,6 +3,7 @@
#include "ScreenManager.h"
#include "PrefsManager.h"
#include "SongManager.h"
#include "Game.h"
#include "GameManager.h"
#include "GameSoundManager.h"
#include "GameConstantsAndTypes.h"
@@ -249,6 +250,13 @@ void ScreenSelectMusic::BeginScreen()
vector<StepsType> vst;
GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, vst );
const Style *pStyle = GAMEMAN->GetFirstCompatibleStyle( GAMESTATE->m_pCurGame, GAMESTATE->GetNumSidesJoined(), vst[0] );
if(pStyle == NULL)
{
FAIL_M( ssprintf("No compatible styles for %s with %d player%s.",
GAMESTATE->m_pCurGame->m_szName,
GAMESTATE->GetNumSidesJoined(),
GAMESTATE->GetNumSidesJoined()==1?"":"s") );
}
GAMESTATE->SetCurrentStyle( pStyle, PLAYER_INVALID );
}