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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>