]> git.pond.sub.org Git - empserver/log
empserver
16 years agoFinal polish for 4.3.13 v4.3.13
Markus Armbruster [Tue, 15 Apr 2008 19:04:03 +0000 (21:04 +0200)]
Final polish for 4.3.13

16 years agoFix documented syntax of edit command.
Markus Armbruster [Tue, 15 Apr 2008 18:57:28 +0000 (20:57 +0200)]
Fix documented syntax of edit command.

While there: editing nukes isn't implemented, don't advertise it.

16 years agoDocument that nukes can be traded
Markus Armbruster [Tue, 15 Apr 2008 18:34:42 +0000 (20:34 +0200)]
Document that nukes can be traded

16 years agoFix and polish comments emitted by pconfig
Markus Armbruster [Tue, 15 Apr 2008 18:29:29 +0000 (20:29 +0200)]
Fix and polish comments emitted by pconfig

16 years ago4.3.13 late changes
Markus Armbruster [Fri, 11 Apr 2008 20:12:41 +0000 (22:12 +0200)]
4.3.13 late changes

16 years agoWrap long lines in version's list of customized tables
Markus Armbruster [Thu, 10 Apr 2008 20:01:25 +0000 (22:01 +0200)]
Wrap long lines in version's list of customized tables

Factor the wrapping print out of show_opts() into prwrap().  Use it
in show_custom().

16 years agoWork around strptime() lossage
Markus Armbruster [Mon, 7 Apr 2008 18:20:13 +0000 (20:20 +0200)]
Work around strptime() lossage

Some losing implementations of strptime() such as FreeBSD's happily
succeed when they fully consumed the first argument, regardless of
whether they matched the full second argument or not.  This causes
lines without directives to be interpreted as "next Sunday".

Work around the lossage in parse_time().

16 years agoFix emp_server manual page synopsis for Windows
Ron Koenderink [Sun, 6 Apr 2008 20:58:13 +0000 (14:58 -0600)]
Fix emp_server manual page synopsis for Windows

The -R option appears in the wrong place.

16 years agoBump client version to 4.3.13
Markus Armbruster [Sun, 6 Apr 2008 20:07:02 +0000 (22:07 +0200)]
Bump client version to 4.3.13

This was forgotten in commit ef00d650 and commit 09c21f83.  The 4.2.12
client misidentified itself as 4.2.11.

16 years agoUpdate change log for 4.3.13
Markus Armbruster [Sun, 6 Apr 2008 20:00:25 +0000 (22:00 +0200)]
Update change log for 4.3.13

16 years agoBelatedly update c_form of xdump command
Markus Armbruster [Sun, 6 Apr 2008 19:52:33 +0000 (21:52 +0200)]
Belatedly update c_form of xdump command

Update for commit da8a1dae, v4.3.12.

16 years agoPut MAXNOC in xdump version
Markus Armbruster [Sun, 6 Apr 2008 13:03:37 +0000 (15:03 +0200)]
Put MAXNOC in xdump version

Create virtual selector nsc_ver_maxnoc() for it.

16 years agoDoc fix: don't claim empdump doesn't exist yet
Markus Armbruster [Sun, 6 Apr 2008 12:48:12 +0000 (14:48 +0200)]
Doc fix: don't claim empdump doesn't exist yet

16 years agoFix initialization of realms in newcap
Markus Armbruster [Sun, 6 Apr 2008 07:49:47 +0000 (09:49 +0200)]
Fix initialization of realms in newcap

Broken in commit e1a68c72, v4.3.12.

16 years agoFix add of for status arguments active, god, delete
Markus Armbruster [Sun, 6 Apr 2008 07:16:09 +0000 (09:16 +0200)]
Fix add of for status arguments active, god, delete

Broken in commit e1a68c72, v4.3.12.

16 years agoBump version to 4.3.13
Markus Armbruster [Sun, 6 Apr 2008 05:33:14 +0000 (07:33 +0200)]
Bump version to 4.3.13

16 years agoRemove unused unit stat development macros v4.3.12
Markus Armbruster [Fri, 4 Apr 2008 18:35:09 +0000 (20:35 +0200)]
Remove unused unit stat development macros

Commit 0219bf08 hid all of them them away, but used only some of them
in their new home.  Clean up.

