/** * Get the list of games (and option strings). List contains each game's name and option strings * sent from server, as packed by {@link * soc.game.SOCGameOption#packOptionsToString(java.util.Hashtable, boolean)}. * * <p>Game names may be marked with the prefix {@link * soc.message.SOCGames#MARKER_THIS_GAME_UNJOINABLE}; this will be removed from their names before * adding to the returned game list. To see if a game cannot be joined, call {@link * SOCGameList#isUnjoinableGame(String)}. * * @return list of games contained in this message, or an empty SOCGameList * @see SOCGameList#parseGameOptions(String) */ public SOCGameList getGameList() { SOCGameList gamelist = new SOCGameList(); for (int ii = 0; ii < pa.length; ) { final String gaName = pa[ii]; ++ii; gamelist.addGame(gaName, pa[ii], false); ++ii; } return gamelist; }
/** * remove the game from the list * * @param gaName the name of the game */ public synchronized void deleteGame(String gaName) { Vector members = (Vector) gameMembers.get(gaName); if (members != null) { members.removeAllElements(); } super.deleteGame(gaName); }
/** * remove the game from the list and call {@link SOCGame#destroyGame()} via {@link * SOCGameList#deleteGame(String)}. * * @param gaName the name of the game */ @Override public synchronized void deleteGame(String gaName) { // delete from super first, to destroy game and set its gameDestroyed flag // (Removes game from list before dealing with members, in case of locks) super.deleteGame(gaName); Vector<StringConnection> members = gameMembers.get(gaName); if (members != null) { members.removeAllElements(); } }