Commit graph

3708 commits

Author SHA1 Message Date
1227140c67 Update game name and URL for Hvy Plastic 2 in info Hvy-Plastic 2010-01-26 22:49:51 +01:00
48b72af69a Document server time in info Hvy-Plastic 2010-01-26 22:49:51 +01:00
3def3727f8 New info Hvy-Plastic 2010-01-26 22:49:51 +01:00
29d2f5ccfe Change fairland island size probability distribution
Island size is randomly chosen from the interval [1..2*is+1], with
expected value is.  Use two dice to roll the size instead of one.
This makes extreme sizes much less likely.
2010-01-26 22:49:51 +01:00
880f3856d1 Make fairland record the island number in the deity territory
Can be useful for deities when further customizing their game setup.
2010-01-26 22:49:51 +01:00
d1bde67589 Fix recipient thread in output journal
Output journaling was cherry-picked from Hvy Metal II.  However, how
threads are identified in the journal changed since then.
journal_output_1() needs updating for that.
2010-01-26 22:49:51 +01:00
1cd3179b82 Fix journalling of output ids 2010-01-26 22:49:40 +01:00
6be2e3f8c5 Journal output lines instead of chunks
Output often arrives in chunks other than lines.  Hard to read in the
journal.  Delay journalling until we got a full line or our buffer is
exhausted.  This is less precise, but it'll do for now.
2010-01-26 22:44:20 +01:00
221471af6f New journal event output
To enable, set econfig key keep_journal to at least 2.  Output events
are *not* flushed to disk immediately.

Put it in Hvy Metal II now to gather real data for future testing of a
journal replay tool.
2010-01-26 22:44:20 +01:00
83fcc79bca New journal event command
Redundant information, but makes the journal easier to read.  The
redundancy might help making a journal replay tool robust.

Put it in Hvy Metal II now to gather some real data.
2010-01-26 22:44:20 +01:00
52acb4fb3c Update change log again for 4.3.24 2010-01-26 22:30:24 +01:00
2b14f876be Fix generation numbers for order command
orde() uses a "clever" trick to get away with just one
check_ship_ok(): it makes a copy of the ship in the beginning, and
checks it at the end.  Generation numbers (commit 2fa5f652) break this
trick.  It could be fixed by manually marking the ship fresh.
Instead, check the ship the stupid, straightforward way, without a
copy.
2010-01-26 22:20:16 +01:00
b54bc83e26 Normalize order's reaction to bad input
Consistently fail the command on bad or missing argument.  Before, it
merely skipped to the next ship in some cases.
2010-01-26 22:02:34 +01:00
7ac10453a2 Get third argument of "order l" the ordinary way
Now prompts when the argument is empty.  Before, that was interpreted
as zero.  Not likely to affect players.
2010-01-26 21:48:54 +01:00
ae6ad76516 Clean up dead code in orde()
Does not change optimized code (gcc -O) apart from __LINE__.
2010-01-26 21:38:31 +01:00
Ron Koenderink
eea24fb017 Fix windows client not always exiting
The call to WSAEnumNetworkEvents() was reseting network
events in particular WSAECONNRESET was sometimes being lost
causing the client to not exit.  The WSAEnumNetworkEvents()
was called from fd_is_socket() and has been replace with
getsockopt() to determine if the fd is socket or not.

Broken in commit 4d40a275, v4.3.23
2010-01-24 20:45:51 -06:00
0e3bf4c38a Update change log for 4.3.24 2010-01-19 08:40:43 +01:00
b8f5eaff0b Clean up dead stores
Does not change optimized code (gcc -O).

Spotted by the Clang Static Analyzer.
2010-01-19 08:40:42 +01:00
3650587dab Fix navigate/march crash on funny path arguments
For an argument consisting of a valid path plus whitespace,
do_unit_move() eventually passed the whitespace suffix to parse(),
then dereferenced player->argp[0].  But that was null.