16 years agoUpdate change log for 4.3.12
Markus Armbruster [Wed, 2 Apr 2008 05:36:47 +0000 (07:36 +0200)]
Update change log for 4.3.12

16 years agoDon't make more babies than food permits
Markus Armbruster [Sun, 30 Mar 2008 16:28:07 +0000 (18:28 +0200)]
Don't make more babies than food permits

babies() rounded the maximum number of babies permitted by food.  When
this rounded up, grow_people() could use more food than available, and
the sector's food could become negative.  Fix by always rounding down.

16 years agoDoc fix
Markus Armbruster [Fri, 28 Mar 2008 19:53:22 +0000 (20:53 +0100)]
Doc fix

16 years agoRemove src/scripts/tag-changeling, it's specific to CVS
Markus Armbruster [Fri, 28 Mar 2008 19:52:31 +0000 (20:52 +0100)]
Remove src/scripts/tag-changeling, it's specific to CVS

16 years agoUpdate documentation to talk about git instead of CVS
Markus Armbruster [Fri, 28 Mar 2008 19:42:49 +0000 (20:42 +0100)]
Update documentation to talk about git instead of CVS

16 years agoRevert "Use XYOFFSET() instead of sctoff() in sector iterators"
Markus Armbruster [Fri, 28 Mar 2008 06:17:17 +0000 (07:17 +0100)]
Revert "Use XYOFFSET() instead of sctoff() in sector iterators"

This reverts commit d2ca7d4ed2c9ab03ba20a18fa53613d7baaa9026.

Turns out the arguments are not always normalized, e.g. after
snxtitem_all().

16 years agoAdd missing thread yield system call.
Ron Koenderink [Fri, 28 Mar 2008 02:07:11 +0000 (20:07 -0600)]
Add missing thread yield system call.

This change fixes a bug where the threads were not treated
fairly.  Before the fix, empth_yield would only yield to
threads already waiting hThreadMutex mutex.  It would not
yield to other threads ready to run from the release of other
mutexes.  An example of this is that the update task did
not start when force command was issued from script sequence.

16 years agoRevert "Fix update's resupply of food to avoid starvation"
Markus Armbruster [Wed, 26 Mar 2008 21:00:35 +0000 (22:00 +0100)]
Revert "Fix update's resupply of food to avoid starvation"

This reverts commit 03811b2c97d9537cfeaf4e5a6726002b0b0d6b78.

That "fix" could actually conjure up food.  The resupply doesn't wipe
out food, because it resuppies from the sector itself.

16 years agoFix empdump to check for export write errors
Markus Armbruster [Tue, 25 Mar 2008 20:39:27 +0000 (21:39 +0100)]
Fix empdump to check for export write errors

16 years agoPass struct natstr * instead of natid to virtual selectors
Markus Armbruster [Tue, 25 Mar 2008 20:36:52 +0000 (21:36 +0100)]
Pass struct natstr * instead of natid to virtual selectors

This is because we want to define them in src/lib/global/, and code
there can't use getnatp(), because that requires
src/lib/common/file.c.  Which renders a cnum parameter pretty useless.

Virtual selectors requiring code from common/ could well come up again
in the future, but let's not worry about that now.

16 years agoNo need to assign uid after ef_blank()
Markus Armbruster [Mon, 24 Mar 2008 17:40:06 +0000 (18:40 +0100)]
No need to assign uid after ef_blank()

The redundant assignments should have been removed in commit 2da8d0c7.

16 years agoFix the obvious bogosities in info launch
Markus Armbruster [Mon, 24 Mar 2008 16:35:29 +0000 (17:35 +0100)]
Fix the obvious bogosities in info launch

16 years agoCheck pln_airbase_ok() in msl_sel()
Markus Armbruster [Mon, 24 Mar 2008 16:35:23 +0000 (17:35 +0100)]
Check pln_airbase_ok() in msl_sel()

The lack of base checking there permitted ship and land unit missile
interdiction and ballistic missile interception without a proper base.

16 years agoReplace laun()'s base checking code by pln_airbase_ok()
Markus Armbruster [Mon, 24 Mar 2008 16:17:53 +0000 (17:17 +0100)]
Replace laun()'s base checking code by pln_airbase_ok()

