Commit graph

3041 commits

Author SHA1 Message Date
5a2440c9d4 Fix origin command not to prompt twice for its argument
Broken in commit b69173ee, v4.3.0.
(cherry picked from commit 27c3466aa5)
2008-05-18 10:13:45 +02:00
45a6b9a1d7 Cover biofuel plant in info Quick-ref 2008-05-18 10:13:45 +02:00
542460c787 Fix markup in info Hvy-Metal 2008-05-18 10:13:45 +02:00
312b28f5fa Disable another incorrect use of supply_commod()
navi() reads the ships into a list.  When the ships get interdicted,
and lack flak shells, ac_shipflak() tries to get one and updates the
ship.  When the ship in the list is later written back, e.g. to apply
interdiction damage, the flak shell is wiped out, and we get a seqno
mismatch oops.

Disable automatic flak shell supply in ac_ship_flak() for now.  This
is related to commit f7d61817, which disabled automatic supply of
shells in ac_doflak() and shp_missile_defense().
2008-05-18 10:13:44 +02:00
e7aa3627c4 Fix edit command seqno oopses
Broken by commit dc9d847b.
2008-05-18 10:13:38 +02:00
8fe67826e6 Avoid compiler warning 2008-05-18 10:12:25 +02:00
05e5adfac8 Debug code to help catch the phantom nuke bug
Thu Apr 24 12:20:52 2008 Oops: bug in ../src/lib/subs/plnsub.c:1146

#3  0x080e64f4 in oops (msg=0x0, file=0x80ff1ca "../src/lib/subs/plnsub.c",
    line=1146) at ../src/lib/gen/log.c:141
#4  0x080bce6c in pln_damage (pp=0x8415b60, x=82, y=20, type=115 's',
    nukedamp=0x84158bc, noisy=1) at ../src/lib/subs/plnsub.c:1146
#5  0x080684f2 in launch_missile (pp=0x8415b60, sublaunch=0)
    at ../src/lib/commands/laun.c:281
#6  0x08067c79 in laun () at ../src/lib/commands/laun.c:111
2008-05-07 10:33:42 +02:00
cf4639fa74 Update info Hvy-Metal for Hvy Metal II 2008-05-07 10:33:42 +02:00
b707e2cca8 Permit ships to assault the sector they're in
Ships still have to be in a sea sector to assault an adjacent sector.
2008-05-07 10:33:42 +02:00
4e962406ff Let ships navigate bridge spans regardless of owner 2008-05-07 10:33:42 +02:00
f7d6181717 Disable some incorrect uses of supply_commod()
Because supply_commod() updates supply sources it used, the caller
must not cache objects that could be supply sources across a supply
call.  This is very easy to get wrong.

ac_doflak() supplies flak shells if the sector hasn't enough for its
guns.  It caches the sector that receives them.  If the sector has
some shells, but not enough, it supplies them to itself, causing it to
be updated from within supply_commod().  ac_doflak() then adds the
supplied shells to its cached sector, then writes that back.  This
doubles shells already there, and triggers a a seqno mismatch oops.

shp_missile_defense() has similar problems, only for ships.

Disable ac_doflak() and shp_missile_defense() for now, to at least
reduce the oopsing to manageable levels.

Most likely other calls of supply_commod() are also wrong.  Many of
them can't be just disabled, because supply is too relevant to
gameplay there.
2008-05-07 10:33:42 +02:00
b313b61cd4 Oops on sequence number mismatch
Old code only logged this, for fear of false positives.
2008-05-07 10:33:42 +02:00
e917a60371 Trains can no longer be loaded on land units, update info Railroad 2008-05-07 10:33:42 +02:00
12e34aeeb4 Fix info Railroad on spy and satellite reports
Fix explanation of "rl eff" value.  Mention satellite report.
2008-05-07 10:33:41 +02:00
fa5fa4abcc Don't store RAILWAYS track in sectors
Storing track in sectors is problematic, because we need to update
adjacent sectors when updating a sector in a way that changes its
capability to extend railway into its neighbors.  This invalidates
cached adjacent sectors, and calling code may not be prepared for
that.  Specifically, bridge building caches the bridge head, and
writes it back later, wiping out the track update.

Replace struct sctstr member sct_track by new sct_rail_track().  Make
selector track virtual.  Remove the code to keep sct_track up-to-date:
set_railway(), update_railway().

