]> git.pond.sub.org Git - empserver/log
empserver
10 years agoSuppress duplicates in output of git ls-files
Markus Armbruster [Sat, 18 Jan 2014 11:10:50 +0000 (12:10 +0100)]
Suppress duplicates in output of git ls-files

Happens during merges; can mess up tests badly.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests/fire: Use build command for setup
Markus Armbruster [Sat, 18 Jan 2014 10:17:49 +0000 (11:17 +0100)]
tests/fire: Use build command for setup

Setup uses edit to build units.  Stupid idea, because that misses unit
initialization normally done by build, directly or via
unit_wipe_orders().  Use build instead.

Changes test output harmlessly: ship xbuilt, ybuilt go from 0,0 to the
building sector, ship#0's builder goes from 98 to 0, all ships'
cargostart and cargoend go from 0 to -1, jhb range from 0 to 35, and
land unit retreat percentage from 0 to 42.

Setup no longer needs country 98.  Drop it.

Setup no longer copies 2,0 to 0,0 messing up its distribution center.
Harmless.

Setup doesn't need POGO's tech level anymore, so don't set it to 400.
Nukes are now built at their required tech level.  Also harmless.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests/bridgefall: Use build command for setup
Markus Armbruster [Sat, 18 Jan 2014 11:33:11 +0000 (12:33 +0100)]
tests/bridgefall: Use build command for setup

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests/actofgod: Use build command for setup
Markus Armbruster [Sat, 18 Jan 2014 09:58:57 +0000 (10:58 +0100)]
tests/actofgod: Use build command for setup

final.xdump changes, because setup no longer copies 3,-1 to 1,-1,
messing up its distribution center.  Harmless.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests/build: Use build command for setup
Markus Armbruster [Sat, 18 Jan 2014 09:56:56 +0000 (10:56 +0100)]
tests/build: Use build command for setup

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agobuild: Reword bridge next to land messages to mention the sector
Markus Armbruster [Sat, 18 Jan 2014 09:50:16 +0000 (10:50 +0100)]
build: Reword bridge next to land messages to mention the sector

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agobuild: Deities build ex nihilo
Markus Armbruster [Sat, 18 Jan 2014 09:26:49 +0000 (10:26 +0100)]
build: Deities build ex nihilo

Let deities build in any sector.  If the deity's tech level is too
low, use the required tech level instead.  Don't require or use
materials, work or money.  Bridge spans still require support.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agobridgefall: Factor bridge_support_at() out of bridgefall()
Markus Armbruster [Sat, 18 Jan 2014 08:10:21 +0000 (09:10 +0100)]
bridgefall: Factor bridge_support_at() out of bridgefall()

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agobridgefall: Fix loss of bridge support with EASY_BRIDGES off
Markus Armbruster [Fri, 17 Jan 2014 19:54:27 +0000 (20:54 +0100)]
bridgefall: Fix loss of bridge support with EASY_BRIDGES off

With EASY_BRIDGES off, bridge spans need to be next to a bridge tower
or a bridge head that is at least 20% efficient to remain standing.

When a bridge tower or head gets damaged below 20%, adjacent spans may
lose support.  Bug: they don't fall when they're next to another
bridge head below 20%.

Has always been broken.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agobridgefall: Fix support loss with EASY_BRIDGES and BRIDGETOWERS on
Markus Armbruster [Fri, 17 Jan 2014 19:50:58 +0000 (20:50 +0100)]
bridgefall: Fix support loss with EASY_BRIDGES and BRIDGETOWERS on

With EASY_BRIDGES on, bridge spans need to be next to land or a bridge
tower to remain standing.

Land can't go away, but a bridge tower can fall.  Bridge spans next to
it may lose support then.  Bug: they don't fall when they lose support
that way.  Fix that.

Broken in commit 40eb78e, v4.3.12.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoRevert "Remove dead EASY_BRIDGES code from bridgefall()"
Markus Armbruster [Fri, 17 Jan 2014 19:31:32 +0000 (20:31 +0100)]
Revert "Remove dead EASY_BRIDGES code from bridgefall()"

This reverts commit df62b8604d7607947131a9d4c04a92d08954ca34.

The next commit will revive that code.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agobridgefall: Fix harmless coordinate normalization bug
Markus Armbruster [Fri, 17 Jan 2014 18:28:03 +0000 (19:28 +0100)]
bridgefall: Fix harmless coordinate normalization bug

bridgefall() wants to do this:

    for all possible pairs of directions (i, j)
        if i and j cancel out
    continue
do stuff

It does it by adding direction offsets to start coordinates, and
comparing the resulting coordinates to the start coordinates.  Fine,
except it neglects to normalize the resulting coordinates.