This outlaws launch from unowned sectors.  Also, non-VTOL missiles
require an efficient airfield now, except that such missiles don't
exist currently, because init_plchr() makes all missiles VTOL.

16 years agoChange launch not to destroy missiles stuck on foreign ships
Markus Armbruster [Mon, 24 Mar 2008 16:11:03 +0000 (17:11 +0100)]
Change launch not to destroy missiles stuck on foreign ships

When laun() refused to launch a missile because of its carrier's
nationality, it destroyed the missile.  Don't do that.

16 years agoFix launch_as() to use up supplies only when actually launching
Markus Armbruster [Mon, 24 Mar 2008 15:24:42 +0000 (16:24 +0100)]
Fix launch_as() to use up supplies only when actually launching

16 years agoFix launch to require petrol for launching satellites
Markus Armbruster [Mon, 24 Mar 2008 15:23:03 +0000 (16:23 +0100)]
Fix launch to require petrol for launching satellites

launch_sat() failed to call msl_equip().  Change msl_equip() to take
the mission character as argument, because the old hardcoded 'p' isn't
appropriate for satellites.  Best fit for satellites is 'r' for
reconnaissance, but mission_pln_equip() doesn't accept that
(pln_equip() does).  Fix that as well.

16 years agoFix empdump not to depend on POGO's origin
Markus Armbruster [Mon, 24 Mar 2008 14:06:36 +0000 (15:06 +0100)]
Fix empdump not to depend on POGO's origin

Treat NATID_BAD as deity with absolute coordinates in nstr_exec_val()
and xdinit().  Use that in dump_table().

16 years agoMake xnorm() and ynorm() use XNORM() and YNORM()
Markus Armbruster [Mon, 24 Mar 2008 13:13:58 +0000 (14:13 +0100)]
Make xnorm() and ynorm() use XNORM() and YNORM()

They duplicated them before.

16 years agoSimplify xrel() and yrel()
Markus Armbruster [Mon, 24 Mar 2008 13:09:51 +0000 (14:09 +0100)]
Simplify xrel() and yrel()

Value of XNORM() and YNORM() is in [0,WORLD_X) and [0,WORLD_Y),
respectively.

16 years agoSimplify XNORM() and YNORM()
Markus Armbruster [Mon, 24 Mar 2008 13:00:59 +0000 (14:00 +0100)]
Simplify XNORM() and YNORM()

Simplify (M - (n % M)) % M  to M - (n % M), for n < 0.

16 years agoUse nstr_sect member id instead of recomputing it
Markus Armbruster [Mon, 24 Mar 2008 10:42:53 +0000 (11:42 +0100)]
Use nstr_sect member id instead of recomputing it

bmnxtsct() sets it.  The old code recomputed it with sctoff() without
checking for failure.  Not a bug, because it can't actually fail, just
confusing.

16 years agoDoc fix
Markus Armbruster [Mon, 24 Mar 2008 10:38:53 +0000 (11:38 +0100)]
Doc fix

16 years agoUse XYOFFSET() instead of sctoff() in sector iterators
Markus Armbruster [Mon, 24 Mar 2008 10:38:25 +0000 (11:38 +0100)]
Use XYOFFSET() instead of sctoff() in sector iterators

Old code didn't check value of sctoff() for success.  But it can't
fail, because we already took care of the condition that can make it
fail.  Moreover, the arguments are already normalized.  Therefore, we
can just call XYOFFSET().

16 years agoMake newcap's second argument mandatory
Markus Armbruster [Mon, 24 Mar 2008 10:22:40 +0000 (11:22 +0100)]
Make newcap's second argument mandatory

The code to find a suitable sanctuary location is flawed: to find
space and resources around the location, it does a depth-first search
limited to 300 sectors.  Pretty useless when the limit is reached.  A
breadth-first search would work, but why bother?  This feature is
obscure and rarely (if ever) used: no conscientious deity would use it
for a real game, and for blitzes fairland does a better job.  Remove
it.

16 years agoUse sctstr member sct_uid instead of recomputing it
Markus Armbruster [Mon, 24 Mar 2008 09:53:56 +0000 (10:53 +0100)]
Use sctstr member sct_uid instead of recomputing it

