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="notify_body">New game data available on relay</string>
<string name="gamel_menu_checkmoves">Check server</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 <string name="no_games_to_refresh">No games found that connect via
the meetup server.</string> the meetup server.</string>

View file

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

View file

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