Harmless in practice, because you can get an incorrect result only
when the path goes around the world, which it can do only in a 4x2
world.

Fix it anyway, by testing "directions cancel out" directly.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agopath: New DIR_BACK()
Markus Armbruster [Fri, 17 Jan 2014 17:49:48 +0000 (18:49 +0100)]
path: New DIR_BACK()

Actually pathfind.c's rev_dir() turned into a macro, to make it
available elsewhere.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests/bridgefall: New; exercising splashing of bridges
Markus Armbruster [Thu, 16 Jan 2014 20:59:41 +0000 (21:59 +0100)]
tests/bridgefall: New; exercising splashing of bridges

Stuff sitting on bridges isn't covered, yet.  tests/fire has some.  To
be moved here eventually.

The test exposes bugs.  They're marked "BUG:" in the test input.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoedit: Fix reporting of no-op unit location change
Markus Armbruster [Tue, 14 Jan 2014 22:26:06 +0000 (23:26 +0100)]
edit: Fix reporting of no-op unit location change

Report "unchanged" instead of "changed from X,Y to X,Y".  Screwed up
in v4.3.32.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Zap setup's news and lost items, like telegrams
Markus Armbruster [Tue, 14 Jan 2014 20:48:38 +0000 (21:48 +0100)]
tests: Zap setup's news and lost items, like telegrams

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agobuild: Report missing stuff more nicely for bridges
Markus Armbruster [Mon, 13 Jan 2014 08:23:26 +0000 (09:23 +0100)]
build: Report missing stuff more nicely for bridges

By switching build_nuke() to sector_can_build(), build_charge().

Report missing available work, or else missing materials, or else
missing money, for consistency with the other things you can build.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agobuild: Report missing stuff more nicely for nukes
Markus Armbruster [Sun, 12 Jan 2014 22:00:38 +0000 (23:00 +0100)]
build: Report missing stuff more nicely for nukes

By switching build_nuke() to sector_can_build(), build_charge().
Changes reporting of missing stuff to be like for ships, planes and
land units:

* Report missing available work, or else missing materials, or else
  missing money instead of materials, or else money, or else work.

* Report what materials are missing instead of how much materials have
  to be there.

* Clean up stray ';' in reporting of missing work.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agobuild scrap: Redo 4.2.3's fix for manufacturing military
Markus Armbruster [Sun, 12 Jan 2014 17:40:45 +0000 (18:40 +0100)]
build scrap: Redo 4.2.3's fix for manufacturing military

scrap has always returned the scrapped planes' full crew, regardless
of efficiency.  build, however, charged only 10%.  If you built ten
planes with one crew each, you used up one military.  Or none, if you
abused random rounding.  If you scrapped them again, you got ten back.
Pretty pricey way to manufacture military, but wrong all the same.

4.2.3 plugged this hole by making build never round military to zero.
Ugly special case, and not documented.  Also doesn't prevent abuse of
random rounding for planes requiring more than 10 crew, but such
planes don't exist in the stock game.

Redo this fix:

1. Make scrap return crew proportional to efficiency, randomly
rounded.  Note that scrap returns only two thirds of the other
materials, rounded down.  Recycling materials isn't perfect, but
recycling aircrew is.

2. Drop the special case from build: treat military just like other
materials.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agobuild: Report missing stuff more nicely for ship, plane, land units
Markus Armbruster [Sun, 12 Jan 2014 17:33:13 +0000 (18:33 +0100)]
build: Report missing stuff more nicely for ship, plane, land units

If both materials and avail are missing, report missing avail instead
of materials, to avoid tempting the player to move in materials only
to discover avail is lacking, too.

Report what materials are missing instead of just "Not enough
materials".  Does not yet include military for planes, but that's
next.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agobuild: Stop abuse of construction material random rounding
Markus Armbruster [Sun, 12 Jan 2014 17:24:06 +0000 (18:24 +0100)]
build: Stop abuse of construction material random rounding

Construction materials required for building a ship, plane or land
unit are rounded randomly.  Crafty players exploit this to save
materials: they put just enough materials there so that build succeeds
when it rounds down.  Then they simply keep trying until it succeeds.

Planes and land units are built at 10%, so rounding happens when
materials for 100% aren't multiples of ten.  If they're below ten, you
can even build without materials.  In the stock game, this is the case
for linf, and many plane types.

Ships are built at 20%, so multiples of five aren't rounded.  Ship
building never rounds in the stock game.