The old code recomputed it with sctoff() in some places, without
checking for failure.  Not a bug, because it can't actually fail, just
confusing.

16 years agoMake would_abandon() more robust
Markus Armbruster [Mon, 24 Mar 2008 09:08:54 +0000 (10:08 +0100)]
Make would_abandon() more robust

Do the right thing when caller passes a larger amount than actually
there.

16 years agoSimplify would_abandon()
Markus Armbruster [Mon, 24 Mar 2008 09:06:52 +0000 (10:06 +0100)]
Simplify would_abandon()

16 years agoOops on unexpected mission in pln_equip() and mission_pln_equip()
Markus Armbruster [Mon, 24 Mar 2008 08:30:37 +0000 (09:30 +0100)]
Oops on unexpected mission in pln_equip() and mission_pln_equip()

16 years agoUse mission 0 instead of 'r' for air defense
Markus Armbruster [Mon, 24 Mar 2008 15:05:29 +0000 (16:05 +0100)]
Use mission 0 instead of 'r' for air defense

reco() uses 'r' for reconnaissance.  sam_intercept() and
ac_intercept() use 0 for intercept.  Switch air_defense() to use 0 as
well.  No functional change, because 'r' and 0 behave the same, just
cleanup.

16 years agoSimplify mission_pln_equip()
Markus Armbruster [Mon, 24 Mar 2008 08:28:08 +0000 (09:28 +0100)]
Simplify mission_pln_equip()

Cases 't' and 'd' are identical.

16 years agoCheck plane efficiency and capabilities earlier in pln_sel()
Markus Armbruster [Mon, 24 Mar 2008 07:04:10 +0000 (08:04 +0100)]
Check plane efficiency and capabilities earlier in pln_sel()

This way we don't complain about range to assembly point and
destination for planes that can't go regardless.

16 years agoSimplify pln_equip() and mission_pln_equip()
Markus Armbruster [Sun, 23 Mar 2008 15:18:51 +0000 (16:18 +0100)]
Simplify pln_equip() and mission_pln_equip()

Mission 'n' was removed along with nuke_bomb() many years ago.
Simplify accordingly.

16 years agoOops rather than complain to player on bad mission in bomb()
Markus Armbruster [Sun, 23 Mar 2008 15:09:32 +0000 (16:09 +0100)]
Oops rather than complain to player on bad mission in bomb()

16 years agoFix tracking of planes flying a sortie
Markus Armbruster [Sun, 23 Mar 2008 18:21:19 +0000 (19:21 +0100)]
Fix tracking of planes flying a sortie

Planes normally sit in their base (sector or carrier), where they can
be spied, damaged, captured, loaded, unloaded, upgraded and so forth.
All this must not be possible while they fly.  There are two kinds of
flying planes: satellites in orbit, and planes flying a sortie.

Satellites in orbit have always been marked with flag PLN_LAUNCHED.
Works.  What didn't work was tracking planes flying a sortie.

If you look at one sortie in isolation, up to three groups of planes
can be flying at any point of time: the primary group, which carries
out the sortie's mission (bomb, transport, ...), their escorts, and a
group of hostile planes flying interception or air defense.

The old code attempted to track these planes by passing those groups
to the places that need to know whether a plane is flying.  This was
complex and incomplete, and broke down completely for the pin-bombing
command.

It was complex, because the plane code needs to keep track of all the
call chains that can lead to a place that needs to know whether a
plane flies, and pass the groups down the call chains.  This leads to
a rather ugly passing of plane groups all over the place.

It was incomplete, because it generally failed to pass the escorts.

And the whole scheme broke down for the pin-bombing command.  That's
because pin-bombing asks the player for targets while his planes are
loitering above the target sector.  This yields the processor and lets
other code run.  Which does not get the flying planes passed.

The new code marks planes and SAMs (but not other missiles) flying a
sortie with flag PLN_LAUNCHED (the previous commit laid the groundwork
for that), and does away with passing around groups of flying planes.

This fixes the following bugs:

* Many commands could interact with foreign planes flying for a
  pin-bombing command as if they were sitting in their base.  This
  includes spying, damaging, capturing, loading, or upgrading them,
  and even getting intercepted by them.  Any changes to those planes
  were wiped out when they landed.  Abusable.

