Commit graph

3069 commits

Author SHA1 Message Date
3de358e451 Journal the PRNG seed 2008-03-17 19:08:34 +01:00
e1b3a8239c Simplify how fire command parses third argument
Remove a useless strcpy() that truncated the argument to 19
characters.
2008-03-17 19:08:34 +01:00
ea43696e0d 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.
2008-03-17 19:08:34 +01:00
38d8fd046f Simplify fire command's encoding of attacker
Use file types instead of enum targ_type.
2008-03-17 19:08:34 +01:00
7d14fb4495 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.
2008-03-17 19:08:33 +01:00
Ron Koenderink
975419e7d3 Remove nightly build configurations files that are not being used
This files are not current with nightlybuild.sh, common.sh
and report.sh.
2008-03-16 17:17:04 -06:00
Ron Koenderink
0b4ee6ac27 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.
2008-03-16 17:09:00 -06:00
18acaf0e7d 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.
2008-03-14 21:22:32 +01:00
03811b2c97 Fix update's resupply of food to avoid starvation
do_feed() used supply_commod() incorrectly, which wiped out all food
in the starving sector.
2008-03-14 21:00:56 +01:00
f89edc7ae6 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.
2008-03-14 21:00:56 +01:00
942eddf533 New emp_searchque() 2008-03-14 21:00:29 +01:00
292f92f705 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.
2008-03-14 21:00:26 +01:00
d741c45560 Simplify multifire() to silence compiler warning 2008-03-14 20:34:48 +01:00
7f4a5d0630 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).
2008-03-14 20:34:44 +01:00
7b2574c167 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).
2008-03-14 20:25:45 +01:00
4babf726f0 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.
2008-03-14 20:25:44 +01:00
3c7ea15195 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.
2008-03-14 20:25:44 +01:00
7ba662567f Fix commit 91eefc3f
It miscomputed size of configdir, resulting in excessive memory
allocation.
2008-03-14 20:25:44 +01:00
231947e41a Fix make distclean to remove generated sources.mk 2008-03-14 20:25:44 +01:00
09c21f8397 Bump version to 4.3.12 2008-03-14 20:25:44 +01:00
0dd6702df1 Update known contributors comments 2008-03-14 20:25:44 +01:00
726a8e3dae 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.
2008-03-14 20:25:43 +01:00
c2a687e357 Fix stmtch() for exact match after multiple partial matches
Keep looking for exact match after finding the second partial match.
2008-03-14 20:25:43 +01:00
3c39479333 New timestamp selectors
New timestamp selector for commodity, country, game, loan, nation,
news, trade, treaty.
2008-03-14 20:25:43 +01:00
f33b96b1d1 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.
2008-03-14 20:25:43 +01:00
a680c81110 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.
2008-03-14 20:25:43 +01:00
e1a68c721d 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.
2008-03-14 20:25:43 +01:00
d1d0b0a414 Update indent-emp for removed typedef names, belatedly. 2008-03-14 20:25:43 +01:00
06a0036c63 Replace some typedef names by enum tags.
Also get rid of some mildly silly manual packing of enum types.
2008-03-14 20:25:42 +01:00
7ec0f0c0d0 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.
2008-03-14 20:25:42 +01:00
ed0c98d3c8 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).
2008-03-14 20:25:42 +01:00
f9e28d0491 Make xundump interpret escapes in identifiers
We need this because we have symbols with spaces, e.g. missions[].
2008-03-14 20:25:42 +01:00
5ef6559c6a Minor xdump documentation edit 2008-03-14 20:25:42 +01:00
4c746b5e73 Make xdump code available for future use outside the server
Move the bits useful there from src/lib/commands/xdump.c to new
include/xdump.h and src/lib/common/xdump.c.
2008-03-14 20:25:42 +01:00
761d631816 Prepare some xdump code for future use outside the server
We don't have player->cnum, player->god and pr() there.  Pass
parameters instead.
2008-03-14 20:25:42 +01:00
c75d19b082 Don't store land unit stats in struct lndstr, part 2
struct lndstr members lnd_spy, lnd_rad, lnd_ammo, lnd_fuelc,
lnd_fuelu, lnd_maxlight, lnd_maxlight are mere copies of struct
lchrstr members l_spy, l_rad, l_ammo, l_fuelc, l_fuelu, l_nxlight,
l_nland.  Remove them.

Make land unit selectors spy, rmax, ammo, fuelc, fuelu, maxlight
virtual.
2008-03-14 20:25:41 +01:00
cdf1bcfa22 Don't store land unit stats in struct lndstr, part 1
New lnd_att(), lnd_def(), lnd_vul(), lnd_spd(), lnd_vis(), lnd_frg(),
lnd_acc(), lnd_dam(), lnd_aaf() replace the struct lndstr members with
the same names.

Make land unit selectors att, def, vul, spd, vis, frg, acc, dam, aaf
virtual.
2008-03-14 20:25:41 +01:00
f86d726406 Don't store ship stats in struct shpstr
New shp_armor(), shp_speed(), shp_visib(), shp_frnge(), shp_glim()
replace the struct shpstr members with the same names.
2008-03-14 20:25:41 +01:00
ffc5d0cfd7 Don't store plane stats in struct plnstr
New pln_att(), pln_def(), pln_acc(), pln_range_max(), pln_load()
replace the struct plnstr members with the same names.

Make plane selectors att and def virtual.
2008-03-14 20:25:41 +01:00
d1a193ff07 New nstr_mksymval() to create symbolic values 2008-03-14 20:25:41 +01:00
da8a1daeef Virtual selectors
Where ordinary selectors specify a value stored in some object,
virtual selectors specify a function to call to compute a value
associated with some object.

Use them to replace the special case xdump ver by new table
EF_VERSION.

Move configkeys[] to lib/common because nsc_init() needs it to
initialize empfile[EF_VERSION].cadef.
2008-03-14 20:25:41 +01:00
38047a62f7 Reorder members of struct castr to make nsc.c easier to read 2008-03-14 20:25:40 +01:00
bc0ced464b Make nstr_exec oops on bad operator 2008-03-14 20:25:40 +01:00
93a5779e66 Make nstr_exec_val() return its first argument 2008-03-14 20:25:40 +01:00
0bcb047806 Make nstr_exec_val() more robust
Oops on bad argument, and make a better error value then.
2008-03-14 20:25:40 +01:00
422cd52209 Move nstr_promote() to src/lib/common/, external linkage 2008-03-14 20:25:40 +01:00
9eab865c38 Document nsc.h more completely 2008-03-14 20:25:40 +01:00
66a74125da Fix documentation of empfile[] contents 2008-03-14 20:25:40 +01:00
d3345ce66c Make xdprval() oops on bad argument 2008-03-14 20:25:40 +01:00
f3e9526472 Fix oops recovery in xdprval()
Failed to print the separator, which could run fields together.
2008-03-14 20:25:39 +01:00