Prevent the abuse of random rounding by requiring the required
fractional amount rounded up to be present.  Don't change the actual
charging of materials; that's still randomly rounded.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agobuild: Factor code out of build_ship(), build_plane(), build_land()
Markus Armbruster [Sun, 12 Jan 2014 17:13:15 +0000 (18:13 +0100)]
build: Factor code out of build_ship(), build_plane(), build_land()

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests/fire: Rename test scripts for clarity
Markus Armbruster [Sun, 12 Jan 2014 15:00:13 +0000 (16:00 +0100)]
tests/fire: Rename test scripts for clarity

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests/build: New; exercises build command
Markus Armbruster [Sun, 12 Jan 2014 14:57:22 +0000 (15:57 +0100)]
tests/build: New; exercises build command

drnuke_const is not covered, yet.

Random rounding causes some complications: sometimes build succeeds
without materials.  Troublesome spots are clearly marked in the test
input.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Don't leak telegram counters from setup into test
Markus Armbruster [Sun, 12 Jan 2014 08:30:54 +0000 (09:30 +0100)]
tests: Don't leak telegram counters from setup into test

Moving the telegram files away isn't enough, we also have to reset
nat_tgms.  actofgod/setup-POGO does it already, but fire/setup-POGO
doesn't.  Do it in begin_test instead, right where the telegram files
are moved away.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoRemove option TREATIES
Markus Armbruster [Sat, 11 Jan 2014 17:02:53 +0000 (18:02 +0100)]
Remove option TREATIES

TREATIES has issues:

* Treaties can cover attack, assault, paradrop, board, lboard, fire,
  build (s|p|l|n) and enlist, but not bomb, launch, torpedo and
  enlistment centers.

* Usability is very poor.  While a treaty is in effect, every player
  action that violates a treaty condition triggers a prompt like this:

    This action is in contravention of  treaty #0 (with Curmudgeon)
    Do you wish to go ahead anyway? [yn]

  If you decline, the action is not executed.  If you accept, it is.
  In both cases, your decision is reported in the news.

  You cannot get rid of these prompts until the treaty expires.

* Virtually nobody uses them.

* Virtually unused code is buggy code.  There is at least one race
  condition: multifire() reads the firing sector, ship or land unit
  before the treaty prompt, and writes it back after, triggering a
  generation oops.  Any updates made by other threads while trechk()
  waits for input are wiped out, triggering a seqno mismatch oops.

* The treaty prompts could confuse smart clients that aren't prepared
  for them.  WinACE isn't, but is reported to work anyway at least
  common usage.  Ron Koenderink (the WinACE maintainer) suspects there
  could be a few situations where it will fail.

This feature is not earning its keep.  Remove it.  Drop command
treaty, consider treaty, offer treaty, xdump treaty, reject treaties.
Output of accept changed, obviously.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoconsider: Clean up "either treaty or loan" assumptions
Markus Armbruster [Sat, 11 Jan 2014 16:10:20 +0000 (17:10 +0100)]
consider: Clean up "either treaty or loan" assumptions

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoconsider: Clean up recovery from an impossible error
Markus Armbruster [Sat, 11 Jan 2014 16:03:49 +0000 (17:03 +0100)]
consider: Clean up recovery from an impossible error

Drop the unhelpful message to the player, and fail the command.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoaccept: rejectname() makes no sense outside acce(); inline
Markus Armbruster [Sat, 11 Jan 2014 14:23:26 +0000 (15:23 +0100)]
accept: rejectname() makes no sense outside acce(); inline

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agofire: Fix ship retreat when helpless
Markus Armbruster [Wed, 8 Jan 2014 18:16:21 +0000 (19:16 +0100)]
fire: Fix ship retreat when helpless

Two bugs.  First, multifire() checks the condition only for surface
ships, not for submarines.  Second, multifire() neglects to write back
the ship after retreating it.  The player is told the ship retreats,
but it actually stays where it is.

Broken since retreat was added in Chainsaw.  Previous fixes (commit
8065fe8, v4.3.1 and commit de2651e, v4.3.19) "fixed" only the
bulletin.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agofire: Report which ship or land unit is ready to fire
Markus Armbruster [Wed, 8 Jan 2014 07:14:43 +0000 (08:14 +0100)]
fire: Report which ship or land unit is ready to fire

Just like for sectors.  Useful when multiple ships or land units fire.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agofire: Change "Sector X,Y firing" to "Sector X,Y ready to fire"
Markus Armbruster [Wed, 8 Jan 2014 07:11:27 +0000 (08:11 +0100)]
fire: Change "Sector X,Y firing" to "Sector X,Y ready to fire"

It's not firing, yet.

While there, trim an unwanted blank line before reporting the first
sector ready.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agofire: Drop useless special case "shp_fire() returns zero"
Markus Armbruster [Tue, 7 Jan 2014 20:52:32 +0000 (21:52 +0100)]
fire: Drop useless special case "shp_fire() returns zero"