Broken in commit 0c12d837, v4.3.7.  Trivial for players to trigger.
2010-01-19 08:40:42 +01:00
6c8ba9c3fd Fix player_login() not to print null pointer
When the input line contains only whitespace, player->argp[0] is null
after parse().  This condition was not checked, comtch() returned
M_IGNORE, and code handling that printed the null pointer.  Some
systems (GNU, Windows) deal gracefully with printing null strings,
others crash.  Trivial to trigger remotely.

Before the fix, the value of parse() was assigned, but never used, and
that was spotted by the Clang Static Analyzer.
2010-01-19 08:40:42 +01:00
8195d5fb88 Clean up useless getnatp() in conv(), nav_map(), tele()
Spotted by the Clang Static Analyzer.
2010-01-19 08:40:42 +01:00
8ededa44f9 Move -h to the end of the emp_server -h output
This is consistent with the other programs.
2010-01-19 08:40:42 +01:00
390841a40a Make empire, empsched and files catch extra operands
This also avoids a dead increment ap++ in src/client/main.c reported
by the Clang Static Analyzer.
2010-01-19 08:40:42 +01:00
fe0ef18e2b Make empire and files not print usage on bad option
Point to -h instead.  This is consistent with the other programs.
2010-01-19 08:40:42 +01:00
6386583c1c Fix lwpReschedule()'s assertion "have runnable thread"
If there is no runnable thread, we're deadlocked.  lwpReschedule() has
an assertion to catch this.  But it didn't work, and the code
following it would crash then.  Can't actually happen, because the
EventHandler thread is always runnable.  Spotted by the Clang Static
Analyzer.
2010-01-19 08:40:42 +01:00
43322c1cb7 Declare cant_listen() noreturn
Local analysis can now easily find out what's up.  Before, inter-
procedural analysis was required.  The Clang Static Analyzer
complained about a dereference of res that is actually fine.
2010-01-19 08:40:20 +01:00
9061ae7b9d Make CANT_HAPPEN() more obvious for static analysis
Local analysis can now easily find out what's up.  Before,
whole-program analysis was required.  The Clang Static Analyzer
complained about code that is actually fine.
2010-01-19 08:40:18 +01:00
ad80846283 Fix getpath() not to crash when path exceeds MAX_PATH_LEN
Trivial for players to trigger.  Broken in commit 0b0612ea, v4.3.16.
Spotted by the Clang Static Analyzer.
2010-01-19 08:40:17 +01:00
9b62b35424 Fix oops on escort, recon, and launch of satellite
Broken in commit 528df9ac, v4.3.23.  pln_equip() recovered fine.
2010-01-19 08:40:17 +01:00
73e25ff21e Update copyright notice 2010-01-19 08:40:17 +01:00
6e30ba88a4 Fix trailing whitespace 2010-01-19 08:40:17 +01:00
227854bca2 Stop ship and land unit movement on interdiction with no damage
Movement stops when shp_interdict() or lnd_interdict() report
interdiction.  However, they reported it only when there was
interdiction damage.

Zero interdiction damage commonly happens when interdicting missiles
miss, or all bombers abort.  Stopping regardless of damage makes more
sense there.

Moreover, not stopping is buggy: do_unit_move() needs to take care not
to wipe out updates made by interdiction to the moving ships or land
units.  It does so only when it stops.  Updates made by interdiction
without interdiction damage could get wiped out, triggering a seqno
mismatch oops.

Known ways moving ships and land units can get updated by interdiction
despite there is no interdiction damage:

* Interdicting bombers get intercepted by planes based on a navigating
  carrier, carrier gets charged petrol.  The bug wipes out the petrol
  use.

* Marching land units get interdicted by planes, but all planes miss.
  Sufficiently large collateral damage to the sector can still damage
  the land units.  The bug wipes out the damage to land units.

To make shp_interdict() and lnd_interdict() report interdiction
regardless of damage, change lnd_missile_interdiction(),
lnd_fort_interdiction(), lnd_mission_interdiction(),
shp_missile_interdiction(), shp_fort_interdiction(),
shp_mission_interdiction() to return whether there was interdiction.
Before, they returned whether there was damage.

