Don't allow copy of relay-connected game.

This commit is contained in:
Andy2 2010-10-23 11:08:33 -07:00
parent 7cf4535b4c
commit 5a5c73916e
3 changed files with 16 additions and 4 deletions

View file

@ -386,6 +386,9 @@
<string name="notify_body">New game data available on relay</string>
<string name="gamel_menu_checkmoves">Check server</string>
<string name="no_copy_network">Games that have already connected
to the relay cannot be copied.</string>
<string name="no_games_to_refresh">No games found that connect via
the meetup server.</string>

View file

@ -354,10 +354,14 @@ public class GamesList extends XWListActivity
break;
case R.id.list_item_copy:
stream = GameUtils.savedGame( this, path );
newName = GameUtils.saveGame( this, stream );
DBUtils.saveSummary( newName,
DBUtils.getSummary( this, path ) );
GameSummary summary = DBUtils.getSummary( this, path );
if ( summary.inNetworkGame() ) {
showOKOnlyDialog( R.string.no_copy_network );
} else {
stream = GameUtils.savedGame( this, path );
newName = GameUtils.saveGame( this, stream );
DBUtils.saveSummary( newName, summary );
}
break;
// These require some notion of predictable sort order.

View file

@ -34,4 +34,9 @@ public class GameSummary {
public String roomName;
public String relayID;
public boolean msgsPending;
public boolean inNetworkGame()
{
return null != relayID;
}
}