* The bomb command could bomb its own escorts, directly (pin-bomb
  planes) or through collateral damage, strategic sector damage,
  collapsing bridges or nuke damage.  The damage to the escorts was
  wiped out when they landed.

* If you asked for a plane to fly both in the primary group and the
  escort group, you got charged fuel for two sorties instead of one.

* pln_put1() and pln_put() now recognize planes that didn't take off,
  and refrain from making them land.  Intercept (since commit
  c64e2149) and air defense can do that.  Making them land had no
  ill-effects, but it was still wrong.

There's one new problem: if PLN_LAUNCHED doesn't get reset properly,
due to game crash during flight or some other bug, the plane gets
stuck in the air.  Catch and fix that on game start in ef_verify().

16 years agoDistinguish between planes "in orbit" and "launched"
Markus Armbruster [Sat, 22 Mar 2008 17:38:51 +0000 (18:38 +0100)]
Distinguish between planes "in orbit" and "launched"

Use new pln_is_in_orbit() when we want to test for orbit specifically,
and test PLN_LAUNCHED when we want to test whether the plane not
sitting in the sector (because it is flying).  This distinction is
pointless at this time, because the only way PLN_LAUNCHED gets set is
when a satellite goes into orbit.  It will become useful in a later
commit, which will use PLN_LAUNCHED to mark flying planes.

16 years agoFactor out a single plane's end of sortie into new pln_put1()
Markus Armbruster [Sat, 22 Mar 2008 13:55:30 +0000 (14:55 +0100)]
Factor out a single plane's end of sortie into new pln_put1()

Use it in pln_put() and ac_planedamage().

This changes ac_planedamage() to deal with a destroyed airbase.
Before, aborted planes happily landed there.  This bug could not
actually bite, because the code neither yields nor does damage to
potential airbases between checking the landing airbase before takeoff
and aborting planes in ac_planedamage().

It changes pln_put() to cope with dead planes.  Before, it made them
land as if they lived, fortunately without ill effects (complaints
about not being able to land were suppressed for dead planes).
ac_planedamage() removes dead planes, but pinflak_planedamage()
doesn't, and these end up in pln_put().  pinflak_planedamage() no
longer has to take shot down planes off their carriers, because
pln_put() now takes care of that.

16 years agoOops when air_defense() somehow leaks interceptors
Markus Armbruster [Sat, 22 Mar 2008 18:47:30 +0000 (19:47 +0100)]
Oops when air_defense() somehow leaks interceptors

16 years agoFix memory leak in air_defense() oops
Markus Armbruster [Sat, 22 Mar 2008 18:46:47 +0000 (19:46 +0100)]
Fix memory leak in air_defense() oops

Broken in commit 9c27a771.

16 years agoFix memory leaks in plane interception
Markus Armbruster [Sat, 22 Mar 2008 18:43:38 +0000 (19:43 +0100)]
Fix memory leaks in plane interception

Interception builds lists of planes that could intercept.  Only list
nodes for missiles were freed.  Broken since BSD Empire 1.1.

The fix frees interceptors that actually intercepted when
ac_intercept() returns, and the interceptors that didn't when
ac_encounter() returns.

The latter introduces a small bug: it passes planes that didn't fly to
pln_put().  pln_put() expects only planes that actually took off.
Same bug exists in air defense missions.  Luckily, it has no ill
effects.  To be fixed soon.

16 years agoFix explanation pdump field of laun
Markus Armbruster [Sat, 22 Mar 2008 17:38:29 +0000 (18:38 +0100)]
Fix explanation pdump field of laun

16 years agoMake pupgr() reject planes in orbit early
Markus Armbruster [Sat, 22 Mar 2008 17:25:39 +0000 (18:25 +0100)]
Make pupgr() reject planes in orbit early

It's best to check and report conditions the player can't change
before those he could.

16 years agoFix trade to enforce destination rules for satellites and asats
Markus Armbruster [Sat, 22 Mar 2008 16:41:37 +0000 (17:41 +0100)]
Fix trade to enforce destination rules for satellites and asats