Unfortunately, this causes cyclic dependencies between link libraries:
the virtual selector needs to be referenced from src/lib/global/nsc.c,
and it needs to reference stuff from src/lib/common/file.c.  Hack
around it in Make.mk for now.
2008-05-07 10:33:41 +02:00
11100f23e5 Update info Hvy-Metal for Hvy Metal II 2008-05-07 10:33:41 +02:00
b437b7b5ec Make fairland record the island number in the deity territory
Can be useful for deities when further customizing their game setup.
2008-05-07 10:33:41 +02:00
95298986cc Don't produce food without work
We don't want to starve tiny populations, because that would require
players to move trivial amounts of food after explore and such.
growfood() used to simply grow at least 1f when a sector was about to
starve.  That food is almost never eaten by a tiny population, so we
effectively got some production without work.  Fix by taking away that
free food after people ate, in do_feed().
2008-05-07 10:33:41 +02:00
dc9d847b8b Add sequence numbers to game state (experimental)
This catches output dependency violations, e.g. two threads doing a
read-modify-write without synchronization.

New struct emptypedstr member seqno.  Make sure all members of unit
empobj_storage share it.  Set it in ef_blank() and ef_set_uid(), step
it in ef_write().  fairland and files don't use ef_set_uid(); need to
set it manually in files.c's main() and file_sct_init().

Factor do_read() out of fillcache() to make it available for
new get_seqno().
2008-05-07 10:33:41 +02:00
2aec870a14 New concept sector terrain
A sector type's terrain (struct dchrstr member d_terrain) is the
sector type of its underlying terrain.  Sector types occuring in
d_terrain are terrain types, and must have their own type in
d_terrain.  Players can change sector types only to those with the
same terrain.

The builtin configuration defines terrain types sea, mountain,
wasteland, wilderness and plains.  It gives bridge span and tower
terrain sea, and everything else terrain wilderness.  Hence, the stock
game remains unchanged.

Deities can use terrain to create sector types that can be developed
only in limited ways.
2008-05-07 10:33:41 +02:00
e3658ff2f0 Remove hard-coded differences between highways and bridge heads
Let highways build and support bridges.  Allow bridge heads anywhere,
not just on the coast.
2008-05-07 10:33:41 +02:00
Markus Armbruster
9f1b4e2c81 Document Hvy Metal refinery p.e. 2008-05-07 10:33:41 +02:00
Markus Armbruster
5d0f5e69ee Rebase of Hvy Metal I final version
Straightforward forward port.  Drop the code to reset track on
startup.  It's not necessary, and it breaks linking of empdump.
2008-05-07 10:33:41 +02:00
abd64835c7 Update change log again for 4.3.14 2008-05-05 06:57:42 +02:00
fe5b26658d Fix fire not to disclose retreat and wipe out target shell use
multifire() clobbered any changes to the target ship or sector made by
defend().  This let the target fire back for free.

multifire() retreated the target ship before reporting its location to
the player.  This disclosed its new location.

Fix by damaging and retreating the target after calling defend().
2008-05-05 06:53:33 +02:00
aae77430bf Change fire to always fire guns when the target is beyond range
multifire() drops depth charges if the target is a submarine, else it
fires guns.  It fails if the target is out of range.  But players
could still find out whether the target is a sub then, because depth
charge shell use differs from gun fire shell use.  This loophole
existed before 4.0.6, and was reopened by commit a3ad623b (v4.3.12).

Change multifire() to always use guns if the target is out of range.

While there, treat failure from shp_dchrg() and shp_fire() the same,
so that the player can't distinguish the two cases.  Failure there
should not happen.
2008-05-05 06:52:15 +02:00
cd6d12c4fb Make depth charges work with just one shell
Commit a3ad623b (v4.3.12) made depth charging fail when there's just
one shell.  This let players find all submarine uids.  It basically
reopened the loophole closed in commit aa26c53e (v4.2.20).