Can't actually happen with the current damage formulas.  If it could,
then the special treatment would be inconsistent with sectors and land
units.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agofire: Check land unit guns earlier, drop useless checks
Markus Armbruster [Tue, 7 Jan 2014 20:48:37 +0000 (21:48 +0100)]
fire: Check land unit guns earlier, drop useless checks

We check all necessary conditions for being able to fire before
prompting for a target.  Except for land unit guns.  Clean that up.

fort_fire(), shp_fire() or lnd_fire() fail only when the fort, ship or
land unit can't fire.  If that happens, our checking is incomplete.
Oops then.

We recheck some of the necessary conditions after getting the target.
However, because the command fails when the firing sector, ship or
land unit has changed since the first check, these rechecks can't
fail.  Drop them.

Note that the rechecks were just as useless before commit 66165f3
fixed fire to fail on change, because they rechecked the unchanged
cached copy instead of the possibly changed original.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agofire: Suppress bulletin when player shells his own ship
Markus Armbruster [Tue, 7 Jan 2014 19:50:42 +0000 (20:50 +0100)]
fire: Suppress bulletin when player shells his own ship

Has always been suppressed for shelling own sectors.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests/fire: Give all land unit targets SAM cargo
Markus Armbruster [Tue, 7 Jan 2014 19:49:26 +0000 (20:49 +0100)]
tests/fire: Give all land unit targets SAM cargo

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests/fire: Add another salvo at own ship
Markus Armbruster [Tue, 7 Jan 2014 19:14:54 +0000 (20:14 +0100)]
tests/fire: Add another salvo at own ship

The existing one does no damage.  Add one that does.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests/fire: Drop reset of #1's BTUs between sub-tests
Markus Armbruster [Thu, 16 Jan 2014 19:30:09 +0000 (20:30 +0100)]
tests/fire: Drop reset of #1's BTUs between sub-tests

This was a lame attempt at limiting the ripple effect of adding /
removing commands.  Better means are now available, so drop it.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests/fire: Use commands designed for humans rather than xdump
Markus Armbruster [Thu, 16 Jan 2014 19:29:25 +0000 (20:29 +0100)]
tests/fire: Use commands designed for humans rather than xdump

Changed xdump output is too painful to review.  final.xdump should
still catch changes that are visible only in xdump.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: New test-suite-only command __cmd
Markus Armbruster [Mon, 13 Jan 2014 20:27:16 +0000 (21:27 +0100)]
tests: New test-suite-only command __cmd

Adding or removing a command to/from a test has unfortunate effects:

* Before the previous commit: if the command consumes pseudorandom
  numbers, all subsequent users of pseudorandom numbers get different
  ones.  This has always been a major headache.

* Since the previous commit: all subsequent users of pseudorandom
  numbers get different ones whether the command consumes any or not.
  That's even worse.

* If the command uses BTUs, subsequent prompts are changed.  Not
  nearly as bad as the above, but still annoying.

Create a new command __cmd to allow compensating for adding/removing
commands for tests.  Throw in the ability to compensate treasury
changes for good measure.  Three arguments: command count, BTU use,
money use.

Usage example: say you add a convert command to a test, and it uses 3
BTUs and $15.  Then you compensate by adding "__cmd added 1 3 15"
right after it.

The command must not be available unless running_test_suite is on, of
course.  Make it require the new player command capability TESTING,
and give that to all players when running_test_suite is on.

The command is intentionally not documented in info.  Switch
running_test_suite off for info-test, to hide it (and any future
TESTING commands) from info-test.

Suppress the command counter increment for TESTING commands, so they
can be used without upsetting pseudorandom numbers

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Make robust against variations in PRNG use
Markus Armbruster [Mon, 13 Jan 2014 19:24:37 +0000 (20:24 +0100)]
tests: Make robust against variations in PRNG use

Tests need repeatable pseudorandom numbers to yield repeatable
results.  We seed the pseudorandom number generator with a fixed value
(emp_server -R) to make it produce the same sequence of numbers every
time.  But whenever code exercised by a test is changed to consume
fewer or more of them, all subsequent users get different numbers
regardless.  The ensuing test result changes are extremely tedious to
review.

To address this problem, reseed the PRNG with the count of commands
right before executing a command when running_test_suite is on.  This
way, the effect of perturbing the PRN sequence lasts only until the
next command.

Note that the next command could be another player's.  Doesn't matter.

Adding or removing commands now upsets the PRN sequence even for
commands that don't consume PRNs.  The next commit will take care of
that.