Trade teleports planes to a destination chosen by the buyer, except
for satellites in orbit.  trad() failed to enforce the usual rules on
destinations for satellites (not in orbit) and asat missiles: they
could be teleported anywhere.  Abusable, because abms intercept from
anywhere, and satellites can be launched from unowned sectors, even
sea.  Broken since BSD Empire 1.1.

16 years agoSimplify calls to mpr()
Markus Armbruster [Sat, 22 Mar 2008 10:04:53 +0000 (11:04 +0100)]
Simplify calls to mpr()

mpr() does nothing when its first argument is zero.  No need to avoid
calling it in that case; remove the conditionals.

16 years agoMake mpr()'s behavior on zero first argument more obvious
Markus Armbruster [Sat, 22 Mar 2008 09:07:37 +0000 (10:07 +0100)]
Make mpr()'s behavior on zero first argument more obvious

16 years agoRemove mission_pln_arm()'s argument tech
Markus Armbruster [Fri, 21 Mar 2008 16:05:51 +0000 (17:05 +0100)]
Remove mission_pln_arm()'s argument tech

It always existed, and was never used for anything.

16 years agoRemove leftover test for anti-satellite nuke in detonate()
Markus Armbruster [Fri, 21 Mar 2008 16:03:30 +0000 (17:03 +0100)]
Remove leftover test for anti-satellite nuke in detonate()

These existed in Chainsaw many years ago.

16 years agoFix fillcache() and do_write() error handling
Markus Armbruster [Fri, 21 Mar 2008 08:13:04 +0000 (09:13 +0100)]
Fix fillcache() and do_write() error handling

Fix test for interrupted I/O.  Catch read hitting EOF unexpectedly.
Log errors in more detail.

16 years agoMake empsched less loquacious on unrecognized options
Markus Armbruster [Mon, 17 Mar 2008 18:57:58 +0000 (19:57 +0100)]
Make empsched less loquacious on unrecognized options

16 years agoFix empdump error messages to include program name
Markus Armbruster [Mon, 17 Mar 2008 18:55:42 +0000 (19:55 +0100)]
Fix empdump error messages to include program name

16 years agoChange empdump syntax
Markus Armbruster [Mon, 17 Mar 2008 18:54:08 +0000 (19:54 +0100)]
Change empdump syntax

Require -i for import, and fail when no action is requested.  Also
rename option -t to -n.

16 years agoSilence compiler warning on our getpwuid() for _WIN32
Markus Armbruster [Sun, 16 Mar 2008 11:59:48 +0000 (12:59 +0100)]
Silence compiler warning on our getpwuid() for _WIN32

16 years agoJournal the PRNG seed
Markus Armbruster [Sun, 16 Mar 2008 11:56:03 +0000 (12:56 +0100)]
Journal the PRNG seed

16 years agoSimplify how fire command parses third argument
Markus Armbruster [Sat, 15 Mar 2008 07:26:35 +0000 (08:26 +0100)]
Simplify how fire command parses third argument

Remove a useless strcpy() that truncated the argument to 19
characters.

16 years agoClean up fire command's enum targ_type
Markus Armbruster [Sat, 15 Mar 2008 07:24:04 +0000 (08:24 +0100)]
Clean up fire command's enum targ_type

You can't fire at land units.  target is never set to targ_unit, only
compared to it.  Remove.

16 years agoSimplify fire command's encoding of attacker
Markus Armbruster [Sat, 15 Mar 2008 07:08:59 +0000 (08:08 +0100)]
Simplify fire command's encoding of attacker

Use file types instead of enum targ_type.

16 years agoFix use of uninitialized variable in multifire()
Markus Armbruster [Sat, 15 Mar 2008 06:51:25 +0000 (07:51 +0100)]
Fix use of uninitialized variable in multifire()

multifire() used shots to print either shell or shells.  4.2.3 removed
its initialization for land unit fire, and commit 22c6fd8b removed it
for ship fire.  Fix by just printing shells always.

16 years agoRemove nightly build configurations files that are not being used
Ron Koenderink [Sun, 16 Mar 2008 23:17:04 +0000 (17:17 -0600)]
Remove nightly build configurations files that are not being used

This files are not current with nightlybuild.sh, common.sh
and report.sh.

16 years agoRemove pre_update_hook decoration
Ron Koenderink [Sun, 16 Mar 2008 23:09:00 +0000 (17:09 -0600)]
Remove pre_update_hook decoration

