Commit graph

5097 commits

Author SHA1 Message Date
c8b51ec1a8 config: Define infra build cost and mobility use per 100%
Infrastructure build cost is defined by infra column dcost (struct
sctintrins member in_dcost).  It's the cost per point of efficiency.
In contrast, sector and unit build cost is defined for 100%, by
sect-chr, ship-chr, plane-chr, land-chr, nuke-chr column cost.

Switch to build cost per 100%, for flexibility and consistency:
replace struct sctintrins member in_dcost by in_cost, and selector
dcost by cost.

With cost values that aren't multiple of 100, the build cost may have
to be rounded.  Do this exactly like we round sector build cost: the
amount is limited to money * 100 / cost rounded down, but the money
charged is actual amount * money / 100 rounded randomly.

Do the same for mobility use: replace struct sctintrins member
in_mcost by in_bmobil, and selector mcost by bmobil, with similar
rounding.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
f9114aecd8 improve: Improve legibility a bit
improve() uses intrchr[type] a lot.  Use new variable incp as
abbreviation.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
b4e9c5dcb7 show: Show infra costs in the same format as sector build costs
Use similar column headings, and show cost for 100% instead of 1%.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
4c21c69acc lboard: Don't permit boarding of embarked land units
You can board land units loaded on a ship or land unit.  This makes no
sense.  Reject attempts to board land units on a ship or land unit
exactly like attempts to board land units that don't exist.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
2315b50e52 update/revolt: Fix guerrilla liberating old-owned sector
Guerrilla are created loyal to the old owner.  When the sector
converts, they switch their allegiance to POGO.  This is a bit of a
hack.

When guerrilla win their fight for freedom in an old-owned sector, the
old-owner duly changes to POGO.  However, the owner doesn't.  Broken
in 4.2.6.  The "Sector X,Y has been retaken!" message is still sent to
the "new" sector owner.

Simply restoring the owner change lost back then would restore a bug
that goes back to 2.3.7: takeover() doesn't run when an old-owned
sector is liberated.  So fix the bug by making that unconditional.

Land units reported captured are actually destroyed, because POGO
can't own any.  Oh well.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
025e9cc258 update/revolt: De-quadruplicate land unit casualty code
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
35ecc008ce update/revolt: Destroy land units only when casualties demand it
take_casualties() first applies casualties without destroying land
units, and if any remain, applies them by destroying land units.  This
is wrong, because the remaining casualties may not suffice to actually
kill.  Has been that way since land units were added in Chainsaw 3.

Apply remaining casualties more carefully: destroy land units only
when efficiency falls below 10%.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
4fd1e889c8 update/revolt: Reduce under-strength land unit damage
A land unit with mil military taking N casualties loses N * 100 / mil
points of efficiency.  A 50% inf with 20m dies when it loses more than
8m.  With 100m, it dies when it loses more than 40m.  A land unit
always dies when it loses all military.

In ordinary ground combat, they lose N * 100 / maxmil points of
efficiency, where maxmil is how many military they could load.  This
is less damage when the land unit is under-strength.  A 50% inf dies
when it loses more than 40m, regardless of how many it has.

An inefficient land unit with a sufficiently high number of military
can die before its military are all killed.  A land unit with a
sufficiently low number of military can survive loss of all its
military.  Attacking land units return to their starting position.
Defending land units stay put, and get taken over by a victorious
attacker.  Neither was possible before 4.0.0 made land unit military
loadable.

The rules for ordinary ground combat may be debatable, but it's better
to be consistent: change land unit damage in guerrilla combat to match
ordinary combat.  This reduces damage to under-strength land units.

If che lose, the sector owner profits from the reduced damage.  But if
they win, they may take over land units that got all their military
killed.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
8a3eb898ce update/revolt: Don't kill land units without military
Land units without military can't contribute to the fight.  They can
still get killed, and whether they are depends on their UID.