Perturbs test results across the board.  Hopefully, that'll happen
much less frequently now.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Enable running_test_suite by default
Markus Armbruster [Mon, 13 Jan 2014 18:30:23 +0000 (19:30 +0100)]
tests: Enable running_test_suite by default

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoeconfig: New key running_test_suite, for use by tests
Markus Armbruster [Mon, 13 Jan 2014 18:29:18 +0000 (19:29 +0100)]
econfig: New key running_test_suite, for use by tests

For now, it just logs "Configured for testing" on startup, and prints
a scary warning on player login.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: New make target check-accept
Markus Armbruster [Mon, 13 Jan 2014 18:22:21 +0000 (19:22 +0100)]
tests: New make target check-accept

Updates expected results from actual results, for review and commit.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Run server with -E crash-dump
Markus Armbruster [Sun, 12 Jan 2014 16:21:04 +0000 (17:21 +0100)]
tests: Run server with -E crash-dump

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Fix normalization of nat_timeused in prompt in journal
Markus Armbruster [Sat, 11 Jan 2014 11:29:07 +0000 (12:29 +0100)]
tests: Fix normalization of nat_timeused in prompt in journal

Command prompts show nat_timeused rounded down to minutes.  They need
to be normalized, or else tests can fail when they take too long, or
cross midnight.  Formatted prompts are normalized correctly (not
actually used since commit 9ca3fa9), but the journal contains raw
prompts.  Normalize them, too.

Smoke test's journal.log is affected, because the server charges at
least 15s per login, which adds up into minutes in this test.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests/normalize.pl: Drop match option g where it's not necessary
Markus Armbruster [Sat, 11 Jan 2014 11:26:07 +0000 (12:26 +0100)]
tests/normalize.pl: Drop match option g where it's not necessary

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Use feed_files for setup scripts
Markus Armbruster [Sat, 11 Jan 2014 11:09:34 +0000 (12:09 +0100)]
tests: Use feed_files for setup scripts

To make setup scripting more similar to test scripting.  Also permits
use of countries other than POGO there, but that isn't necessary right
now.

Setup scripts renamed from init_script to setup-POGO.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Name compared files relative to sandbox in output
Markus Armbruster [Sat, 11 Jan 2014 08:53:44 +0000 (09:53 +0100)]
tests: Name compared files relative to sandbox in output

Instead of relative to build directory.  Shorter, and independent of
the path from build to source directory.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Rename final xdump files to final.xdump
Markus Armbruster [Wed, 8 Jan 2014 20:45:08 +0000 (21:45 +0100)]
tests: Rename final xdump files to final.xdump

The other test output files have fixed names, and having just one with
a name that varies with the test name complicates things with no gain.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Disable GODNEWS by default
Markus Armbruster [Wed, 8 Jan 2014 20:23:24 +0000 (21:23 +0100)]
tests: Disable GODNEWS by default

Only actofgod-test wants it.  Enable it there.  The others either
don't want it (fire-test), or don't care.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Factor feed_dir out of fire-test and smoke-test
Markus Armbruster [Wed, 8 Jan 2014 20:18:05 +0000 (21:18 +0100)]
tests: Factor feed_dir out of fire-test and smoke-test

Smoke test's player input files renamed from $cnum to $ordnum-$cname
to keep feed_dir simple.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Move "not expected to work" warning into test-common.sh
Markus Armbruster [Wed, 8 Jan 2014 19:51:52 +0000 (20:51 +0100)]
tests: Move "not expected to work" warning into test-common.sh

Warn the first time a server is started.  Incorrect for info-test with
POSIX threads, so suppress the warning there.

Improve the warning message a bit while we're at it.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years ago.gitignore: Ignore sandbox
Markus Armbruster [Tue, 7 Jan 2014 20:22:55 +0000 (21:22 +0100)]
.gitignore: Ignore sandbox

Missed in commit 49b2b13, v4.3.31.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Normalize trailing white space in test output completely
Markus Armbruster [Tue, 7 Jan 2014 19:07:38 +0000 (20:07 +0100)]
tests: Normalize trailing white space in test output completely

Commit 37ff377 stripped trailing white space in test output, except
for journal.log, where it stripped it only from player output.  This
misses the space preceeding player empty output, and doesn't cover
equally annoying trailing white space elsewhere, such as the space
preceeding empty input and trailing white space in prompts.  Testing
the latter could be marginally useful, but let's keep things simple,
and strip all trailing white space for now.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests/fire: New; exercises fire command
Markus Armbruster [Mon, 6 Jan 2014 14:54:13 +0000 (15:54 +0100)]
tests/fire: New; exercises fire command

