/*
 *  Empire - A multi-player, client/server Internet based war game.
 *  Copyright (C) 1986-2021, Dave Pare, Jeff Bailey, Thomas Ruschak,
 *                Ken Stevens, Steve McClure, Markus Armbruster
 *
 *  Empire is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  ---
 *
 *  See files README, COPYING and CREDITS in the root of the source
 *  tree for related information and legal notices.  It is expected
 *  that future projects/authors will amend these files as needed.
 *
 *  ---
 *
 *  empmod.c: List all commands for Empire
 *
 *  Known contributors to this file:
 *     Dave Pare, 1986
 *     Jeff Bailey
 *     Thomas Ruschak, 1992
 *     Ken Stevens, 1995
 *     Steve McClure, 1996-2000
 *     Markus Armbruster, 2004-2015
 */

/*
 * Fun fact: named empmod for historical reasons --- Empire used to be
 * broken into seven modules on the venerable PDP-11 so it could fit
 * in 64k I/D space.
 */

#include <config.h>

#include "com.h"
#include "player.h"
#include "prototypes.h"
#include "testing.h"

struct cmndstr player_coms[] = {
/*  command form                       cost	addr    permit */
    {"accept  [as-COUNTRY]",
     0, c_accept, C_MOD, NORM},
    {"add <NAT> <NAME> <REP> <STATUS>",
     0, c_add, C_MOD, GOD},
    {"announce",
     0, c_telegram, C_MOD, 0},
    {"anti <SECTS>",
     3, c_anti, C_MOD, NORM + MONEY + CAP},
    {"apropos <topic>",
     0, c_apropos, 0, 0},
    {"arm <PLANE> <NUKE> <airburst?>",
     3, c_arm, C_MOD, NORM + CAP},
    {"army <ARMY> <UNITS>",
     0, c_army, C_MOD, NORM},
    {"assault <to-SECT> <from-SHIP> [<forts?> <ships?> <arty?> <planes?>]",
     3, c_assault, C_MOD, NORM + MONEY + CAP},
    {"attack <SECT> [<forts?> <ships?> <arty?> <planes?>]",
     3, c_attack, C_MOD, NORM + MONEY + CAP},
    {"bdes <SECTS> <type>",
     0, c_bdes, C_MOD, NORM},
    {"bestpath <SECTS> <SECTS>",
     0, c_bestpath, 0, NORM},
    {"bmap <SECTS|SHIP> [s|l|n|p|r|t|*|h]",
     0, c_map, C_MOD, NORM},
    {"board <to-SHIP> [<from-SHIP>|<from-sector>]",
     3, c_board, C_MOD, NORM + MONEY + CAP},
    {"bomb <bomber-PLANES> <fighter-PLANES> <pin|strat> <ap-SECT> <PATH|DESTINATION>",
     2, c_bomb, C_MOD, NORM + MONEY + CAP},
    {"break",
     0, c_break, C_MOD, SANCT},
    {"budget",
     1, c_budget, 0, NORM},
    {"build <s|l|b|p|n|t> <SECTS> <type|dir> [<number> <tech> <sure?>]",
     1, c_build, C_MOD, NORM + MONEY + CAP},
    {"buy <COMM> <LOT#> <BID/UNIT> <DEST>",
     1, c_buy, C_MOD, NORM + MONEY + CAP},
    {"bye",
     0, c_quit, 0, 0},
    {"capital <SECT>",
     0, c_capital, C_MOD, NORM},
    {"cargo <SHIPS>",
     0, c_cargo, 0, NORM},
    {"census <SECTS>",
     0, c_census, 0, NONVIS},
    {"change <country|representative> <NAME>",
     0, c_change, C_MOD, NONVIS},
    {"coastwatch <SECTS>",
     1, c_coastwatch, C_MOD, NORM + CAP},
    {"collect <LOAN> <SECT>",
     2, c_collect, C_MOD, NORM + MONEY + CAP},
    {"commodity <SECTS>",
     0, c_commodity, 0, NONVIS},
    {"consider <loan> <LOAN> <acc|decl|post>",
     1, c_consider, C_MOD, NORM + CAP},
    {"convert <SECTS> <NUM>",
     2, c_convert, C_MOD, NORM + MONEY + CAP},
    {"country <NATS>",
     0, c_country, 0, 0},
    {"cutoff <SECTS>",
     0, c_cutoff, 0, NORM},
    {"declare <all|friend|neut|hos|war> <NATS>",
     2, c_declare, C_MOD, NORM + CAP},
    {"deliver <COMM> <SECTS> [q|<THRESH>] [<DIR>]",
     1, c_deliver, C_MOD, NORM},
    {"demobilize <SECTS> <NUM> <active-reserve?>",
     1, c_demobilize, C_MOD,
     NORM + MONEY + CAP},
    {"designate <SECTS> <type>",
     1, c_designate, C_MOD, NORM},
    {"disable",
     0, c_disable, C_MOD, GOD},
    {"disarm <PLANE>",
     2, c_disarm, C_MOD, NORM + CAP},
    {"distribute <SECTS> <DISTSECT|.|h>",
     1, c_distribute, C_MOD, NORM},
    {"drop <cargo-PLANES> <fighter-PLANES> <ap-SECT> <PATH|DESTINATION> <COMM>",
     1, c_drop, C_MOD, NORM + MONEY + CAP},
    {"dump <SECTS> [<fields>]",
     0, c_dump, 0, NORM},
    {"echo [<string>]",
     0, c_echo, 0, 0},
    {"edit <l|s|p|u|n|c> <SECTS|SHIPS|PLANES|LANDS|NUKES|NATS> [<KEY> <VALUE>]...",
     0, c_edit, C_MOD, GOD},
    {"enable",
     0, c_enable, C_MOD, GOD},
    {"enlist <SECTS> <NUM>",
     2, c_enlist, C_MOD, NORM + MONEY + CAP},
    {"execute <INPUT FILE>",
     0, c_execute, 0, EXEC},
    {"explore <c|m> <SECT> <NUM> <PATH|DESTINATION>",
     1, c_explore, C_MOD, NORM + MONEY + CAP},
    {"financial",
     0, c_financial, 0, 0},
    {"fire <TYPE> <from-SECTS | SHIPS | UNITS> [TO-SECT | SHIP]",
     1, c_fire, C_MOD, NORM + MONEY + CAP},
    {"flash <COUNTRY> [<message>]",
     0, c_flash, 0, 0},
    {"fleetadd <FLEET> <SHIPS>",
     0, c_fleetadd, C_MOD, NORM},
    {"fly <cargo-PLANES> <fighter-PLANES> <ap-SECT> <PATH|DESTINATION> <COM>",
     2, c_fly, C_MOD, NORM + MONEY + CAP},
    {"force",
     0, c_force, C_MOD, GOD},
    {"fortify <UNITS> <MOB>",
     1, c_fortify, C_MOD, NORM + CAP},
    {"give <COMM> <SECTS> <NUM>",
     0, c_give, C_MOD, GOD},
    {"grind <SECTS> <NUM>",
     1, c_grind, C_MOD, NORM + MONEY + CAP},
    {"harden <PLANES> <NUM>",
     2, c_harden, C_MOD, NORM + MONEY + CAP},
    {"headlines [days]",
     0, c_headlines, 0, 0},
    {"help <topic>",
     0, c_info, 0, 0},
    {"improve <road|rail|defense> <SECTS> <NUM>",
     1, c_improve, C_MOD, NORM + MONEY + CAP},
    {"info <topic>",
     0, c_info, 0, 0},
    {"land <UNITS>",
     0, c_land, 0, NORM},
    {"launch <PLANES> <SECT|SHIP>",
     3, c_launch, C_MOD, NORM + MONEY + CAP},
    {"lbmap <SECTS|LAND UNIT> [s|l|n|p|r|t|*|h]",
     0, c_map, C_MOD, NORM},
    {"lboard <to-LAND> [<from-sector>]",
     3, c_lboard, C_MOD, NORM + MONEY + CAP},
    {"lcargo <UNITS>",
     0, c_lcargo, 0, NORM},
    {"ldump <UNITS> [<fields>]",
     0, c_ldump, 0, NORM},
    {"ledger <LOANS>",
     0, c_ledger, 0, NORM},
    {"level <SECTS>",
     0, c_level, 0, NORM},
    {"list",
     0, c_list, 0, 0},
    {"lload <COMM|\"land\"|\"plane\"> <UNITS> <NUM|UNITS|PLANES>",
     1, c_lload, C_MOD, NORM + CAP},
    {"llookout <UNITS>",
     1, c_llookout, 0, NORM + CAP},
    {"lmap <SECTS|LAND UNIT> [s|l|n|p|*|h]",
     0, c_map, C_MOD, NORM},
    {"lmine <UNITS>",
     2, c_lmine, C_MOD, NORM + MONEY + CAP},
    {"load <COMM|\"land\"|\"plane\"> <SHIPS> <NUM|UNITS|PLANES>",
     1, c_load, C_MOD, NORM + CAP},
    {"lookout <SHIPS>",
     1, c_lookout, 0, NORM + CAP},
    {"lost",
     0, c_lost, 0, NORM},
    {"lradar <UNITS | SECTS>",
     1, c_lradar, C_MOD, NORM + CAP},
    {"lretreat <UNITS|ARMY> [q | <PATH> <i|h|b|c>]",
     1, c_lretreat, C_MOD, NORM + CAP},
    {"lstat <UNITS>",
     0, c_lstat, 0, NORM},
    {"ltend <COMM> <tender-SHIPS> <NUM> <UNITS>",
     1, c_ltend, C_MOD, NORM + CAP},
    {"lunload <COMM|\"land\"|\"plane\"> <UNITS> <NUM|UNITS|PLANES>",
     1, c_lload, C_MOD, NORM + CAP},
    {"map <SECTS|SHIP> [s|l|n|p|*|h]",
     0, c_map, C_MOD, NORM},
    {"march <UNITS> <PATH|DESTINATION>",
     1, c_march, C_MOD, NORM + CAP},
    {"market <COMM|\"all\">",
     0, c_market, C_MOD, NORM},
    {"mine <SHIPS>",
     2, c_mine, C_MOD, NORM + MONEY + CAP},
    {"mission <TYPE> <PLANES|SHIPS|UNITS> <mission type> <op sect> [<radius>]",
     2, c_mission, C_MOD, NORM + CAP},
    {"morale <UNITS> <retreat%>",
     1, c_morale, C_MOD, NORM + CAP},
    {"motd",
     0, c_motd, 0, 0},
    {"move <COMM> <SECT> <NUM> <PATH|DESTINATION>",
     1, c_move, C_MOD, NORM + CAP},
    {"name <SHIPS> <NAME>",
     0, c_name, C_MOD, NORM},
    {"nation [as-COUNTRY]",
     0, c_nation, 0, 0},
    {"navigate <SHIPS> <PATH|DESTINATION>",
     1, c_navigate, C_MOD, NORM + CAP},
    {"nbmap <SECTS|NUKE> [s|l|n|p|r|t|*|h]",
     0, c_map, C_MOD, NORM},
    {"ndump <NUKES>",
     0, c_ndump, 0, NORM},
    {"newcap <NAT> <SECTOR>",
     0, c_newcap, C_MOD, GOD},
    {"neweff <SECTS>",
     0, c_neweff, 0, NORM},
    {"newspaper [days]",
     0, c_newspaper, 0, 0},
    {"nmap <SECTS|NUKE> [s|l|n|p|*|h]",
     0, c_map, C_MOD, NORM},
    {"nuke <NUKES>",
     0, c_nuke, 0, NORM},
    {"offer <loan> <NAT> [<NUM> <DAYS> <IRATE>]",
     1, c_offer, C_MOD, NORM + MONEY + CAP},
    {"origin <SECT|COUNTRY|~>",
     1, c_origin, C_MOD, NORM},
    {"paradrop <cargo-PLANES> <fighter-PLANES> <ap-SECT> <PATH|DESTINATION>",
     3, c_paradrop, C_MOD, NORM + MONEY + CAP},
    {"path <SECT>",
     0, c_path, C_MOD, NORM},
    {"payoff <SHIPS>",
     0, c_payoff, 0, NORM},
    {"pbmap <SECTS|PLANE> [s|l|n|p|r|t|*|h]",
     0, c_map, C_MOD, NORM},
    {"pboard <PLANES>",
     3, c_pboard, C_MOD, NORM + MONEY + CAP},
    {"pdump <PLANES> [<fields>]",
     0, c_pdump, 0, NORM},
    {"peek <SECTS>",
     0, c_peek, 0, GOD},
    {"plane <SECTS>",
     0, c_plane, 0, NORM},
    {"players",
     0, c_players, 0, 0},
    {"pmap <SECTS|PLANE> [s|l|n|p|*|h]",
     0, c_map, C_MOD, NORM},
    {"power [\"new\"|\"update\"] [<NUMBER OF COUNTRIES> | \"country\" <NATS>]",
     0, c_power, C_MOD, 0},
    {"pray",
     0, c_telegram, C_MOD, NORM},
    {"production <SECTS>",
     0, c_production, 0, NORM},
    {"pstat <PLANES>",
     0, c_pstat, 0, NORM},
    {"quit",
     0, c_quit, 0, 0},
    {"radar <SHIPS | SECTS>",
     1, c_radar, C_MOD, NORM + CAP},
    {"range <PLANES> <range>",
     1, c_range, C_MOD, NORM + CAP},
    {"read [yes|no|<CNUM/CNAME>]",
     0, c_read, C_MOD, NONVIS},
    {"realm <number> [<SECTS>]",
     0, c_realm, C_MOD, NORM},
    {"recon <spy-PLANES> <fighter-PLANES> <ap-SECT> <PATH|DESTINATION>",
     3, c_recon, C_MOD, NORM + MONEY + CAP},
    {"reject <reject|accept> <announcements|mail|loans> <NAT>",
     2, c_reject, C_MOD, NORM},
    {"relations  [as-COUNTRY]",
     0, c_relations, 0, 0},
    {"reload",
     0, c_reload, C_MOD, GOD},
    {"repay <LOAN> <NUM>",
     1, c_repay, C_MOD, NORM + MONEY + CAP},
    {"report <NATS>",
     0, c_report, 0, 0},
    {"reset <lot #> <0|price>",
     1, c_reset, C_MOD, NORM + CAP},
    {"resource <SECTS>",
     0, c_resource, 0, NONVIS},
    {"retreat <SHIPS|FLEET> [q | <PATH> <i|t|s|h|b|d|u|c>]",
     1, c_retreat, C_MOD, NORM + CAP},
    {"route <COMM> <SECTS>",
     1, c_route, C_MOD, NORM},
    {"sabotage <UNITS>",
     1, c_sabotage, C_MOD, NORM + MONEY + CAP},
    {"satellite <PLANE> [<se|sh|l> [?cond&cond&...]]",
     1, c_satellite, C_MOD, NORM + CAP},
    {"sbmap <SECTS|SHIP> [s|l|n|p|r|t|*|h]",
     0, c_map, C_MOD, NORM},
    {"scrap <s|p|l> <SHIPS|PLANES|UNITS>",
     2, c_scrap, C_MOD, NORM + MONEY + CAP},
    {"scuttle <s|p|l> <SHIPS|PLANES|UNITS>",
     5, c_scuttle, C_MOD, NORM + CAP},
    {"sdump <SHIPS> [<fields>]",
     0, c_sdump, 0, NORM},
    {"sect <SECTS>",
     0, c_sect, C_MOD, NORM},
    {"sell <COMM> <SECTS> <NUM> <NUM>",
     1, c_sell, C_MOD, NORM + CAP},
    {"set <TYPE> <SHIPS|PLANES|UNITS|NUKES> <PRICE>",
     1, c_set, C_MOD, NORM + CAP},
    {"setresource <type> <SECTS> <NUM>",
     0, c_setresource, C_MOD, GOD},
    {"setsector <type> <SECTS> <NUM>",
     0, c_setsector, C_MOD, GOD},
    {"sharebmap <CNUM/CNAME> <SECTS> [<des>]",
     0, c_sharebmap, C_MOD, NORM},
    {"shark <LOAN>",
     25, c_shark, C_MOD, NORM + MONEY + CAP},
    {"ship <SHIPS>",
     0, c_ship, 0, NORM},
    {"shoot <c|u> <SECTS> <NUMBER>",
     3, c_shoot, C_MOD, NORM + MONEY + CAP},
    {"show <TYPE> <\"build\"|\"stats\"|\"cap\"> [<tech>]\n"
     "\tshow <bridge|item|news|product|tower>\n"
     "\tshow updates [<NUM>]>",
     0, c_show, 0, 0},
    {"shutdown <minutes> <disable update?>",
     0, c_shutdown, 0, GOD},
    {"sinfrastructure <SECTS>",
     0, c_sinfrastructure, 0, NONVIS},
    {"skywatch <SECTS>",
     1, c_skywatch, C_MOD, NORM + CAP},
    {"smap <SECTS|SHIP> [s|l|n|p|*|h]",
     0, c_map, C_MOD, NORM},
    {"sonar <SHIPS> <brief?>",
     1, c_sonar, C_MOD, NORM + CAP},
    {"spy <SECTS>",
     1, c_spy, C_MOD, NORM + CAP},
    {"sstat <SHIPS>",
     0, c_sstat, 0, NORM},
    {"start <TYPE> <SECTS|PLANES|SHIPS|UNITS|NUKES>",
     1, c_start, C_MOD, NORM},
    {"starvation [<SECTS>|l <UNITS>|s <SHIPS>]",
     0, c_starvation, 0, NORM},
    {"stockpile <STOCKPILE> <NUKES>",
     0, c_stockpile, C_MOD, NORM},
    {"stop <TYPE> <SECTS|PLANES|SHIPS|UNITS|NUKES>",
     1, c_stop, C_MOD, NORM},
    {"strength <SECTS>",
     1, c_strength, C_MOD, NORM},
    {"supply <LAND UNITS>",
     1, c_supply, C_MOD, NORM + CAP},
    {"survey <SELECTOR> <SECTS>",
     0, c_survey, C_MOD, NORM},
    {"swapsector <SECT> <SECT>",
     0, c_swapsector, C_MOD, GOD},
    {"sweep <sweep-PLANES> <fighter-PLANES> <ap-SECT> <PATH|DESTINATION>",
     3, c_recon, C_MOD, NORM + MONEY + CAP},
    {"telegram <NATS>...",
     0, c_telegram, C_MOD, NORM},
    {"tend <COMM|\"land\"> <tender-SHIPS> <NUM|UNIT> <dest-SHIPS>",
     1, c_tend, C_MOD, NORM + CAP},
    {"territory <SECTS> <NUMBER> [<FIELD>]",
     0, c_territory, C_MOD, NORM},
    {"test <COMM> <SECT> <NUM> <PATH|DESTINATION>",
     1, c_move, C_MOD, NORM},
    {"threshold <COMM> <SECTS> <THRESH>",
     1, c_threshold, C_MOD, NORM},
    {"toggle [inform|flash|beep|coastwatch|sonar|techlists] [on|off]",
     0, c_toggle, C_MOD, 0},
    {"torpedo <submarine-SHIPS> <target-SHIP>",
     3, c_torpedo, C_MOD, NORM + MONEY + CAP},
    {"trade",
     1, c_trade, C_MOD, NORM + MONEY + CAP},
    {"transport <\"nuke\"|\"plane\"> <NUKES|PLANES> <PATH|DESTINATION>",
     1, c_transport, C_MOD, NORM + CAP},
    {"turn <\"on\"|\"off\"|\"mess\">",
     0, c_turn, C_MOD, GOD},
    {"unload <COMM|\"land\"|\"plane\"> <SHIPS> <NUM|UNIT|PLANE>",
     1, c_load, C_MOD, NORM + CAP},
    {"update",
     0, c_update, 0, 0},
    {"upgrade <s|p|l> <SHIPS|PLANES|UNITS>",
     1, c_upgrade, C_MOD, NORM + MONEY + CAP},
    {"version",
     0, c_version, 0, 0},
    {"wall [<message>]",
     0, c_wall, 0, NORM},
    {"wingadd <WING> <PLANES>",
     0, c_wingadd, C_MOD, NORM},
    {"wipe <SECTS>",
     1, c_wipe, C_MOD, NORM},
    {"wire [yes|no|<days>]",
     0, c_read, C_MOD, 0},
    {"work <LAND UNITS> <AMOUNT>",
     1, c_work, C_MOD, NORM + MONEY + CAP},
    {"xdump [\"meta\"] <TYPE> [<RECORDS>]",
     0, c_xdump, 0, 0},
    {"zdone <y|n|c>",
     0, c_zdone, C_MOD, NORM},
    {"__cmd \"added\" <NUM> <NUM> <NUM>",
     0, c___cmd, 0, TESTING},
    {NULL, 0, NULL, 0, 0}
};
