simplify
This commit is contained in:
@@ -258,9 +258,8 @@ static CString TransferStatsMemoryCardToMachine()
|
|||||||
return "Stats transferred to machine.";
|
return "Stats transferred to machine.";
|
||||||
}
|
}
|
||||||
|
|
||||||
static CString CopyEditsMachineToMemoryCard()
|
static PlayerNumber GetFirstReadyMemoryCard()
|
||||||
{
|
{
|
||||||
bool bTriedToCopy = false;
|
|
||||||
FOREACH_PlayerNumber( pn )
|
FOREACH_PlayerNumber( pn )
|
||||||
{
|
{
|
||||||
if( MEMCARDMAN->GetCardState(pn) != MemoryCardState_Ready )
|
if( MEMCARDMAN->GetCardState(pn) != MemoryCardState_Ready )
|
||||||
@@ -268,8 +267,21 @@ static CString CopyEditsMachineToMemoryCard()
|
|||||||
|
|
||||||
if( !MEMCARDMAN->IsMounted(pn) )
|
if( !MEMCARDMAN->IsMounted(pn) )
|
||||||
MEMCARDMAN->MountCard(pn);
|
MEMCARDMAN->MountCard(pn);
|
||||||
|
return pn;
|
||||||
|
}
|
||||||
|
|
||||||
bTriedToCopy = true;
|
return PLAYER_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
static CString CopyEditsMachineToMemoryCard()
|
||||||
|
{
|
||||||
|
PlayerNumber pn = GetFirstReadyMemoryCard();
|
||||||
|
if( pn == PLAYER_INVALID )
|
||||||
|
return "Edits not copied - No memory cards ready.";
|
||||||
|
|
||||||
|
{
|
||||||
|
if( !MEMCARDMAN->IsMounted(pn) )
|
||||||
|
MEMCARDMAN->MountCard(pn);
|
||||||
|
|
||||||
int iNumAttempted = 0;
|
int iNumAttempted = 0;
|
||||||
int iNumSuccessful = 0;
|
int iNumSuccessful = 0;
|
||||||
@@ -313,12 +325,8 @@ static CString CopyEditsMachineToMemoryCard()
|
|||||||
|
|
||||||
// TODO: Make string themable
|
// TODO: Make string themable
|
||||||
return ssprintf("Copied to P%d card:\n%d/%d copies OK (%d overwritten).",pn+1,iNumSuccessful,iNumAttempted,iNumOverwritten);
|
return ssprintf("Copied to P%d card:\n%d/%d copies OK (%d overwritten).",pn+1,iNumSuccessful,iNumAttempted,iNumOverwritten);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !bTriedToCopy )
|
|
||||||
return "Edits not copied - No memory cards ready.";
|
|
||||||
|
|
||||||
MEMCARDMAN->FlushAndReset();
|
MEMCARDMAN->FlushAndReset();
|
||||||
|
|
||||||
return "Edits copied to machine.";
|
return "Edits copied to machine.";
|
||||||
@@ -326,17 +334,14 @@ static CString CopyEditsMachineToMemoryCard()
|
|||||||
|
|
||||||
static CString CopyEditsMemoryCardToMachine()
|
static CString CopyEditsMemoryCardToMachine()
|
||||||
{
|
{
|
||||||
bool bTriedToCopy = false;
|
PlayerNumber pn = GetFirstReadyMemoryCard();
|
||||||
FOREACH_PlayerNumber( pn )
|
if( pn == PLAYER_INVALID )
|
||||||
{
|
return "Edits not copied - No memory cards ready.";
|
||||||
if( MEMCARDMAN->GetCardState(pn) != MemoryCardState_Ready )
|
|
||||||
continue; // skip
|
|
||||||
|
|
||||||
|
{
|
||||||
if( !MEMCARDMAN->IsMounted(pn) )
|
if( !MEMCARDMAN->IsMounted(pn) )
|
||||||
MEMCARDMAN->MountCard(pn);
|
MEMCARDMAN->MountCard(pn);
|
||||||
|
|
||||||
bTriedToCopy = true;
|
|
||||||
|
|
||||||
int iNumAttempted = 0;
|
int iNumAttempted = 0;
|
||||||
int iNumSuccessful = 0;
|
int iNumSuccessful = 0;
|
||||||
int iNumOverwritten = 0;
|
int iNumOverwritten = 0;
|
||||||
@@ -383,12 +388,8 @@ static CString CopyEditsMemoryCardToMachine()
|
|||||||
|
|
||||||
// TODO: Make themeable
|
// TODO: Make themeable
|
||||||
return ssprintf("Copied from P%d card:\n%d/%d copies OK (%d overwritten).",pn+1,iNumSuccessful,iNumAttempted,iNumOverwritten);
|
return ssprintf("Copied from P%d card:\n%d/%d copies OK (%d overwritten).",pn+1,iNumSuccessful,iNumAttempted,iNumOverwritten);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !bTriedToCopy )
|
|
||||||
return "Edits not copied - No memory cards ready.";
|
|
||||||
|
|
||||||
MEMCARDMAN->FlushAndReset();
|
MEMCARDMAN->FlushAndReset();
|
||||||
|
|
||||||
return "Edits copied to memory card.";
|
return "Edits copied to memory card.";
|
||||||
|
|||||||
Reference in New Issue
Block a user