Return fire not covered, yet.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoupdate: Set thread stack size to 512 KiB
Markus Armbruster [Mon, 6 Jan 2014 14:26:24 +0000 (15:26 +0100)]
update: Set thread stack size to 512 KiB

Empire 2 settled on this formula for the stack size:

stacksize = 100000 +
    /* finish_sects */ WORLD_X * WORLD_Y * (2 * sizeof(double) +
    sizeof(char *));

Obviously attempts to provide space for a known configuration-
dependent stack hog.  The hog went away when finish_sects()'s arrays
became dynamically allocated in 4.2.0.

Adjusting for that by dropping the extra term might well do (I observe
only a few KiB of stack used on my system).  But let's set it to 512
KiB instead to be on the safe side.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoaccept: Resize thread stack to avoid stack smash for small worlds
Markus Armbruster [Mon, 6 Jan 2014 14:11:12 +0000 (15:11 +0100)]
accept: Resize thread stack to avoid stack smash for small worlds

I observed a stack overflow in news command on my x86_64 system
running Fedora 18.

Empire 2 settled on this formula for the stack size:

    stacksize = 100000
    /* budget */  + MAX(WORLD_SZ() * sizeof(int) * 7,
    /* power */ MAXNOC * sizeof(struct powstr));

Obviously attempts to provide space for known configuration-dependent
stack hogs.

The first hog is allegedly budget.  Bogus since day one: its large
arrays were static in Empire 2, and became dynamically allocated in
Empire 3.

The second one makes some sense: powe() has a struct powstr[MAXNOC].
It also has an int[MAXNOC], which isn't accounted for.

Except for ridiculously small worlds, the second term is smaller, and
only the (bogus) first term matters.

Two hogs are missing: head() has a struct histstr[MAXNOC][MAXNOC], and
news() has a short[MAXNOC][MAXNOC].  It also calls head().

I looked for more hogs with "gcc -fstack-usage", and found none.

On my x86_64 system, a news command needs almost 107KiB of stack.
Only slightly less when compiled for 32 bit.  Stack overrun for worlds
with fewer than some 320 sectors, thus unlikely to bite in real games.

Increase player stack size to 1 MiB.  Using MAXNOC to size the stack
isn't worth the trouble.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests/info: New; checks info and code agree on commands
Markus Armbruster [Sun, 5 Jan 2014 15:44:29 +0000 (16:44 +0100)]
tests/info: New; checks info and code agree on commands

Replaces info/checklist.pl, which has been broken since
commit 56d9445, v4.3.0.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoinfo/toc: New; generated machine-readable table of contents
Markus Armbruster [Sun, 5 Jan 2014 15:34:12 +0000 (16:34 +0100)]
info/toc: New; generated machine-readable table of contents

Next commit will put it to use.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Make helper begin_test accept any number of arguments
Markus Armbruster [Sun, 5 Jan 2014 14:54:22 +0000 (15:54 +0100)]
tests: Make helper begin_test accept any number of arguments

Zero arguments mean "read the script from stdin", so you can write
begin_test <<EOF...

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoinfo: Nicer remaking of info subject index pages
Markus Armbruster [Sun, 5 Jan 2014 13:14:41 +0000 (14:14 +0100)]
info: Nicer remaking of info subject index pages

Give quiet-command a more useful last argument.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoinfo/show: Update example to current output
Markus Armbruster [Sun, 5 Jan 2014 12:05:39 +0000 (13:05 +0100)]
info/show: Update example to current output

White space change only, actually.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoorder: Trim trailing space from usage string
Markus Armbruster [Sun, 5 Jan 2014 12:04:58 +0000 (13:04 +0100)]
order: Trim trailing space from usage string

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoTrim trailing white space from source code
Markus Armbruster [Sun, 5 Jan 2014 12:04:05 +0000 (13:04 +0100)]
Trim trailing white space from source code

Normally, git's pre-commit hook protects us from them.  However, when
expected test output contains trailing white space, we have to bypass
commit hooks.  Unwanted space can then slip in if you don't pay
attention.  I obviously didn't; clean up.

The previous commit should reduce the need for such hook suppression.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Normalize trailing white space away in test output
Markus Armbruster [Sun, 5 Jan 2014 11:39:29 +0000 (12:39 +0100)]
tests: Normalize trailing white space away in test output