Fix by making shp_dchrg() with just one shell succeed and return
damage like fire from one gun.
2008-05-04 19:27:31 +02:00
66165f34cb Fix fire command to detect when the firing object changes
multifire() failed to take into account that the firing firing sector,
ship or land unit can change while it is getting the target argument.
It thus clobbered any updates made to the firing object while it was
sleeping for the target argument.  Abusable.  Broken when Chainsaw
introduced MULTIFIRE.
2008-05-04 16:44:26 +02:00
bf2fd6cb82 Fix parsing of anchor-relative time in update schedule
Commit 16b811d4 (v4.3.13) broke parse_time().
2008-05-04 09:52:46 +02:00
e8f82d34a7 Update change log again for 4.3.14. 2008-04-29 22:08:03 +02:00
a433320125 Journal input of special cookies "ctld" and "aborted"
The latter is necessary to interpret the journal correctly.  The
former isn't, as it should always lead to a logout straight away, but
treating it just the same is simple and doesn't hurt.
2008-04-29 21:42:17 +02:00
f3202225f2 Rewrite recvclient() for clarity
Behavior differs for the following scenario: if, while the thread
sleeps in io_input() called from recvclient(), at least one line of
input arrives and the thread gets awakened by the update aborting
commands, then the old code throws away the first line of input, but
the new code doesn't.
2008-04-29 21:35:02 +02:00
8209b88a54 Fix launch not to report the same ship sunk twice
This happened when a marine missile with a conventional warhead sunk
its target.
2008-04-29 21:10:33 +02:00
c539820350 Oops on nuclear-tipped anti-sat missiles
Anti-sat code is not prepared to deal with nuclear damage.  The arm
command refuses to arm anti-sats, but better check.
2008-04-29 21:01:54 +02:00
7bc63871c6 Fix bugs in tracking of planes flying a sortie
Commit 7ca4f412 fixed tracking of planes flying a sortie by marking
them with flag PLN_LAUNCHED.  It failed to write SAMs and planes
flying missions back to the plane file, in sam_intercept() and
mission_pln_arm().  The only known problem with that is fairly
harmless: when the mission damages planes on the ground, the planes
flying it get damaged as if they were still sitting in their bases,
but the damage gets wiped out when they land.

The same issue applies to missiles.  So they need to be tracked as
well.  Do that in msl_hit().

While there, remove a few redundant PLN_LAUNCHED sanity checks.
2008-04-29 20:53:35 +02:00
4e9e58bf6a Write planes fixed on game start to disk properly
When fixing planes stuck in the air, we fixed them only in memory, so
when a fixed plane wasn't written to disk for other reasons before the
next game start, it had to be fixed again.

Change pln_zap_transient_flags() to write them out.
2008-04-29 20:38:10 +02:00
dd0e0423ee Don't let hardened missiles be loaded on ships or land units
Fix load_plane_ship() and load_plane_land() to reject hardened planes.
2008-04-28 22:30:19 +02:00
1d0f4b3071 Don't let missiles loaded on land units be hardened
hard() already rejected missiles loaded on ships, but missed land
units.
2008-04-28 22:27:54 +02:00
4f40ea04d8 Document what happens when the update aborts commands 2008-04-28 22:24:36 +02:00
c66e8319ee Revert "(prmptrd, uprmptrd): Should not be called while player->aborted. Check."
This reverts commit fee8ac9d8f.

These *are* called while player->aborted.  Could be avoided, but: the
reason for not wanting to prompt then is to have each prompt consume a
line of input.  That's actually not feasible, because when we wait for
an argument (after prompting for it) when the update aborts commands,
we can't consume the argument we prompted for.
2008-04-28 22:22:18 +02:00
61998d2316 Fix lnd_fire() ammo sanity check
Checking l_ammo before lnd_dam() oopses when something attempts to
fire from a land unit type that can't fire (l_dam == 0) and uses no
ammo.  Such usage is perfectly fine.  Move the check to the correct
place.
2008-04-26 10:15:05 +02:00
9e19123abf Update change log for 4.3.14 2008-04-25 22:28:40 +02:00
32d6c5e1b7 A script for post_crash_dump_hook 2008-04-25 22:13:08 +02:00
f63401329d New post_crash_dump_hook
Run it from crash_dump().  Useful to move core files out of the way,
alert deities by e-mail, and so forth.
2008-04-25 22:12:22 +02:00
dd0737f8e7 Detect and log errors in crash_dump() 2008-04-25 22:09:52 +02:00
f55860670a Move oops actions from log.c up to application
Change oops() to call the new oops_handler function pointer instead of
offering a fixed set of actions.  Change server's main() to install a
handler for the action requested by -E.
2008-04-25 22:06:13 +02:00
6709931d51 Give try_supply_commod() internal linkage 2008-04-22 21:56:35 +02:00
627e7d452d New server option -E to choose what to do on oops
Three options: abort, crash-dump, nothing.  crash-dump works by
aborting a fork.  It isn't implemented for Windows.

The oops action is no longer tied to daemon mode, but -d still implies
-E abort for convenience.
2008-04-21 21:52:27 +02:00
beb8a7ceb4 Flush every journal entry even when not in debug mode
Somewhat wasteful, but useful in case of a crash.
2008-04-21 20:42:50 +02:00
b1a0ff2fbd Don't let trains load trains
Doesn't affect the stock game, because its only train is heavy.
2008-04-20 15:11:15 +02:00