take_casualties() kills land units in UID order until the required
number of casualties is reached.  Killing a land unit without military
provides none, but take_casualties() doesn't care.  The land unit
"dies fighting guerrillas", which makes no sense when it's doesn't
have any military.

If the rebels win, they attempt to capture any surviving land units.
Spies hide or get executed instead.  Same as for any other violent
sector takeover.

Normal ground combat ignores land units without military.  Do the same
here: ignore them in take_casualties().  This protects spies and other
land units without military from the fighting, but exposes them to
capture.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
d8e19174ae update/revolt: Spread only actual casualties to land units
To spread C casualties among N land units, take_casualties() applies
floor(C/N)+2 to each.  Bonkers.  Has been that way since land units
were added in Chainsaw 3.

Limit casualties spread to a land unit to their remaining amount.
Should really spread proportionally to military instead of evenly; add
a TODO comment for that.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
c7195ed92e update/revolt: Simplify take_casualties()
Since the previous commit fixed the update of mc, mc + taken remain
invariant.  Don't bother changing mc, use mc - taken instead.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
75c8d9c72f update/revolt: Fix how land units take casualties
take_casualties() applies a number of casualties to sector military
and land units.  It is utterly confused about land units.

Consider a land unit with efficiency eff that has mil out of maxmil
military.  Issues:

* To apply N casualties without destroying it, take_casualties() tries
  to kill N * maxmil / mil military.  Makes no sense.  It's more than
  asked for unless mil equals maxmil.  It can even be more than mil.

  It reduces efficiency by N * 100 / mil points.  Note that ordinary
  ground combat reduces by N * 100 / maxmil points.  See
  lnd_take_casualty().

  Example: the update test's inf#25 is 100% efficient and has 20m out
  of 100m.  take_casualties() tries to apply up to 22 casualties out
  of the 60 remaining casualties to apply, but decides to apply only
  12 for now, to keep efficiency above to 40%.  It reduces efficiency
  by 12 * 100 / 20 = 60 to 40%, and tries to kill 12 * 100 / 20 = 60
  mil, which kills off the 20 that actually exist.  It nevertheless
  reduces the number of casualties still to apply only by 12.

  Example: the update test's linf#28 is 100% efficient and has 20m out
  of 25m.  take_casualties() tries to apply up to 8 casualties.  It
  reduces efficiency by 8 * 100 / 20 = 40 points to 60%, and tries to
  kill 8 * 25 / 20 = 10 military.

* When it destroys a land unit, it reduces the number of casualties
  still to apply by mil * eff/100.0 instead of mil.

  Example: the update test's inf#27 is 10% efficient and has 20m out
  of 100m.  take_casualties() still has 34 casualties to apply, so it
  destroys it, killing all 20m.  But it reduces the number of
  casualties to apply only by 2.

Broken when 4.0.0 made land unit military loadable.  Not sure it fully
worked before that, but it's definitely bonkers since.

Fix it as follows:

* To apply casualties to a land unit without destroying it, limit its
  losses to its actual number of military, and so that efficiency
  stays above 40%.  Then simply kill that number.

* Reduce the number of casualties to apply by the exact number killed.

The update test now kills only 8m in linf#28.  Still two more than it
should, but that's separate bug, to be fixed next.  The fix has no
visible effect for inf#25, because that one gets destroyed later.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
f0a0de54b7 update/revolt: Fix body count report
The body count reflects what take_casualties() should do, not what it
actually does.  It can be quite off, as the update test's changed
output shows.  Mostly because take_casualties() is utterly confused.
That'll be fixed next.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
e55fb2227b update/revolt: Fix mil count for che move after getting caught
When military catch che, their their count isn't updated for their
losses.  The count is later used when che consider moving to an
adjacent sector.  This could conceivably make them move instead of
stay.  Broken when Chainsaw 3 added land units.  Fix it.