Improve the portability.  The Windows version of "echo" does
not support single quotes as a quoting character and therefore
fails and prevents updates in the Windows nightly build.

16 years agoDon't write junk bits to unused bytes of telegram files
Markus Armbruster [Fri, 14 Mar 2008 20:22:32 +0000 (21:22 +0100)]
Don't write junk bits to unused bytes of telegram files

There are holes in struct telstr, which typed_wu() neglected to
initialize.  Fix that.

16 years agoFix update's resupply of food to avoid starvation
Markus Armbruster [Fri, 14 Mar 2008 19:01:23 +0000 (20:01 +0100)]
Fix update's resupply of food to avoid starvation

do_feed() used supply_commod() incorrectly, which wiped out all food
in the starving sector.

16 years agoFix return fire ammunition use in fire command
Markus Armbruster [Fri, 14 Mar 2008 19:00:48 +0000 (20:00 +0100)]
Fix return fire ammunition use in fire command

The old code let each defender fire on each target separately.  To
avoid charging ammo multiple times, it didn't update the defenders
after fire; it charged them in use_ammo() instead.  Bugs: not updating
the defender lost any shells fetched by automatic resupply, and
use_ammo() always charged one shell for gun fire, which was wrong for
most ships and land units.

Rewrite to let each defender fire once, updating it normally.  Reuse
the damage for the other targets.  This also yields the proper
probability distribution for damage.

16 years agoNew emp_searchque()
Markus Armbruster [Thu, 13 Mar 2008 21:30:43 +0000 (22:30 +0100)]
New emp_searchque()

16 years agoSimplify how fire command encodes lists of firing objects
Markus Armbruster [Fri, 14 Mar 2008 19:00:30 +0000 (20:00 +0100)]
Simplify how fire command encodes lists of firing objects

Use file type rather than enum targ_type for struct flist member type.

Clean up natid vs. int sloppiness while there.

16 years agoSimplify multifire() to silence compiler warning
Markus Armbruster [Thu, 13 Mar 2008 21:34:44 +0000 (22:34 +0100)]
Simplify multifire() to silence compiler warning

16 years agoSimplify how fire command passes attacker to defend()
Markus Armbruster [Thu, 13 Mar 2008 21:05:36 +0000 (22:05 +0100)]
Simplify how fire command passes attacker to defend()

Pass attacker empobj instead of attacker's targ_type, sector (used for
targ_land), ship (used otherwise) and coordinates (used in either
case).

16 years agoSimplify how fire command passes defender to defend()
Markus Armbruster [Thu, 13 Mar 2008 20:32:12 +0000 (21:32 +0100)]
Simplify how fire command passes defender to defend()

Pass defender country number instead of target type, sector (used if
target type is targ_land), and ship (used otherwise).

16 years agoSimplify quiet_bigdef()
Markus Armbruster [Thu, 13 Mar 2008 19:34:04 +0000 (20:34 +0100)]
Simplify quiet_bigdef()

Move common part of submarine and surface ship return fire out of the
conditional.

Use ni.curdist instead of recomputing the range.

16 years agoPlug memory leak in fire command
Markus Armbruster [Thu, 13 Mar 2008 19:06:13 +0000 (20:06 +0100)]
Plug memory leak in fire command

add_to_fired_queue() adds a defender at most once.  It neglects to
free the defender flist nodes it doesn't add.  Broken since option
MULTIFIRE appeared in Chainsaw.

16 years agoFix commit 91eefc3f
Markus Armbruster [Thu, 13 Mar 2008 18:22:21 +0000 (19:22 +0100)]
Fix commit 91eefc3f

It miscomputed size of configdir, resulting in excessive memory
allocation.

16 years agoFix make distclean to remove generated sources.mk
Markus Armbruster [Sun, 9 Mar 2008 17:19:07 +0000 (18:19 +0100)]
Fix make distclean to remove generated sources.mk

16 years agoBump version to 4.3.12
Markus Armbruster [Sun, 9 Mar 2008 17:06:13 +0000 (18:06 +0100)]
Bump version to 4.3.12

16 years agoUpdate known contributors comments
Markus Armbruster [Sun, 9 Mar 2008 15:26:27 +0000 (16:26 +0100)]
Update known contributors comments

