Some miscellaneous updates to main help, for new features and otherwise.
[freeciv.git] / server / commands.c
blob0b4a8b0074706ad735ec604d0190ca55cd8232c1
1 /**********************************************************************
2 Freeciv - Copyright (C) 1996-2004 - The Freeciv Project
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
14 #ifdef HAVE_CONFIG_H
15 #include <fc_config.h>
16 #endif
18 /* utility */
19 #include "fcintl.h"
21 /* common */
22 #include "connection.h"
23 #include "mapimg.h"
25 /* server */
26 #include "commands.h"
27 #include "voting.h"
29 /* Set the synopsis text to don't be translated. */
30 #define SYN_ORIG_(String) "*" String
31 /* Test if the synopsis should be translated or not. */
32 #define SYN_TRANS_(String) ('*' == String[0] ? String + 1 : _(String))
34 struct command {
35 const char *name; /* name - will be matched by unique prefix */
36 enum cmdlevel level; /* access level required to use the command */
37 const char *synopsis; /* one or few-line summary of usage */
38 const char *short_help; /* one line (about 70 chars) description */
39 const char *extra_help; /* extra help information; will be line-wrapped */
40 char *(*extra_help_func)(void);
41 /* dynamically generated help; if non-NULL,
42 * extra_help is ignored. Must be pre-translated. */
43 enum cmd_echo echo; /* Who will be notified when used. */
44 int vote_flags; /* how to handle votes */
45 int vote_percent; /* percent required, meaning depends on flags */
48 /* Commands must match the values in enum command_id. */
49 static struct command commands[] = {
50 {"start", ALLOW_BASIC,
51 /* no translatable parameters */
52 SYN_ORIG_("start"),
53 N_("Start the game, or restart after loading a savegame."),
54 N_("This command starts the game. When starting a new game, "
55 "it should be used after all human players have connected, and "
56 "AI players have been created (if required), and any desired "
57 "changes to initial server options have been made. "
58 "After 'start', each human player will be able to "
59 "choose their nation, and then the game will begin. "
60 "This command is also required after loading a savegame "
61 "for the game to recommence. Once the game is running this command "
62 "is no longer available, since it would have no effect."), NULL,
63 CMD_ECHO_NONE, VCF_NONE, 0
66 {"help", ALLOW_INFO,
67 /* TRANS: translate text between <> only */
68 N_("help\n"
69 "help commands\n"
70 "help options\n"
71 "help <command-name>\n"
72 "help <option-name>"),
73 N_("Show help about server commands and server options."),
74 N_("With no arguments gives some introductory help. "
75 "With argument \"commands\" or \"options\" gives respectively "
76 "a list of all commands or all options. "
77 "Otherwise the argument is taken as a command name or option name, "
78 "and help is given for that command or option. For options, the help "
79 "information includes the current and default values for that option. "
80 "The argument may be abbreviated where unambiguous."), NULL,
81 CMD_ECHO_NONE, VCF_NONE, 0
84 {"list", ALLOW_INFO,
85 /* no translatable parameters */
86 SYN_ORIG_("list\n"
87 "list colors\n"
88 "list connections\n"
89 "list delegations\n"
90 "list ignored users\n"
91 "list map image definitions\n"
92 "list players\n"
93 "list scenarios\n"
94 "list nationsets\n"
95 "list teams\n"
96 "list votes\n"),
97 N_("Show a list of various things."),
98 N_("Show a list of:\n"
99 " - the player colors,\n"
100 " - connections to the server,\n"
101 " - all player delegations,\n"
102 " - your ignore list,\n"
103 " - the list of defined map images,\n"
104 " - the list of the players in the game,\n"
105 " - the available scenarios,\n"
106 " - the available nationsets in this ruleset,\n"
107 " - the teams of players or\n"
108 " - the running votes.\n"
109 "The argument may be abbreviated, and defaults to 'players' if "
110 "absent."), NULL,
111 CMD_ECHO_NONE, VCF_NONE, 0
113 {"quit", ALLOW_HACK,
114 /* no translatable parameters */
115 SYN_ORIG_("quit"),
116 N_("Quit the game and shutdown the server."), NULL, NULL,
117 CMD_ECHO_ALL, VCF_NONE, 0
119 {"cut", ALLOW_CTRL,
120 /* TRANS: translate text between <> only */
121 N_("cut <connection-name>"),
122 N_("Cut a client's connection to server."),
123 N_("Cut specified client's connection to the server, removing that client "
124 "from the game. If the game has not yet started that client's player "
125 "is removed from the game, otherwise there is no effect on the player. "
126 "Note that this command now takes connection names, not player names."),
127 NULL,
128 CMD_ECHO_ALL, VCF_NONE, 50
130 {"explain", ALLOW_INFO,
131 /* TRANS: translate text between <> only */
132 N_("explain\n"
133 "explain <option-name>"),
134 N_("Explain server options."),
135 N_("The 'explain' command gives a subset of the functionality of 'help', "
136 "and is included for backward compatibility. With no arguments it "
137 "gives a list of options (like 'help options'), and with an argument "
138 "it gives help for a particular option (like 'help <option-name>')."),
139 NULL,
140 CMD_ECHO_NONE, VCF_NONE, 0
142 {"show", ALLOW_INFO,
143 /* TRANS: translate text between <> only */
144 N_("show\n"
145 "show <option-name>\n"
146 "show <option-prefix>\n"
147 "show all\n"
148 "show vital\n"
149 "show situational\n"
150 "show rare\n"
151 "show changed\n"
152 "show locked\n"
153 "show rulesetdir"),
154 N_("Show server options."),
155 N_("With no arguments, shows vital server options (or available options, "
156 "when used by clients). With an option name argument, show only the "
157 "named option, or options with that prefix. With \"all\", it shows "
158 "all options. With \"vital\", \"situational\" or \"rare\", a set of "
159 "options with this level. With \"changed\", it shows only the options "
160 "which have been modified, while with \"locked\" all settings locked "
161 "by the ruleset will be listed. With \"ruleset\", it will show the "
162 "current ruleset directory name."), NULL,
163 CMD_ECHO_NONE, VCF_NONE, 0
165 {"wall", ALLOW_ADMIN,
166 /* TRANS: translate text between <> only */
167 N_("wall <message>"),
168 N_("Send message to all connections."),
169 N_("For each connected client, pops up a window showing the message "
170 "entered."), NULL,
171 CMD_ECHO_ADMINS, VCF_NONE, 0
173 {"connectmsg", ALLOW_ADMIN,
174 /* TRANS: translate text between <> only */
175 N_("connectmsg <message>"),
176 N_("Set message to show to connecting players."),
177 N_("Set message to send to clients when they connect.\n"
178 "Empty message means that no message is sent."), NULL,
179 CMD_ECHO_ADMINS, VCF_NONE, 0
181 {"vote", ALLOW_BASIC,
182 /* TRANS: translate text between [] only; "vote" is as a process */
183 N_("vote yes|no|abstain [vote number]"),
184 /* TRANS: "vote" as an instance of voting */
185 N_("Cast a vote."),
186 /* xgettext:no-c-format */
187 N_("A player with basic level access issuing a control level command "
188 "starts a new vote for the command. The /vote command followed by "
189 "\"yes\", \"no\", or \"abstain\", and optionally a vote number, "
190 "gives your vote. If you do not add a vote number, your vote applies "
191 "to the latest vote. You can only suggest one vote at a time. "
192 "The vote will pass immediately if more than half of the voters "
193 "who have not abstained vote for it, or fail immediately if at "
194 "least half of the voters who have not abstained vote against it."),
195 NULL,
196 CMD_ECHO_NONE, VCF_NONE, 0
198 {"debug", ALLOW_CTRL,
199 /* TRANS: translate text between <> only */
200 N_("debug diplomacy <player>\n"
201 "debug ferries\n"
202 "debug tech <player>\n"
203 "debug city <x> <y>\n"
204 "debug units <x> <y>\n"
205 "debug unit <id>\n"
206 "debug timing\n"
207 "debug info"),
208 N_("Turn on or off AI debugging of given entity."),
209 N_("Print AI debug information about given entity and turn continuous "
210 "debugging output for this entity on or off."), NULL,
211 CMD_ECHO_ADMINS, VCF_NONE, 0
213 {"set", ALLOW_CTRL,
214 /* TRANS: translate text between <> only */
215 N_("set <option-name> <value>"),
216 N_("Set server option."),
217 /* TRANS: don't translate text in '' */
218 N_("Set an option on the server. The syntax and legal values depend "
219 "on the option; see the help for each option. Some options are "
220 "\"bitwise\", in that they consist of a choice from a set of values; "
221 "separate these with |, for instance, '/set topology wrapx|iso'. For "
222 "these options, use syntax like '/set topology \"\"' to set no "
223 "values."), NULL,
224 CMD_ECHO_ALL, VCF_NONE, 50
226 {"team", ALLOW_CTRL,
227 /* TRANS: translate text between <> only */
228 N_("team <player> <team>"),
229 N_("Change a player's team affiliation."),
230 N_("A team is a group of players that start out allied, with shared "
231 "vision and embassies, and fight together to achieve team victory "
232 "with averaged individual scores. Each player is always a member "
233 "of a team (possibly the only member). This command changes which "
234 "team a player is a member of. Use \"\" if names contain whitespace."),
235 NULL,
236 CMD_ECHO_ALL, VCF_NONE, 50
238 {"rulesetdir", ALLOW_CTRL,
239 /* TRANS: translate text between <> only */
240 N_("rulesetdir <directory>"),
241 N_("Choose new ruleset directory or modpack."),
242 NULL, NULL,
243 CMD_ECHO_ALL, VCF_NONE, 50
245 {"metamessage", ALLOW_CTRL,
246 /* TRANS: translate text between <> only */
247 N_("metamessage <meta-line>"),
248 N_("Set metaserver info line."),
249 N_("Set user defined metaserver info line. If parameter is omitted, "
250 "previously set metamessage will be removed. For most of the time "
251 "user defined metamessage will be used instead of automatically "
252 "generated messages, if it is available."), NULL,
253 CMD_ECHO_ADMINS, VCF_NONE, 50
255 {"metapatches", ALLOW_HACK,
256 /* TRANS: translate text between <> only */
257 N_("metapatches <meta-line>"),
258 N_("Set metaserver patches line."), NULL, NULL,
259 CMD_ECHO_ADMINS, VCF_NONE, 0
261 {"metaconnection", ALLOW_ADMIN,
262 /* no translatable parameters */
263 SYN_ORIG_("metaconnection u|up\n"
264 "metaconnection d|down\n"
265 "metaconnection ?"),
266 N_("Control metaserver connection."),
267 N_("'metaconnection ?' reports on the status of the connection to metaserver. "
268 "'metaconnection down' or 'metac d' brings the metaserver connection down. "
269 "'metaconnection up' or 'metac u' brings the metaserver connection up."),
270 NULL,
271 CMD_ECHO_ADMINS, VCF_NONE, 0
273 {"metaserver", ALLOW_ADMIN,
274 /* TRANS: translate text between <> only */
275 N_("metaserver <address>"),
276 N_("Set address (URL) for metaserver to report to."), NULL, NULL,
277 CMD_ECHO_ADMINS, VCF_NONE, 0
279 {"aitoggle", ALLOW_CTRL,
280 /* TRANS: translate text between <> only */
281 N_("aitoggle <player-name>"),
282 N_("Toggle AI status of player."), NULL, NULL,
283 CMD_ECHO_ADMINS, VCF_NONE, 50
285 {"take", ALLOW_INFO,
286 /* TRANS: translate text between [] and <> only */
287 N_("take [connection-name] <player-name>"),
288 N_("Take over a player's place in the game."),
289 /* TRANS: Don't translate text between '' */
290 N_("Only the console and connections with cmdlevel 'hack' can force "
291 "other connections to take over a player. If you're not one of these, "
292 "only the <player-name> argument is allowed. If '-' is given for the "
293 "player name and the connection does not already control a player, one "
294 "is created and assigned to the connection. The 'allowtake' option "
295 "controls which players may be taken and in what circumstances."),
296 NULL,
297 CMD_ECHO_ADMINS, VCF_NONE, 0
299 {"observe", ALLOW_INFO,
300 /* TRANS: translate text between [] only */
301 N_("observe [connection-name] [player-name]"),
302 N_("Observe a player or the whole game."),
303 /* TRANS: Don't translate text between '' */
304 N_("Only the console and connections with cmdlevel 'hack' can force "
305 "other connections to observe a player. If you're not one of these, "
306 "only the [player-name] argument is allowed. If the console gives no "
307 "player-name or the connection uses no arguments, then the connection "
308 "is attached to a global observer. The 'allowtake' option controls "
309 "which players may be observed and in what circumstances."), NULL,
310 CMD_ECHO_ADMINS, VCF_NONE, 0
312 {"detach", ALLOW_INFO,
313 /* TRANS: translate text between <> only */
314 N_("detach <connection-name>"),
315 N_("Detach from a player."),
316 N_("Only the console and connections with cmdlevel 'hack' can force "
317 "other connections to detach from a player."), NULL,
318 CMD_ECHO_ADMINS, VCF_NONE, 0
320 {"create", ALLOW_CTRL,
321 /* TRANS: translate text between <> only */
322 N_("create <player-name> [ai type]"),
323 N_("Create an AI player with a given name."),
324 /* TRANS: don't translate text between single quotes */
325 N_("With the 'create' command a new player with the given name is "
326 "created.\n"
327 "The 'ai type' parameter can be used to select which AI module will be "
328 "used for the created player. This requires that Freeciv has been "
329 "compiled with loadable AI module support and that the respective module "
330 "has been loaded.\n"
331 "If the game has already started, the new player will have no units or "
332 "cities; also, if no free player slots are available, the slot of a "
333 "dead player can be reused (removing all record of that player from the "
334 "running game)."), NULL,
335 CMD_ECHO_ALL, VCF_NONE, 50
337 {"away", ALLOW_BASIC,
338 /* no translatable parameters */
339 SYN_ORIG_("away"),
340 N_("Set yourself in away mode. The AI will watch your back."),
341 N_("The AI will govern your nation but do minimal changes."), NULL,
342 CMD_ECHO_NONE, VCF_NONE, 50
344 {"novice", ALLOW_CTRL,
345 /* TRANS: translate text between <> only */
346 N_("novice\n"
347 "novice <player-name>"),
348 N_("Set one or all AI players to 'novice'."),
349 N_("With no arguments, sets all AI players to skill level 'novice', and "
350 "sets the default level for any new AI players to 'novice'. With an "
351 "argument, sets the skill level for that player only."), NULL,
352 CMD_ECHO_ALL, VCF_NONE, 50
354 {"easy", ALLOW_CTRL,
355 /* TRANS: translate text between <> only */
356 N_("easy\n"
357 "easy <player-name>"),
358 N_("Set one or all AI players to 'easy'."),
359 N_("With no arguments, sets all AI players to skill level 'easy', and "
360 "sets the default level for any new AI players to 'easy'. With an "
361 "argument, sets the skill level for that player only."), NULL,
362 CMD_ECHO_ALL, VCF_NONE, 50
364 {"normal", ALLOW_CTRL,
365 /* TRANS: translate text between <> only */
366 N_("normal\n"
367 "normal <player-name>"),
368 N_("Set one or all AI players to 'normal'."),
369 N_("With no arguments, sets all AI players to skill level 'normal', and "
370 "sets the default level for any new AI players to 'normal'. With an "
371 "argument, sets the skill level for that player only."), NULL,
372 CMD_ECHO_ALL, VCF_NONE, 50
374 {"hard", ALLOW_CTRL,
375 /* TRANS: translate text between <> only */
376 N_("hard\n"
377 "hard <player-name>"),
378 N_("Set one or all AI players to 'hard'."),
379 N_("With no arguments, sets all AI players to skill level 'hard', and "
380 "sets the default level for any new AI players to 'hard'. With an "
381 "argument, sets the skill level for that player only."), NULL,
382 CMD_ECHO_ALL, VCF_NONE, 50
384 {"cheating", ALLOW_CTRL,
385 /* TRANS: translate text between <> only */
386 N_("cheating\n"
387 "cheating <player-name>"),
388 N_("Set one or all AI players to 'cheating'."),
389 N_("With no arguments, sets all AI players to skill level 'cheating', and "
390 "sets the default level for any new AI players to 'cheating'. With an "
391 "argument, sets the skill level for that player only."), NULL,
392 CMD_ECHO_ALL, VCF_NONE, 50
394 {"experimental", ALLOW_CTRL,
395 /* TRANS: translate text between <> only */
396 N_("experimental\n"
397 "experimental <player-name>"),
398 N_("Set one or all AI players to 'experimental'."),
399 N_("With no arguments, sets all AI players to skill 'experimental', and "
400 "sets the default level for any new AI players to this. With an "
401 "argument, sets the skill level for that player only. THIS IS ONLY "
402 "FOR TESTING OF NEW AI FEATURES! For ordinary servers, this option "
403 "has no effect."), NULL,
404 CMD_ECHO_ALL, VCF_NONE, 50
406 {"cmdlevel", ALLOW_ADMIN,
407 /* TRANS: translate text between <> only */
408 N_("cmdlevel\n"
409 "cmdlevel <level>\n"
410 "cmdlevel <level> new\n"
411 "cmdlevel <level> first\n"
412 "cmdlevel <level> <connection-name>"),
413 N_("Query or set command access level access."),
414 N_("The command access level controls which server commands are available "
415 "to users via the client chatline. The available levels are:\n"
416 " none - no commands\n"
417 " info - informational or observer commands only\n"
418 " basic - commands available to players in the game\n"
419 " ctrl - commands that affect the game and users\n"
420 " admin - commands that affect server operation\n"
421 " hack - *all* commands - dangerous!\n"
422 "With no arguments, the current command access levels are reported. "
423 "With a single argument, the level is set for all existing "
424 "connections, and the default is set for future connections. "
425 "If 'new' is specified, the level is set for newly connecting clients. "
426 "If 'first come' is specified, the 'first come' level is set; it will be "
427 "granted to the first client to connect, or if there are connections "
428 "already, the first client to issue the 'first' command. "
429 "If a connection name is specified, the level is set for that "
430 "connection only.\n"
431 "Command access levels do not persist if a client disconnects, "
432 "because some untrusted person could reconnect with the same name. "
433 "Note that this command now takes connection names, not player names."
434 ), NULL,
435 CMD_ECHO_ADMINS, VCF_NONE, 50
437 {"first", ALLOW_BASIC,
438 /* no translatable parameters */
439 SYN_ORIG_("first"),
440 N_("If there is none, become the game organizer with increased permissions."),
441 NULL, NULL,
442 CMD_ECHO_ADMINS, VCF_NONE, 50
444 {"timeoutincrease", ALLOW_CTRL,
445 /* TRANS: translate text between <> only */
446 N_("timeoutincrease <turn> <turninc> <value> <valuemult>"),
447 N_("See \"help timeoutincrease\"."),
448 N_("Every <turn> turns, add <value> to timeout timer, then add <turninc> "
449 "to <turn> and multiply <value> by <valuemult>. Use this command in "
450 "concert with the option \"timeout\". Defaults are 0 0 0 1"), NULL,
451 CMD_ECHO_ALL, VCF_NONE, 50
453 {"cancelvote", ALLOW_BASIC,
454 /* TRANS: translate text between <> only; "vote" is as a process */
455 N_("cancelvote\n"
456 "cancelvote <vote number>\n"
457 "cancelvote all\n"),
458 /* TRANS: "vote" as a process */
459 N_("Cancel a running vote.\n"),
460 /* TRANS: "vote" as a process */
461 N_("With no arguments this command removes your own vote. If you have "
462 "an admin access level, you can cancel any vote by vote number, or "
463 "all votes with the \'all\' argument."), NULL,
464 CMD_ECHO_ADMINS, VCF_NONE, 0
466 {"ignore", ALLOW_INFO,
467 /* TRANS: translate text between <> and [] only */
468 N_("ignore [type=]<pattern>"),
469 N_("Block all messages from users matching the pattern."),
470 N_("The given pattern will be added to your ignore list; you will not "
471 "receive any messages from users matching this pattern. The type "
472 "may be either \"user\", \"host\", or \"ip\". The default type "
473 "(if omitted) is to match against the username. The pattern supports "
474 "unix glob style wildcards, i.e., * matches zero or more character, ? "
475 "exactly one character, [abc] exactly one of 'a' 'b' or 'c', etc. "
476 "To access your current ignore list, issue \"/list ignore\"."), NULL,
477 CMD_ECHO_NONE, VCF_NONE, 0
479 {"unignore", ALLOW_INFO,
480 /* TRANS: translate text between <> */
481 N_("unignore <range>"),
482 N_("Remove ignore list entries."),
483 N_("The ignore list entries in the given range will be removed; "
484 "you will be able to receive messages from the respective users. "
485 "The range argument may be a single number or a pair of numbers "
486 "separated by a dash '-'. If the first number is omitted, it is "
487 "assumed to be 1; if the last is omitted, it is assumed to be "
488 "the last valid ignore list index. To access your current ignore "
489 "list, issue \"/list ignore\"."), NULL,
490 CMD_ECHO_NONE, VCF_NONE, 0
492 {"playercolor", ALLOW_ADMIN,
493 /* TRANS: translate text between <> */
494 N_("playercolor <player-name> <color>\n"
495 "playercolor <player-name> reset"),
496 N_("Define the color of a player."),
497 N_("This command sets the color of a specific player, overriding any color "
498 "assigned according to the 'plrcolormode' setting.\n"
499 "The color is defined using hexadecimal notation (hex) for the "
500 "combination of Red, Green, and Blue color components (RGB), similarly "
501 "to HTML. For each component, the lowest (darkest) value is 0 (in "
502 "hex: 00), and the highest value is 255 (in hex: FF). The color "
503 "definition is simply the three hex values concatenated together "
504 "(RRGGBB). For example, the following command sets Caesar to pure red:\n"
505 " playercolor Caesar ff0000\n"
506 "Before the game starts, this command can only be used if the "
507 "'plrcolormode' setting is set to 'PLR_SET'; a player's color can be "
508 "unset again by specifying 'reset'.\n"
509 "Once the game has started and colors have been assigned, this command "
510 "changes the player color in any mode; 'reset' cannot be used.\n"
511 "To list the player colors, use 'list colors'."), NULL,
512 CMD_ECHO_NONE, VCF_NONE, 0
514 {"endgame", ALLOW_ADMIN,
515 /* no translatable parameters */
516 SYN_ORIG_("endgame"),
517 N_("End the game immediately in a draw."), NULL, NULL,
518 CMD_ECHO_ALL, VCF_NONE, 0
520 {"surrender", ALLOW_BASIC,
521 /* no translatable parameters */
522 SYN_ORIG_("surrender"),
523 N_("Concede the game."),
524 N_("This tells everyone else that you concede the game, and if all "
525 "but one player (or one team) have conceded the game in this way "
526 "then the game ends."), NULL,
527 CMD_ECHO_NONE, VCF_NONE, 0
529 {"remove", ALLOW_CTRL,
530 /* TRANS: translate text between <> only */
531 N_("remove <player-name>"),
532 N_("Fully remove player from game."),
533 N_("This *completely* removes a player from the game, including "
534 "all cities and units etc. Use with care!"), NULL,
535 CMD_ECHO_ALL, VCF_NONE, 50
537 {"save", ALLOW_ADMIN,
538 /* TRANS: translate text between <> only */
539 N_("save\n"
540 "save <file-name>"),
541 N_("Save game to file."),
542 N_("Save the current game to file <file-name>. If no file-name "
543 "argument is given saves to \"<auto-save name prefix><year>m.sav[.gz]\". "
544 "To reload a savegame created by 'save', start the server with "
545 "the command-line argument:\n"
546 " '--file <filename>' or '-f <filename>'\n"
547 "and use the 'start' command once players have reconnected."), NULL,
548 CMD_ECHO_ADMINS, VCF_NONE, 0
550 #ifdef DEBUG
551 {"scensave", ALLOW_ADMIN,
552 /* TRANS: translate text between <> only */
553 N_("scensave\n"
554 "scensave <file-name>"),
555 N_("Save game to file as scenario."),
556 N_("Save the current game to file <file-name> as scenario. If no file-name "
557 "argument is given saves to \"<auto-save name prefix><year>m.sav[.gz]\". "
558 "To reload a savegame created by 'scensave', start the server with "
559 "the command-line argument:\n"
560 " '--file <filename>' or '-f <filename>'\n"
561 "and use the 'start' command once players have reconnected."), NULL,
562 CMD_ECHO_ADMINS, VCF_NONE, 0
564 #endif /* DEBUG */
565 {"load", ALLOW_CTRL,
566 /* TRANS: translate text between <> only */
567 N_("load\n"
568 "load <file-name>"),
569 N_("Load game from file."),
570 N_("Load a game from <file-name>. Any current data including players, "
571 "rulesets and server options are lost."), NULL,
572 CMD_ECHO_ADMINS, VCF_NONE, 50
574 {"read", ALLOW_CTRL,
575 /* TRANS: translate text between <> only */
576 N_("read <file-name>"),
577 N_("Process server commands from file."), NULL, NULL,
578 CMD_ECHO_ADMINS, VCF_NONE, 50
580 {"write", ALLOW_HACK,
581 /* TRANS: translate text between <> only */
582 N_("write <file-name>"),
583 N_("Write current settings as server commands to file."), NULL, NULL,
584 CMD_ECHO_ADMINS, VCF_NONE, 0
586 {"reset", ALLOW_CTRL,
587 /* no translatable parameters */
588 SYN_ORIG_("reset"),
589 N_("Reset all server settings."),
590 N_("Reset all settings if it is possible. The following levels are "
591 "supported:\n"
592 " game - using the values defined at the game start\n"
593 " ruleset - using the values defined in the ruleset\n"
594 " script - using default values and rereading the start script\n"
595 " default - using default values\n"), NULL,
596 CMD_ECHO_ALL, VCF_NONE, 50
598 {"lua", ALLOW_ADMIN,
599 /* TRANS: translate text between <> only */
600 N_("lua cmd <script line>\n"
601 "lua file <script file>\n"
602 "lua <script line> (deprecated)"),
603 N_("Evaluate a line of Freeciv script or a Freeciv script file in the "
604 "current game."), NULL, NULL,
605 CMD_ECHO_ADMINS, VCF_NONE, 0
607 {"kick", ALLOW_CTRL,
608 /* TRANS: translate text between <> */
609 N_("kick <user>"),
610 N_("Cut a connection and disallow reconnect."),
611 N_("The connection given by the 'user' argument will be cut from the "
612 "server and not allowed to reconnect. The time the user wouldn't be "
613 "able to reconnect is controlled by the 'kicktime' setting."), NULL,
614 CMD_ECHO_ADMINS, VCF_NOPASSALONE, 50
616 {"delegate", ALLOW_BASIC,
617 /* TRANS: translate only text between [] and <> */
618 N_("delegate to <username> [player-name]\n"
619 "delegate cancel [player-name]\n"
620 "delegate take <player-name>\n"
621 "delegate restore\n"
622 "delegate show <player-name>"),
623 N_("Delegate control to another user."),
624 N_("Delegation allows a user to nominate another user who can temporarily "
625 "take over control of their player while they are away.\n"
626 "'delegate to <username>': allow <username> to 'delegate take' your "
627 "player.\n"
628 "'delegate cancel': nominated user can no longer take your player.\n"
629 "'delegate take <player-name>': take control of a player who has been "
630 "delegated to you. (Behaves like 'take', except that the 'allowtake' "
631 "restrictions are not enforced.)\n"
632 "'delegate restore': relinquish control of a delegated player (opposite "
633 "of 'delegate take') and restore your previous view, if any. (This also "
634 "happens automatically if the player's owner reconnects.)\n"
635 "'delegate show': show who control of your player is currently "
636 "delegated to, if anyone.\n"
637 "The [player-name] argument can only be used by connections with "
638 "cmdlevel 'admin' or above to force the corresponding change of the "
639 "delegation status."), NULL,
640 CMD_ECHO_NONE, VCF_NONE, 0
642 {"fcdb", ALLOW_ADMIN,
643 /* TRANS: translate text between <> only */
644 N_("fcdb reload\n"
645 "fcdb lua <script>"),
646 N_("Manage the authentication database."),
647 N_("The argument 'reload' causes the database script file to be re-read "
648 "after a change, while the argument 'lua' evaluates a line of Lua "
649 "script in the context of the Lua instance for the database."), NULL,
650 CMD_ECHO_ADMINS, VCF_NONE, 0
652 {"mapimg", ALLOW_ADMIN,
653 /* TRANS: translate text between <> only */
654 N_("mapimg define <mapdef>\n"
655 "mapimg show <id>|all\n"
656 "mapimg create <id>|all\n"
657 "mapimg delete <id>|all\n"
658 "mapimg colortest"),
659 N_("Create image files of the world/player map."),
660 NULL, mapimg_help,
661 CMD_ECHO_ADMINS, VCF_NONE, 50
663 {"rfcstyle", ALLOW_HACK,
664 /* no translatable parameters */
665 SYN_ORIG_("rfcstyle"),
666 N_("Switch server output between 'RFC-style' and normal style."), NULL, NULL,
667 CMD_ECHO_ADMINS, VCF_NONE, 0
669 {"serverid", ALLOW_INFO,
670 /* no translatable parameters */
671 SYN_ORIG_("serverid"),
672 N_("Simply returns the id of the server."), NULL, NULL,
673 CMD_ECHO_NONE, VCF_NONE, 0
678 /**************************************************************************
679 Return command by its number.
680 **************************************************************************/
681 const struct command *command_by_number(int i)
683 fc_assert_ret_val(i >= 0 && i < CMD_NUM, NULL);
684 return &commands[i];
687 /**************************************************************************
688 Return name of the command
689 **************************************************************************/
690 const char *command_name(const struct command *pcommand)
692 return pcommand->name;
695 /**************************************************************************
696 Return name of the command by commands number.
697 **************************************************************************/
698 const char *command_name_by_number(int i)
700 return command_by_number(i)->name;
703 /**************************************************************************
704 Returns the synopsis text of the command (translated).
705 **************************************************************************/
706 const char *command_synopsis(const struct command *pcommand)
708 return SYN_TRANS_(pcommand->synopsis);
711 /**************************************************************************
712 Returns the short help text of the command (translated).
713 **************************************************************************/
714 const char *command_short_help(const struct command *pcommand)
716 return _(pcommand->short_help);
719 /**************************************************************************
720 Returns the extra help text of the command (translated).
721 The caller must free this string.
722 **************************************************************************/
723 char *command_extra_help(const struct command *pcommand)
725 if (pcommand->extra_help_func) {
726 fc_assert(pcommand->extra_help == NULL);
727 return pcommand->extra_help_func();
728 } else if (pcommand->extra_help) {
729 return fc_strdup(_(pcommand->extra_help));
730 } else {
731 return NULL;
735 /**************************************************************************
737 **************************************************************************/
738 enum cmdlevel command_level(const struct command *pcommand)
740 return pcommand->level;
743 /****************************************************************************
744 Retrurns the flag of the command to notify the users about its usage.
745 ****************************************************************************/
746 enum cmd_echo command_echo(const struct command *pcommand)
748 return pcommand->echo;
751 /**************************************************************************
752 Returns a bit-wise combination of all vote flags set for this command.
753 **************************************************************************/
754 int command_vote_flags(const struct command *pcommand)
756 return pcommand ? pcommand->vote_flags : 0;
759 /**************************************************************************
760 Returns the vote percent required for this command to pass in a vote.
761 **************************************************************************/
762 int command_vote_percent(const struct command *pcommand)
764 return pcommand ? pcommand->vote_percent : 0;