Note that the sector's military count includes land units, but the
adjacent sectors' doesn't.  Should be improved some day; add a TODO
comment.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
849af9e06c update/revolt: Change security unit bonus to fix body count
Both ordinary ground combat and guerrilla combat basically kill
combatants one by one randomly until one side is eliminated.  The odds
of each side taking a hit are computed from combat strengths.

Ordinary combat factors bonuses into the odds.  It doesn't mess with
the number of men.

Guerrilla combat does the same for the bonus due to relative
happiness.  It doesn't for land units with security capability: these
fight as if they had twice as many military.  Changes both odds and
number of men.  This inflates the body count reported to the sector
owner.  Visible in tests/update/journal.log, where rebels kill 110 out
of 70 military.  It also complicates take_casualties().  Has been that
way since security land units were added in Chainsaw 3.

To fix the body count and simplify take_casualties(), make capability
security affect only the odds, not the number of men.  Without further
adjustments, this would reduce guerrilla losses: fewer men mean fewer
combat rounds mean fewer chances for rebels to die.  To compensate,
increase the multiplier from two to four.  This should make security
units a bit tougher.  Document the bonus in "info Guerrilla".

More body count bugs remain.

Reusing ordinary combat rules and code for guerrilla combat would be
nice, but isn't feasible for me right now.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
3e59bf1d6a tests/update: Cover guerrilla shootout
This exposes bugs.  They're marked "BUG:" in the test input.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
44d4a1c7ff attack assault paradrop: Don't disclose defender's retreats
When an attacking land unit fails its morale check and retreats, the
retreat message needs to be prefixed with a newline to separate it
from the casualty characters.  However, the code also prints the
newline when a defending land unit retreats, leaking the retreat to
the attacker.  For instance, a fight that forces three defending to
retreat could look like this:

    !!!!!!!!!!!!!!!!!!
    !@!!!!!!!!!!!!!@!
    !

    - Casualties -
	 Yours: 2
	Theirs: 34

Messed up in Empire 3.  Fix by printing the newline only when an
attacking land unit retreats.  The example becomes:

    !!!!!!!!!!!!!!!!!!!@!!!!!!!!!!!!!@!!
    - Casualties -
	 Yours: 2
	Theirs: 34

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
3a1f240dc4 attack assault board: Fix message when attacking land unit dies
Loss of an attacking land is reported like this:

    @linf light infantry #1 dies assault 21,-3!

Bad grammar and newline missing between the "@" casualty character and
the message.  Messed up in Empire 2.  Affects only attackers, because
the code special-cases defense to avoid the bad grammar there (close,
but no cigar), and defenders don't get casualty characters printed.
Fix it to

    @
    linf light infantry #1 dies assaulting 21,-3!

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
6fd04eabee assault: Don't send spies into combat
The server doesn't let you send land units without offensive strength
into combat: ask_olist() simply doesn't offer them.  Good.

However, it needs to offer spies for assault, because assault is how
they sneak ashore.  To make it offer spies, which have no offensive
strength, attack_val() artificially sets their offensive strength to
one for assault.  Dirt effect: spies fight (and die) in assaults, even
though they can't otherwise attack.  Lame.  Has been that way since
spies were added in 4.0.0.

Make ask_olist() offer spies regardless of offensive strength when
assaulting, and drop the special case from attack_val().  They get
offered exactly as before.  However, since their offensive strength is
now zero, they won't enter actual combat (see the previous commit).

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:19 +02:00
490b9392f0 attack assault board: Really require offensive strength
The server doesn't let you send land units without offensive strength
into combat: ask_olist() doesn't offer them.  But if their strength
gets somehow destroyed between ask_olist() and the actual fight, they
go anyway.

Check again before the fight, and leave land units without offensive
strength behind.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
406fdab125 attack assault paradrop: Spies hide rather than defend
Defending spies get spotted like any other defending land unit.  They
don't contribute to the defense (their defense value is zero), and
they always survive the fight unscathed (lacking mil, they take no
casualties).  If the sector is lost, they either hide or get executed.
Before the previous commit, they could also be damaged and captured.

Possible outcomes:

