]> git.pond.sub.org Git - empserver/commit
edit: Fix and unify handling of invalid country numbers
authorMarkus Armbruster <armbru@pond.sub.org>
Tue, 15 Jan 2013 19:30:36 +0000 (20:30 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 6 Jun 2013 17:52:26 +0000 (19:52 +0200)
commit381c479ff8a05cbbe25820435d823167b4c41193
tree2a7c40ba7c18846ac5f51b27650e92676cd8a2d3
parentaa07f3393a9280225cde7297934a2309a49983b9
edit: Fix and unify handling of invalid country numbers

Negative numbers and numbers greater or equal than MAXNOC are invalid.
edit handles such arguments inconsistently:

    cmd  key  struct member   arg < 0     arg >= MAXNOC
    ---------------------------------------------------
    edit l o  sct_own         reject      MAXNOC - 1
           O  sct_oldown      reject      MAXNOC - 1
           X  sct_che_target  0           MAXNOC - 1
    edit s O  shp_own         cast        skip
    edit u O  lnd_own         cast        skip
    edit p O  pln_own         cast        skip

Legend:

    0           replace arg by 0
    MAXNOC - 1  replace arg by MAXNOC - 1
    reject      command fails
    cast        replace arg by (natid)arg
                bug: can be >= MAXNOC!
    skip        ignore this key and arg
                bug: telexes the owner he lost the unit, which is a lie

Unify to reject.  Matches setsector.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/commands/edit.c
tests/actofgod/actofgod.xdump
tests/actofgod/journal.log