16 years agoMake xundump catch extraneous fields
Markus Armbruster [Sun, 9 Mar 2008 12:50:00 +0000 (13:50 +0100)]
Make xundump catch extraneous fields

Make deffld() reject fields whose selector has flag NSC_EXTRA set.
Since xundump() doesn't provides space for these, the bug could lead
to buffer overruns.

16 years agoFix stmtch() for exact match after multiple partial matches
Markus Armbruster [Sun, 9 Mar 2008 12:45:29 +0000 (13:45 +0100)]
Fix stmtch() for exact match after multiple partial matches

Keep looking for exact match after finding the second partial match.

16 years agoNew timestamp selectors
Markus Armbruster [Sun, 9 Mar 2008 12:41:13 +0000 (13:41 +0100)]
New timestamp selectors

New timestamp selector for commodity, country, game, loan, nation,
news, trade, treaty.

16 years agoSet timestamp automatically on write
Markus Armbruster [Wed, 5 Mar 2008 21:43:10 +0000 (22:43 +0100)]
Set timestamp automatically on write

Do it in do_write().  Remove the setting of timestamps elsewhere.

This fixes empdump to set timestamps to the current time instead of
zero on import.

16 years agoPut a timestamp into struct emptypedstr
Markus Armbruster [Wed, 5 Mar 2008 21:36:48 +0000 (22:36 +0100)]
Put a timestamp into struct emptypedstr

Make sure all members of unit empobj_storage share it.

Add matching timestamp member to struct comstr, struct empobj, struct
gamestr, struct lonstr, struct natstr, struct nwsstr, struct trdstr,
struct trtstr.  The timestamp isn't yet set for these.  To be fixed.

Move the timestamp member to the right place in struct lndstr, struct
loststr, struct realmstr, struct nukstr, struct plnstr, struct sctstr,
struct shpstr.

16 years agoFactor common code out of add() and new() into nat_reset()
Markus Armbruster [Wed, 5 Mar 2008 21:21:08 +0000 (22:21 +0100)]
Factor common code out of add() and new() into nat_reset()

The common nation wipe code is not quite identical, and it doesn't
wipe the nation thoroughly enough.  The new code does.

Changes to both commands:

* Wipe nat_update, nat_ann, nat_access, and nat_contact.  Bug: should
  set nat_ann to the number of announcements.

Changes to add command:

* Don't wipe for status active and god.  Before, nat_relate and
  nat_flags where wiped then.

Changes to newcap command:

* Wipe nat_hostaddr, nat_hostname, nat_userid, nat_dayno, nat_minused,
  nat_reserve, nat_last_login, nat_last_logout, nat_newstim,
  nat_annotim, nat_relate, nat_rejects, nat_flags.

16 years agoUpdate indent-emp for removed typedef names, belatedly.
Markus Armbruster [Wed, 5 Mar 2008 05:10:54 +0000 (06:10 +0100)]
Update indent-emp for removed typedef names, belatedly.

16 years agoReplace some typedef names by enum tags.
Markus Armbruster [Wed, 5 Mar 2008 05:09:48 +0000 (06:09 +0100)]
Replace some typedef names by enum tags.

Also get rid of some mildly silly manual packing of enum types.

16 years agoNew utility program empdump
Markus Armbruster [Tue, 4 Mar 2008 20:55:29 +0000 (21:55 +0100)]
New utility program empdump

empdump exports and imports game state as plain text.  Limitations: it
currently can't export player bmaps, power report, telegrams,
announcements, message of the day, no-login message and log files.
Exported floating-point values may be inexact.  Importing an exported
game state may not result in identical data files; besides the loss of
floating-point precision just mentioned, coordinates are normalized,
and characters beyond a string's terminating zero in a character array
are lost.  Bug: importing resets timestamps to zero.  It should set
them to the current time.

16 years agoImplement human-readable dialect for xdump
Markus Armbruster [Tue, 4 Mar 2008 20:49:44 +0000 (21:49 +0100)]
Implement human-readable dialect for xdump

This is for the forthcoming empdump utility program.  The xdump
command still does not support the human-readable dialect.

xundump has supported the human-readable dialect for a long time
(commit 4871a10a).