We don't really care for it there, and git's pre-commit hook flags it,
which is annoying.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agomaps: Trim unwanted trailing space from map decoration
Markus Armbruster [Sun, 5 Jan 2014 10:59:40 +0000 (11:59 +0100)]
maps: Trim unwanted trailing space from map decoration

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoresource: Trim unwanted trailing space from output
Markus Armbruster [Sun, 5 Jan 2014 10:56:01 +0000 (11:56 +0100)]
resource: Trim unwanted trailing space from output

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoedit: Trim unwanted trailing space from output
Markus Armbruster [Sun, 5 Jan 2014 10:50:49 +0000 (11:50 +0100)]
edit: Trim unwanted trailing space from output

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agocommands: Trim obvious silly trailing space from output
Markus Armbruster [Sun, 5 Jan 2014 10:49:11 +0000 (11:49 +0100)]
commands: Trim obvious silly trailing space from output

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Document log file normalization a bit better
Markus Armbruster [Sun, 5 Jan 2014 09:23:47 +0000 (10:23 +0100)]
tests: Document log file normalization a bit better

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: New helper function feed_input, for comment support
Markus Armbruster [Sat, 4 Jan 2014 11:53:10 +0000 (12:53 +0100)]
tests: New helper function feed_input, for comment support

feed_input drops lines starting with a bar character '|', so they can
serve as comments.  Syntax chosen because such lines shouldn't be
needed in tests.  In particular, the server already ignores such lines
when it reads commands, because they get parsed as empty command with
a pipeline, and empty commands get ignored, regardless of
redirections.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Use only files known to git
Markus Armbruster [Fri, 3 Jan 2014 14:03:42 +0000 (15:03 +0100)]
tests: Use only files known to git

Filename expansion can pick up junk files.  Use git-ls-files instead.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoUpdate copyright notice
Markus Armbruster [Thu, 2 Jan 2014 10:17:38 +0000 (11:17 +0100)]
Update copyright notice

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoUpdate known contributors comments
Markus Armbruster [Thu, 2 Jan 2014 10:12:15 +0000 (11:12 +0100)]
Update known contributors comments

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agostart stop: Don't operate on dead units when used by a deity
Markus Armbruster [Sun, 29 Dec 2013 19:41:30 +0000 (20:41 +0100)]
start stop: Don't operate on dead units when used by a deity

Screwed up when start, stop were extended to units in commit eb1512d,
v4.3.6.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoedit: Implement edit nuke
Markus Armbruster [Sun, 29 Dec 2013 19:36:22 +0000 (20:36 +0100)]
edit: Implement edit nuke

Has been "not implemented yet" since the dawn of time.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoedit: Suppress bulletin on no-op unit location change
Markus Armbruster [Sun, 29 Dec 2013 19:30:14 +0000 (20:30 +0100)]
edit: Suppress bulletin on no-op unit location change

Screwed up in commit a03d804f, v4.3.32.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agostockpile: New command, counterpart of fleetadd, wingadd, army
Markus Armbruster [Sun, 29 Dec 2013 18:55:44 +0000 (19:55 +0100)]
stockpile: New command, counterpart of fleetadd, wingadd, army

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agonukes: Enable group syntax for <NUKES> arguments
Markus Armbruster [Sun, 29 Dec 2013 18:53:42 +0000 (19:53 +0100)]
nukes: Enable group syntax for <NUKES> arguments

Not interesting without way to make stockpiles.  That's next.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agonukes: New selector stockpile
Markus Armbruster [Sun, 29 Dec 2013 18:43:47 +0000 (19:43 +0100)]
nukes: New selector stockpile

Not interesting without way to make stockpiles.  Coming soon.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agostart stop: Add missing <NUKES> to usage string
Markus Armbruster [Sun, 29 Dec 2013 18:21:11 +0000 (19:21 +0100)]
start stop: Add missing <NUKES> to usage string

Forgotten in commit eb1512d, v4.3.6.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agondump nuke: Fix usage string: <NUKES> instead of <SECTS>
Markus Armbruster [Sun, 29 Dec 2013 18:07:03 +0000 (19:07 +0100)]
ndump nuke: Fix usage string: <NUKES> instead of <SECTS>

nuke's usage string was broken in Empire 2.  ndump's usage string has
always been wrong.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoinfo/ndump: Belatedly update for v4.3.3's nuke storage change
Markus Armbruster [Sun, 29 Dec 2013 18:05:46 +0000 (19:05 +0100)]
info/ndump: Belatedly update for v4.3.3's nuke storage change

Commit 2e40a4b (v4.3.3) changed ndump, but not its info page.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agowingadd: Charge no BTUs, for consistency with fleetadd and army
Markus Armbruster [Sun, 29 Dec 2013 17:24:15 +0000 (18:24 +0100)]
wingadd: Charge no BTUs, for consistency with fleetadd and army

