]> git.pond.sub.org Git - empserver/commit
contact: Initialize contact state properly
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 23 Oct 2016 15:36:23 +0000 (17:36 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 18:09:20 +0000 (20:09 +0200)
commitcf4e9bc89d90bf3463b45ee72800e4307f96b414
treedf99e101758816b6b3c7e424d798cb604f0049e9
parentae011d089bb073bc8eb2da8b65764adacf0615f6
contact: Initialize contact state properly

A country must always be in contact of itself when option HIDDEN is
enabled.  The code ensures this by establishing contact whenever a
player logs in, in init_nats().  This is not the proper place.  Game
state should be initialized in empfile's oninit() callback, in this
case nat_oninit().  Do that, and drop the putcontact() from
init_nats().

Note that option LOSE_CONTACT only affects contact to other countries:
agecontact() doesn't age the country's contact to itself.

Use the opportunity to initialize contact so that getcontact() works
even when HIDDEN is disabled.  Just cleanup, it isn't actually called
then.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
15 files changed:
src/lib/common/filetable.c
src/lib/player/init_nats.c
tests/actofgod/final.xdump
tests/bridgefall/final.xdump
tests/build/final.xdump
tests/fairland/final.xdump
tests/files/final.xdump
tests/fire/final.xdump
tests/navi-march/final.xdump
tests/retreat/final.xdump
tests/smoke/fairland.xdump
tests/smoke/final.xdump
tests/smoke/journal.log
tests/torpedo/final.xdump
tests/update/final.xdump