* Spy isn't spotted, attack fails

* Spy isn't spotted, attack succeeds, spy gets executed

* Spy isn't spotted, attack succeeds, spy hides

* Spy is spotted, attack fails

  This lets players use probing attacks to spot spies with a much
  better chance than spy or llook have.  But they can already repeat
  spy or llook to increase their detection chances as close to 100% as
  they want, so this doesn't make things materially worse.

* Spy is spotted, attack succeeds, spy gets executed

* Spy is spotted, attack succeeds, spy hides

  Since the spy has already been spotted, hiding is largely useless.
  The attacker can board the spy as soon as he has mobility.

This obviously hasn't been thought through.

Get rid of the "spy is spotted" cases by skipping spies when
collecting the list of defending land units.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
eb77d64b55 attack assault paradrop: Execute spies on takeover
When the attacker takes a sector, spies try to hide.  If they fail,
they're treated like any other land unit: they attempt to
self-destruct, and if the damage isn't lethal, they get captured.
Successful self-destruct is reported as "blown up by the crew", which
makes no sense for spies.  Spies surviving self-destruct is odd, as
any damage is normally fatal for them.

Extend the special case for spies: summarily execute the ones that
fail to hide.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
223ff1d75f assault attack board lboard paradrop spy: Fix missing newline
The intelligence reports on land units lack a newline.  Broken in
commit c8e5b4f, v4.3.33.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
4b3b133183 assault: Improve chance for spies sneaking ashore undetected
Spies assaulting a foreign sector have only a 10% chance to evade
detection, regardless of efficiency.  With odds like that, players
basically don't bother.

All the other spy detection checks use LND_SPY_DETECT_CHANCE(eff),
which gives 100% spies a 90% chance to evade detection.  That's
perhaps a bit to good here, so let's try LND_SPY_DETECT_CHANCE(eff/2).
A 100% spy now has a 40% chance to sneak ashore undetected.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
9b97d68bb3 assault: Handle the "only spies" special case earlier
Since the previous commit, sneak_ashore() doesn't depend on a previous
get_oland() anymore, so the att_get_offense() is unnecessarily.  Move
it across att_get_offense() next to the other special case "assault
own sector".

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
9f851c9f03 assault: Make spies "sneaking ashore" use mobility and hit mines
Assaulting a foreign sector with nothing but spies is special: the
spies sneak ashore.  It is, however, more special than it should be:
the spies use no mobility and ignore landmines.  They do use mobility
and hit landmines in other assaults.  Assaulting your own sector with
nothing but spies is more costly and more risky than assaulting a
foreign one.  This makes no sense.  Has been that way since spies were
added in 4.0.0.

It's that way because sneaking ashore uses its own code to move the
spies instead of move_in_land() via att_move_in_off().  It can't use
move_in_land(), because that prints an unwanted "now occupies"
message, and destroys the list of assaulting units, which we still
need to catch and shoot spies.