Chainsaw 3 made fleetadd and army cost no BTUs, but wingadd was
forgotten.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoedit: Add editing of ship, plane and land unit type
Markus Armbruster [Sun, 29 Dec 2013 12:52:37 +0000 (13:52 +0100)]
edit: Add editing of ship, plane and land unit type

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoedit: Factor edit_item() out of edit_ship(), edit_land()
Markus Armbruster [Sun, 29 Dec 2013 10:51:57 +0000 (11:51 +0100)]
edit: Factor edit_item() out of edit_ship(), edit_land()

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoedit: Make unit owner change away from POGO work
Markus Armbruster [Sun, 29 Dec 2013 09:37:11 +0000 (10:37 +0100)]
edit: Make unit owner change away from POGO work

Units owned by POGO are not in use.  Giving a unit to POGO destroys
it.  The opposite doesn't work, however: the unit prewrite hooks give
it right back to POGO, because efficiency is below the minimum.  Make
it work by also increasing efficiency to minimum.

Note that you can't use this to create a unit that doesn't already
exist in the respective file.  That's because edit's second argument
selects from existing objects only.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Factor out begin_tests(), end_tests()
Markus Armbruster [Sat, 28 Dec 2013 15:50:14 +0000 (16:50 +0100)]
tests: Factor out begin_tests(), end_tests()

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agotests: Drop smoke.out, actofgod.out
Markus Armbruster [Sat, 28 Dec 2013 15:32:38 +0000 (16:32 +0100)]
tests: Drop smoke.out, actofgod.out

Uninteresting since commit 9ca3fa9, v4.3.32.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agouninstall: Fix to remove everything installed under $(datadir)
Markus Armbruster [Thu, 26 Dec 2013 17:30:50 +0000 (18:30 +0100)]
uninstall: Fix to remove everything installed under $(datadir)

Info pages in $(datadir)/empire/info.html/ and the directory
$(datadir)/empire/ aren't removed.  Fix that.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoinstall: Remove stale formatted info pages
Markus Armbruster [Thu, 26 Dec 2013 17:15:56 +0000 (18:15 +0100)]
install: Remove stale formatted info pages

Blow away $(einfodir) and $(ehtmldir).  Without this, formatted pages
can linger after page removal.  Matters, because info.c searches
$(einfodir) rather than the index $(einfodir)/all.  Same for web
servers and $(ehtmldir).

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoUpdate change log again for 4.3.32 v4.3.32
Markus Armbruster [Sun, 25 Aug 2013 07:56:58 +0000 (09:56 +0200)]
Update change log again for 4.3.32

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoactofgod: Simplify fmtflags()'s error checking
Markus Armbruster [Sun, 25 Aug 2013 07:51:39 +0000 (09:51 +0200)]
actofgod: Simplify fmtflags()'s error checking

Permit finding length by passing no buffer.  Not currently used.

Oops at most once.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoserver: Grow small thread stacks from 50 KiB to 64 KiB
Markus Armbruster [Sat, 17 Aug 2013 15:57:40 +0000 (17:57 +0200)]
server: Grow small thread stacks from 50 KiB to 64 KiB

Affected are threads AcceptPlayers, MarketUpdate, shutdownSeq.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agolwp: Increase EventHandler's stack size from 16 KiB to 64 KiB
Markus Armbruster [Sat, 17 Aug 2013 14:34:26 +0000 (16:34 +0200)]
lwp: Increase EventHandler's stack size from 16 KiB to 64 KiB

Stack overflow observed on IBM Power 730 Express running AIX 7.1.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agosrc/client/Makefile.in: Avoid :=, it breaks traditional make
Markus Armbruster [Sat, 17 Aug 2013 14:13:09 +0000 (16:13 +0200)]
src/client/Makefile.in: Avoid :=, it breaks traditional make

Broken in commit c4ffd0a, v4.3.0.  Observed on AIX 7.1.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoconfigure: Fix check for term.h to include curses.h first
Markus Armbruster [Sat, 17 Aug 2013 14:05:37 +0000 (16:05 +0200)]
configure: Fix check for term.h to include curses.h first

Traditional curses needs this.  Observed on AIX 7.1.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoUpdate change log for 4.3.32
Markus Armbruster [Sun, 11 Aug 2013 12:25:33 +0000 (14:25 +0200)]
Update change log for 4.3.32

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
10 years agoaccept: Drop outdated FIXME SO_KEEPALIVE
Markus Armbruster [Sun, 11 Aug 2013 11:53:52 +0000 (13:53 +0200)]
accept: Drop outdated FIXME SO_KEEPALIVE

SO_KEEPALIVE isn't useless with long idle timeouts.  Before v4.3.30's
idle timeout changes, such long timeouts had serious drawbacks (easy
denial of service), but they're just fine since then.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>