Before, satellites could be disarmed and armed even in orbit. Nukes
on satellites went along into orbit, where they did nothing in
particular.
Nukes on ABMs and SAMs were lost without effect when their missile
intercepted.
The stock game is not affected, because its satellites, ABMs and SAMs
all have zero load.
These were leftovers from Chainsaw, and their only remaining effect
was a flak bonus.
The got replaced except for flak by plane selector stealth under
Chainsaw option STEALTHV, which became mandatory in Empire 2. It is
unclear why STEALTHV didn't cover flak. No planes with these
capabilities have existed in the stock game since Empire 2.
The various bombing functions silently skipped planes not carrying
bombs. This sanity check was wrong: it checked capabilities "tactical
or not cargo" instead of "tactical or bomber", and failed for
non-tactical cargo bombers. No such planes exist in the stock game.
The broken check comes from Chainsaw; it replaced an equally wrong
"not cargo" check.
Because pln_sel() lets only suitable planes go on a bombing run, the
broken sanity check is unnecessary. Drop it.
There are three ways to fly cargo: transport (fly command with a
commodity argument), cargo drops (drop command that isn't a sea mine
drop), and paradrops.
A cargo flight can be either an airlift or an airdrop. Airlifts carry
more cargo than airdrops. A cargo drop or paradrop with a non-VTOL
plane is an airdrop. Anything else is an airlift.
Before, paradrop always behaved like an airdrop, regardless of VTOL,
and drop always like an airlift. This made little sense.
Effect of the change on the stock game: paradrop with tc carries twice
the punch, and np/tr/jt can drop less than they can fly. In
particular, tr can't drop guns anymore, and jt can drop only one
instead of three.
Plane flying commands first select the planes to fly the mission and
their escorts, then equip them. They all fail when no planes to fly
the mission can be equipped.
Unlike bomb and paradrop, commands drop, fly, recon and sweep had an
additional check that made them fail when no planes to fly the mission
could be selected. Because "none selected" implies "none equipped",
the additional check is redundant. Remove it.
While there, break lines in calls of pln_sel() more tastefully.
Before, bomb selected any plane, but planes with zero load could not
be equipped. Cargo planes could be equipped fine, and they flew bombs
to the target, where they silently vanished.
Closes#1388263.
Initially, paradrop capability was implied both by capability cargo
and by capability VTOL. Chainsaw changed para() to require cargo, and
added compile-time option PARAFLAG to additionally require new
capability para. The optional PARAFLAG rule became mandatory in
Empire 2.
Chainsaw left the old tests for "cargo or VTOL" in place. Because
para() checked "cargo and para" first, the old tests for "cargo or
VTOL" always passed, so they had no effect.
Clean them up anyway.
These missions imply the cargo type, just like bombing missions. Use
the implied type instead of cargo type parameter ip there. Parameter
ip is now optional except for missions 't' (transport) and 'd' (drop).
Simplify para() not to pass the optional cargo type. Leave drop()
alone, because always passing the type is simpler there.
pln_arm(), pln_equip(), mission_pln_arm() mission_pln_equip() took a
mission parameter encoding the kind of sortie (strategic bomb,
pinpoint bomb, transport, ...), a flag parameter to further specify
the plane's role, and a parameter ip to specify the load.
The flags argument was always either P_F (intercept), P_F | P_ESC
(escort), or zero (any other role).
With non-zero flags, mission and ip argument were not used in any way.
Use mission 'e' and null load for escorts, and remove flags.
Intercept can still be identified by mission zero.
Also change pln_mobcost() to take a mission parameter instead of
flags, so that pln_arm() and mission_pln_arm() can simply pass on
their mission.
Check the true load instead of the ip parameter. Makes a difference
only when callers pass a bogus ip that isn't actually used. Happens
for escorts, but then the call can only be reached for deities,
because for mortals the transports fail before the escorts.
Don't print hit chance for nuclear warheads, it's always 100%.
Instead, print "Arming nuclear warheads" there. That message is now
printed after interception instead of before.
Before, it took a sector argument, and targeted the lowest-numbered
satellite there. Rather inconvenient when your own satellite masks
one of the enemy's.
Moreover, the command could be abused to find all sectors with
satellites. Now it can "only" be abused to find satellite ids, and
whether they're in range. Still not ideal, but tolerable.
This can happen when hitting a sanctuary, or for ridiculously impotent
nukes: groundburst for dam < 5, airburst for dam < 7. detonate()
returned unpredictable value then.
This screwed up interdiction damage, except for missiles interdicting
ships or land units. Since nothing can move into a sanctuary, the bug
bit only with ridiculously impotent nukes.
This could make production command mispredict resource-depleting level
production. Stock game is not affected. In fact, such a product
would be highly unusual.
prod() and produce() dereferenced resource uninitialized for products
depleting resource "none" (p_nrdep != 0 && p_nrndx == 0). The latter
even wrote to it.
Depleting "none" makes no sense, and the depletion is now ignored.
Before, it could conceivably crash the server or corrupt the game.
Commit 1bca66c0 added show news and commit 71bbd642 show product
without updating the help text. Fix that. The prompt is now too
long, so add option '?' to show it, and change the prompt to refer to
that.
Move client's w32_connect() to w32sockets.c.
Replace w32_recv() and w32_send() by read() and write().
Replace w32_close() by w32_close_function.
Replace call of WSAStartup() in w32_sysdep_init() by
w32_socket_init().
Remove the identical copies of fd_is_socket(),
w32_set_winsock_errno(), w32_socket().
This reverts commit 3ec807e99a.
Our nightly build test cases rely on the PRN sequence generated by GNU
libc's random(). We used to have such a PRNG in our tree (derived
from an old version of GNU libc's), for use under Windows. Thus we
got the same PRN sequence on both our nightly test systems. Commit
3ec807e9 switched to -liberty under Windows and removed our random().
Now we got a different sequence there, breaking the test cases.
Test cases still don't work on non-Windows systems where random()
doesn't match GNU libc's. We should switch to a PRNG that produces
the same sequence everywhere.
Conflicts:
src/lib/w32/w32misc.h
This is so we can avoid linking utilities with socket libraries (see
commit 8b778634).
When using sockets, we need to replace close(), because Windows'
close() can't cope with socket file descriptors. But replacing it
always would pull in the socket stuff again. Define close() to call
function pointer w32_close_function, which is initially _close.
Rename posix_close() to w32_close_maybe_socket(). Make new
w32_socket_init() put it in w32_close_function.
Same for read() and write(): define read(), write() to call function
pointers w32_read_function, w32_write_function, initially _read(),
_write(); rename posix_read(), posix_write() to
w32_read_maybe_socket(), w32_write_maybe_socket(), and put them into
w32_read_function, w32_write_function in w32_socket_init().
Also call WSAStartup() there, and use that from loc_NTInit().
WSACleanup() now belongs next to w32_socket_init(). Don't bother,
just drop it, along with loc_NTTerm().
Put the Windows code into new open_locked() instead. It's ugly having
that in file.c, but the fakes are ugly too, and somewhat brittle.
Remove posix_open(), F_SETLK, F_RDLCK, F_WRLCK, struct flock, and
simplify fcntl().