Factor the code to move attacking land units to the target sector out
of move_in_land() into att_move_land(), and use that for sneaking
ashore.  This makes the spies use mobility and hit landmines even when
they sneak.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
36e3caf97e subs: Simplify move_in_land()
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
1f0caf4aed assault: Plug memory leak in spies sneaking ashore
We free struct olist only for spies that get killed.  Leaks since
spies were added in 4.0.0.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
d54b3f6da5 assault: Simplify sneak_ashore()
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
97dd515378 assault: Simplify only_spies()
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
f15f0cc687 assault: Factor only_spies(), sneak_ashore() out of assa()
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
33800fc732 ef_verify: Require land unit milit == 0 with capability spy
The rules for spy units make little sense unless spies carry no
military.  For instance, spies die when they take casualties in ground
combat.  There seems to be a tacit assumption that spies have no
military.  I don't trust the code to behave unless this assumption is
met.  Require it before an overly adventurous deity finds out the
painful way that spies with military don't work.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
73e7765981 subs: Normalize checks whether a ship just read exists
A ship just read from the ship file exists unless its owner is zero.
Check that instead of whether efficiency is below minimum.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
6ed6d658d1 subs: Simplify checks whether a ship just read exists
Ships with efficiency below the minimum have their owner set to zero
on write to the ship file.  Therefore, a ship just read from the ship
file exists unless its owner is zero.  Additionally checking
efficiency is redundant.  Same for planes and land units.  Drop
obviously redundant efficiency checks.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
0c6d1e422e subs: Tighten the check for destroyed defending land unit
get_dland() tests efficiency to find out whether the defending land
unit is gone.  Doesn't work when somebody else has since built a new
one with the same UID.  Not sure that can happen.  Check for a change
of owner instead.  Matches get_oland().

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
25c96cc3ac fire: Plug memory leak when missile defense sinks firing ships
do_defdam() iterates over the list firing ships, applies return fire
to each, and frees its list element.  When it finds a ship that has
been sunk already, it skips it.  This also skips the free, leaking the
list element.  The leak goes back to flawed bug fix in Empire 2.

As far as I can see, missile defense is the only way a ship can be
sunk there.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
656c3e7645 subs: Drop unused spy detection roll from unitsatxy()
The die roll was added in 4.0.17 to hide spies from bombers.  However,
players could roll dice as often as they wanted, by typing '?' at the
target prompt.  The broken die roll is unreachable since commit
7688aed disallowed bombing of spies.  Drop it.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
2402f3f2a2 lost: Fix to track more than one lost sector per owner
makelost() overwrites an existing entry for the same thing, else
creates a new one.  It calls findlost() to find existing entries.
findlost() means to look up by coordinates if it's looking for a
sector entry, and by ID if it's looking for a ship, plane, land unit
or nuke entry.  It actually does both for sectors.  Since callers pass
zero ID for sectors, sector entries always match, so at most one gets
created, and additional ones overwrite it.

Broken since the lost table was introduced in 4.0.7.  Fix the flawed
comparison in findlost().

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:18 +02:00
cbc23ae858 news: Merge news more aggressively
News reporting merges news items into recent items with same actor,
action and victim, as long as the merged number of times doesn't
exceed 65535 (127 before the previous commit).

This complicates incremental xdump a bit: when the client sees a row,
it's not obvious which of the previously dumped rows it replaces.
Actually, rows with the same actor, action, victim and time replace in
xdump order.

Merge news item regardless of the number of times; saturate the number
at 65535.  Now the replacement is obvious, because there can only be
one news item with the same actor, action, victim and time.

This also rate-limits floods of identical news should they happen for
some reason.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:17 +02:00
fda2ecb910 news: Raise the limit for "number of times" from 127 to 65535
News reporting merges news items into recent items with same contents,
until their count reaches 127.  Raise that limit to 65535, by making
struct nwsstr member nws_ntm unsigned short.  Size of struct nwsstr
stays the same on all common machines.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:17 +02:00
68e595af8a news: Rewrite code for "The Bottom Line"
This is one of the lamest ways to sort I've seen in my career: find
the maximum, then for each value from the maximum down, search for
that value.  O(max * MAXNOC^2).  Dates back to Empire 2.

The one advantage this contraption has is it "sorts" in place.  But
memory's cheap.  Fill an array with the data to sort, and sort it with
qsort().  To avoid overtaxing the stack in the (unlikely!) worst case
of everybody taking sectors from everybody, allocate it dynamically.

Also flip sectors_taken[] from short to unsigned short.  Aside: in
theory, the count can overflow, but sector deltas exceeding 65535
don't occur in practice, and if news misreported them, we'd live.  Not
worth complicating the code.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:17 +02:00
d63b8aa5f0 news: De-duplicate the loop over news items
Duplicated to detect empty pages in Empire 2.  Easy enough to fold
into the other loop, so do that.