Change unit_interdict(), perform_mission(), perform_mission_land(),
perform_mission_ship(), perform_mission_msl(), and
perform_mission_bomb() to return -1 for no interdiction, so that
callers can distinguish no interdiction from interdiction with no
damage.
2010-01-19 08:38:18 +01:00
05b56fa942 Clean up poorly chosen loop control variable names
Calling a counting loop's control variable q or z is tasteless
bordering on actively misleading.
2010-01-19 08:38:16 +01:00
3ce3b2e387 Simplify perform_mission() 2010-01-19 08:38:16 +01:00
5e77193cf0 Remove struct genlist member cp 2010-01-19 08:38:16 +01:00
2e69a24402 Remove perform_mission_land(), perform_mission_ship() parameter md 2010-01-19 08:38:16 +01:00
d471d684be Split up perform_mission()
Move code out of perform_mission() into new perform_mission_land(),
perform_mission_ship(), perform_mission_msl(), perform_mission_bomb().
2010-01-19 08:38:16 +01:00
0706836708 Make lnd_mission_interdiction() apply damage
To make lnd_mission_interdiction() work just like
shp_mission_interdiction().
2010-01-19 08:37:07 +01:00
f8e7fb8ca8 New lnd_mission_interdiction()
Factored out of lnd_interdict().  No functional change.
2010-01-19 08:37:05 +01:00
cd8fe31eda New shp_mission_interdiction()
Factored out of shp_interdict().  No functional change.
2010-01-19 08:37:05 +01:00
d4f1e02273 Fix att_reacting_units() to initialize ulist member eff
This left initial eff at zero.  No effect, because its only user
get_land() ignores efficiency increases.
2010-01-19 08:37:05 +01:00
ec75a407c7 Simplify ask_olist and get_dlist() not to re-read land units
getland() is obviously redundant in get_dlist(), because the land unit
can't have changed since the previous read.

What's up with ask_olist() is less obvious.  For each capable land
unit, ask_olist() asks the player whether to attack with it.  If it
attacks, it gets copied into olist.  Since asking the player yields
the processor, these copies can become stale.  However, re-reading
fixes that just for the last one.  Moreover, the code copes with stale
copies just fine: ask_olist() is always directly followed by
att_get_offense() or att_move_in_off(), and both replace the
potentially stale copy in olist.
2010-01-19 08:37:05 +01:00
ba0d4d0036 Remove get_land() parameter uid
For all remaining calls, the uid can be obtained from parameter llp.
2010-01-19 08:37:05 +01:00
b824495bad Inline get_land()'s "first time" case into its callers
ask_olist() and get_dlist() called get_land() with llp->chrp still
null, which made it initialize parts of llp instead of performing its
usual integrity check.  att_reacting_units() had the initialization
inline.  Change the other two to match, and simplify get_land().  No
functional change.
2010-01-19 08:37:05 +01:00
ef7ea8934f Drop last parameter of shp_hit_mine() and lnd_hit_mine() 2010-01-19 08:37:05 +01:00
a90b3e8819 Simplify use of shp_missile_interdiction()
shp_missile_interdiction() does nothing when there are no suitable
targets.  Its users avoid to call it when there are none, probably to
save a few cycles.  Optimize shp_missile_interdiction() for that case,
and simplify the callers.
2010-01-19 08:37:05 +01:00
132b52a475 Make empdump call ef_close() regardless of -n
Avoiding ef_close() with -n is not necessary, so don't.
2010-01-19 08:37:05 +01:00
3a5e23a020 Rearrange struct sctstr slightly to expose commonalities with units
Nice bonus: space needed for sectors shrinks some 4%.  Size of game
state could shrink perhaps 1-2%.
2010-01-19 08:37:05 +01:00
aa659c7754 Narrow struct sctstr member sct_mobil to char
To bring it in line with unit mobility.
2010-01-19 08:37:05 +01:00
ca2dba33f0 Make struct sctstr member sct_effic signed
To bring it in line with unit efficiency.
2010-01-19 08:37:05 +01:00