mirror of https://github.com/FreeCol/freecol.git
Add --server-port option, --server drops port argument.
This commit is contained in:
parent
cb06df38d9
commit
27beb32a91
|
@ -251,8 +251,9 @@ cli.no-sound=run FreeCol without sound
|
|||
cli.no-splash=skip the splash screen
|
||||
cli.private=start a private server (not published to the metaserver)
|
||||
cli.seed=provide a SEED for the pseudo-random number generator
|
||||
cli.server=start a stand-alone server
|
||||
cli.server-name=specify a custom NAME for the server
|
||||
cli.server=start a stand-alone server on the specified port
|
||||
cli.server-port=specify a custom PORT for the server
|
||||
cli.splash=display a splash screen image FILE while loading the game
|
||||
cli.tc=load the total conversion with the given NAME
|
||||
cli.timeout=number of seconds the server waits for an answer to a question
|
||||
|
|
|
@ -366,8 +366,9 @@ options:
|
|||
does not yet contain background music, so the only sounds you will
|
||||
hear will be special effects.
|
||||
\item\verb$--no-splash$ Skip the splash screen.
|
||||
\item\verb$--server PORT$ Start a stand-alone server on the specified
|
||||
port.
|
||||
\item\verb$--server$ Start a stand-alone server.
|
||||
\item\verb$--server-name NAME$ Specify the server name.
|
||||
\item\verb$--server-port PORT$ Specify the server port.
|
||||
\item\verb$--server-help$ Display a help screen for the more advanced
|
||||
server options.
|
||||
\item\verb$--splash FILE$ Specify the location of the splash screen file.
|
||||
|
|
|
@ -561,14 +561,17 @@ public final class FreeCol {
|
|||
.create());
|
||||
options.addOption(OptionBuilder.withLongOpt("server")
|
||||
.withDescription(Messages.message("cli.server"))
|
||||
.withArgName(Messages.message("cli.arg.port"))
|
||||
.hasOptionalArg()
|
||||
.create());
|
||||
options.addOption(OptionBuilder.withLongOpt("server-name")
|
||||
.withDescription(Messages.message("cli.server-name"))
|
||||
.withArgName(Messages.message("cli.arg.name"))
|
||||
.hasArg()
|
||||
.create());
|
||||
options.addOption(OptionBuilder.withLongOpt("server-port")
|
||||
.withDescription(Messages.message("cli.server-port"))
|
||||
.withArgName(Messages.message("cli.arg.port"))
|
||||
.hasArg()
|
||||
.create());
|
||||
options.addOption(OptionBuilder.withLongOpt("splash")
|
||||
.withDescription(Messages.message("cli.splash"))
|
||||
.withArgName(Messages.message("cli.arg.file"))
|
||||
|
@ -765,16 +768,18 @@ public final class FreeCol {
|
|||
}
|
||||
|
||||
if (line.hasOption("server")) {
|
||||
String arg = line.getOptionValue("server");
|
||||
if (!setServerPort(arg)) {
|
||||
fatal(StringTemplate.template("cli.error.serverPort")
|
||||
.addName("%string%", arg));
|
||||
}
|
||||
standAloneServer = true;
|
||||
}
|
||||
if (line.hasOption("server-name")) {
|
||||
serverName = line.getOptionValue("server-name");
|
||||
}
|
||||
if (line.hasOption("server-port")) {
|
||||
String arg = line.getOptionValue("server-port");
|
||||
if (!setServerPort(arg)) {
|
||||
fatal(StringTemplate.template("cli.error.serverPort")
|
||||
.addName("%string%", arg));
|
||||
}
|
||||
}
|
||||
|
||||
if (line.hasOption("seed")) {
|
||||
FreeColSeed.setFreeColSeed(line.getOptionValue("seed"));
|
||||
|
|
|
@ -628,16 +628,16 @@ public final class ConnectController {
|
|||
} catch (FileNotFoundException e) {
|
||||
err = StringTemplate.key("server.fileNotFound");
|
||||
logger.log(Level.WARNING, "Can not find file.", e);
|
||||
} catch (FreeColException e) {
|
||||
err = StringTemplate.name(e.getMessage());
|
||||
logger.log(Level.WARNING, "FreeCol error.", e);
|
||||
} catch (IOException e) {
|
||||
err = StringTemplate.key("server.initialize");
|
||||
logger.log(Level.WARNING, "Error starting game.", e);
|
||||
} catch (XMLStreamException e) {
|
||||
err = FreeCol.badLoad(theFile);
|
||||
logger.log(Level.WARNING, "Stream error.", e);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
err = StringTemplate.name(e.getMessage());
|
||||
logger.log(Level.WARNING, "FreeCol error.", e);
|
||||
}
|
||||
if (err != null) {
|
||||
// If this is a debug run, fail hard.
|
||||
if (freeColClient.isHeadless()
|
||||
|
|
Loading…
Reference in New Issue