While there, oops on invalid struct nwsstr member nws_ntm.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:17 +02:00
729eaa7934 tests/smoke: Run news
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:17 +02:00
a265a247e7 travis: Limit to branches changeling, fever, master, travis
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:17 +02:00
7b5bd13767 nsc: Drop deprecated nat and country selector hostname
Deprecated since commit 199388b, v4.3.33.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:17 +02:00
1ec9b94f74 configure Make: More detailed version information
Version information is in output of commands version, xdump version,
and in program output for option -v.  Looks like this:

    Wolfpack Empire 4.3.33

The version number is defined in configure.ac, and incremented
manually.  It identifies only the base release (here: 4.3.33).  Fine
when this is an unmodified released version.  Pretty much useless
during development.

Add a suffix to the version number that describes it further:

    V               Unmodified release V (same as before)
    V.N-H           Modified release built from a clean git tree
                    N is the number of additional commits, and
                    H is the abbreviated commit hash
    V.N-H-dirty     Same, but the working tree is dirty
    V-dirty         Modified release built from a tarball

A git tree is clean when the contents of its files are unchanged.
Changing only the their timestamps doesn't count.  It does count when
building from a tarball, because tracking contents isn't implemented
there.

Also use this suffixed version for tarball names.

The version reported by configure is fixed at configure generation
time, i.e. it is usually out of date during development.  Ensuring a
release tarball contains one with a current version is manual for now.
Running autoconf -f should do the trick.

Elsewhere, the version is determined at build time, so it is always
current.

Dirty tracking isn't implemented in the standalone client build.  If
you start with a clean tarball, the version will not change from V to
V-dirty when you build with modifications.

Steal build-aux/git-version-gen from autoconf 2.69 to help with
computing the version string.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:17 +02:00
db055aa8bc configure: Bump required autoconf version to 2.69
2.69 is more than four years old now.  Nobody has tested with 2.64 in
quite some time.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:17 +02:00
ce002a5096 build-aux: Refresh from automake 1.15
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:17 +02:00
b4b65f0c35 nsc filetable: Get rid of untidy use of PACKAGE_STRING
Table version selector version shows the version string stored in
version[].  Its implementation is a bit of a hack:
empfile[EF_VERSION].cache is set to version[], so it gets passed as
context object to nstr_eval().  This permits reading version[] with an
NSC_STRINGY selector at offset 0, which is what nsc_init()'s
version_ca0 is.

Both empfile[] and version_ca need the size of version[].  Since
version.h provides only an incomplete type for version[], they use
sizeof(PACKAGE_STRING), which isn't exactly clean.

Redo version_ca0 as virtual selector.  Takes a bit more code, but it's
easier to understand.

The context object is now unused.  Setting empfile[EF_VERSION].cache
to a null pointer would trip assertions, so make it point to a dummy.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:17 +02:00
89a06ec2d4 xdump: Make meta-type numbers portable, get rid of meta-type "c"
The xdump field data types are abstract symbols "d", "f", "s" and "c".
However, the abstraction leaks: we dump the enum nsc_type ca_type
values verbatim in meta table field "type", and have symbol table
meta-type map all integer types to "d", and both floating-point types
to "f".  Not a problem for well-behaved clients, since all they do
with the dumped value is referencing table meta-type.  It is a problem
for version-test: since the integer type compatible with an
enumeration type is implementation-defined, the type value of
selectors of enumeration type can vary between compilers.  It also
makes table meta-type a somewhat ugly exception to the rule that a
symbol table maps integers to names 1:1.

Virtual selectors let us seal the abstraction: dump the promoted
ca_type value.

The integer types get all promoted to NSC_LONG.  This takes care of
version-test.

The floating-point types get all promoted to NSC_DOUBLE.  Makes sense.

NSC_STRINGY gets promoted to NSC_STRING.  This changes all field data
types "c" to "s".  Getting rid of "c" is a welcome simplification,
because now the meaning of meta type field "len" no longer depends on
"type", but always means that the array is dumped as that many fields.
We lose string length limit information, though.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:17 +02:00