retreat lretreat: Change query syntax to match mission

Optional arguments can save typing.  Mandatory arguments are more
easily discoverable: just run the command and answer its prompts.
Empire traditionally uses optional arguments only for expert features.
Consider mission:

    [0:640] Command : mission
    Ship, plane or land unit (p,sh,la)? s
    ship(s)? 0
    Mission (int, sup, osup, dsup, esc, res, air, query, clear)? int
    operations point? .
    frg  frigate Early Bird(#0) on an interdiction mission, centered on 21,-3, radius 0
    1 ship

Compare retreat:

    [0:638] Command : retreat
    ship(s)? 0
    shp#     ship type       x,y   fl path       as flt?  flags
       0 frg  frigate       21,-3
    1 ship

Arguments are not discoverable this way.

Change retreat to work like mission: make the second argument
mandatory, and if it's 'q', show retreat orders, else treat it as path
and ask for conditions:

    [0:637] Command : retreat
    ship(s)? 0
    Retreat path, or q to query? jj
    Retreat conditions ('?' to list available ones)? i
    shp#     ship type       x,y   fl path       as flt?  flags
       0 frg  frigate       21,-3     jj                  i
    1 ship

To reduce smart client and script breakage, keep retreat with one
argument working as before, but print a deprecation warning.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-01-10 13:43:23 +01:00
parent 4de4da259a
commit 482d54c953
7 changed files with 55 additions and 24 deletions

View file

@ -1,7 +1,8 @@
.TH Command LRETREAT
.NA lretreat "Set retreat conditions/paths for units or armies"
.LV Expert
.SY "lretreat <UNIT/ARMY> [<PATH> <CONDITIONS>]"
.SY "lretreat <UNIT/ARMY> <PATH> <CONDITIONS>"
.SY "lretreat <UNIT/ARMY> q"
The lretreat command allows you to examine or modify the retreat
paths and conditions of your land units.
.s1
@ -9,7 +10,8 @@ The first argument selects land units to view or give orders for.
If an army designation is given when specifying orders, the orders
apply to all members of that army.
.s1
Without further arguments, current retreat orders are shown.
With 'q' instead of a retreat path, the current retreat paths and
conditions will be listed.
The report format contains the following fields:
.s1
.in \w'unit type\0\0'u
@ -30,15 +32,13 @@ what conditions will trigger retreat.
.in
.s1
For example:
.EX lretreat *
.EX lretreat * q
.NF
lnd# unit type x,y ar path as army? flags
0 cav cavalry 2,0 jjuuj I
1 unit
.FI
.s1
.L Overview
.s1
A player may give retreat orders for a land unit or an army. Retreat
orders include a set of conditions that determine when the army/unit
will retreat, and a path that the army/unit will follow. When a condition