Commit graph

4255 commits

Author SHA1 Message Date
d2057af7a2 Make add refuse to touch a country while it's being played
I suspect player code could get terminally confused by country state
changing unexpectedly.  Not worth the risk.
2011-12-29 11:47:06 +01:00
881b6fbd2b Fix add not to crash on negative country number 2011-12-29 11:47:06 +01:00
b36727e7fb Don't bother giving POGO BTUs in files
Deity's BTUs get reset to maximum on login anyway.
2011-12-29 11:47:06 +01:00
37e9b6aa9c Create all deities with $123456789, not just POGO 2011-12-29 11:47:06 +01:00
ad308c5de8 Move setting nat_cnam, nat_pnam into nat_reset() 2011-12-29 11:47:06 +01:00
bb442abdcd Use nat_reset() for POGO in files.c
Requires moving it from subs/natsub.c to common/nat.c.
2011-12-29 11:47:06 +01:00
5fd595a59a Make files set the usual nation flags for POGO
The add command sets nation flags NF_FLASH, NF_BEEP, NF_COASTWATCH,
NF_SONAR, and since 4.2.6 NF_TECHLISTS.  POGO is created by the files
utility, which sets only NF_FLASH (since 4.2.2).  Change files to
match add.
2011-12-29 11:47:05 +01:00
5232add0f5 nat_reset() is no longer used with STAT_SANCT, simplify 2011-12-29 11:47:05 +01:00
7739830594 Change newcap back to not wiping the country
Just create sanctuaries, put country into STAT_SANCT, grant BTUs and
money, set origin and initial realms.

This reverts commit e1a68c72 (v4.3.12) as far as newcap is concerned.
Except we still set nat_access, because that needs to be set along
with nat_btu.

Additionally, leave levels and telegrams alone.

Should have no effect in practice, because newcap works only in
STAT_NEW, and we get there with the add command, which wipes the
country.
2011-12-29 11:47:05 +01:00
6984f9d982 Make add always reset the country
Before, add reset the country only when adding a player or a visitor.
When adding a deity or deleting a country, it set just nat_cnam,
nat_pnam and nat_state.  Has always been that way.

Because of that, a newly minted deity country could inherit all kinds
of crap from a previous user of its country number: origin, realms,
relations, telegrams, ...  Harmless if the country number has never
been used before, which is how add is generally used.

When adding a deity country, initial levels (start_education, ...) now
apply, relations start NEUTRAL instead of AT_WAR, and the usual
initial nation flags are set.

Reset on delete as well, just to get rid of the special case.
2011-12-29 11:47:05 +01:00
373f20a8b5 Rename add argument "new" to "player"
This makes the correct choice for player countries obvious.  Keep
recognizing "new" for now, but deprecate it.
2011-12-29 11:47:05 +01:00
3fb00c79d9 Drop add argument "active"
Argument "active" is obscure.  It creates a country in STAT_ACTIVE
that doesn't have a capital, and has its origin at the true origin.
If you really want such a country, create it in STAT_NEW normally,
then use edit to go to STAT_ACTIVE.
2011-12-29 11:47:05 +01:00
62f0da239f Drop add's obscure sector check and wipe functionality
If you really need to wipe out a country, there's much more to wipe
than just sectors.
2011-12-29 11:47:05 +01:00
a9e485b13e Drop add's undocumented land unit destruction feature
It doesn't destroy ships, planes or nukes, either.
2011-12-29 11:47:05 +01:00
062c660e28 Permit no-op country name change again
Commit aa5861d1 (v4.3.20) made add, edit and change reject a country
name that is already in use.  Even if it's used by the same country.
Relax that.
2011-12-29 11:47:05 +01:00
9b2e906ea1 Improve newcap's origin error message 2011-12-29 11:47:05 +01:00
c9b380eee4 Streamline a few files error messages
Write one nice line to stderr instead of a cryptic one to stderr, and
an uninformative one to stdout.
2011-12-29 11:47:05 +01:00
73129c15cc Fix files and fairland to report ef_open() failure just once
ef_open() already reports failure since commit 7eb2fe57, v4.2.20.
Drop the second report from its callers.
2011-12-29 11:47:05 +01:00
f006e373f9 Replace exit(-1) by exit(1)
exit() uses only the least significant byte of its argument.
2011-12-29 11:47:05 +01:00
06753c7e2b Make allocate_memory() return void
It can't fail since commit ba1a320c, v4.3.15.
2011-12-29 11:47:05 +01:00
9be42299b5 Guard against unusable fd in pthreads' empth_select()
0 <= fd < FD_SETSIZE must hold, or else undefined behavior in
FD_SET().
2011-12-29 11:47:05 +01:00
55e689fb31 Fix lwpSleepFd()'s guard against unusable fd
0 <= fd < FD_SETSIZE must hold, or else undefined behavior in FD_SET()
and buffer overrun in LwpFdwait[fd].  Check of upper bound off by one,
check of lower bound missing.
2011-12-29 11:47:05 +01:00
0b66d8e281 Plug FILE leak on show_first_tel() error paths
Leak introduced in commit 4238323d, v4.3.20.  Unlikely to bite in
practice, as only corrupt mailbox files can cause these errors.
2011-12-29 11:47:05 +01:00
8e391f29a1 Plug memory leak in set_paths() error path
Leak appeared in commit 91eefc3f, v4.3.12.  Harmless in practice,
since the error is ultimately fatal.
2011-12-29 11:47:05 +01:00
5a77a8186e Fix read_schedule() not to fclose(stdin)
Did that since the initial commit 71320ed6, v4.3.10.
2011-12-29 11:47:04 +01:00
881dd41626 Plug FILE leak on read_schedule() parse error path
Leak introduced in initial commit 71320ed6, v4.3.10.
2011-12-29 11:47:04 +01:00
6104d534e9 Plug memory leak in verify_row()
Leak introduced in commit b30c83cd, v4.3.28.
2011-12-29 11:47:04 +01:00
354664eef2 Make play show no last command when there hasn't been one
Before, it printed NULL, which isn't helpful.
2011-12-29 11:47:04 +01:00
11d6e8ce80 Remove unreachable code in sell()
sell used to search multiple sectors for sellable commodities, keeping
tally in totalcom.  It failed with message "No eligible" when none
could be found.

sell's second argument got changed to a single sector in Empire 3.  If
the sector can't sell, we return early.  Else, totalcom is positive.
Thus, the "No eligible" code is unreachable.  Remove it.
2011-12-29 11:47:04 +01:00
845fc9eb56 Fix info sell on second argument
Empire 3 changed it to a single sector, but neglected to update info.
2011-12-29 11:47:04 +01:00
1086387f8b Make scripts/savecore create the core directory 2011-12-29 11:47:04 +01:00
5e9fb6b607 Rename tgz to arc in scripts/backup
tgz looks silly when you hack the script to use something other than
tar+gzip.
2011-12-29 11:47:04 +01:00
44235c0092 Fix empire(6) synopsis for argument of -s
Commit 464094a6 (v4.3.26) changed it in section description, but
missed section synopsis.
2011-12-29 11:47:04 +01:00
14af9e5b96 Fix use-after-free when plane is downed or aborted in dogfight
ac_dog() passed ap and dp to ac_dog_report() after ac_planedamage()
freed it.  Broken in commit 73260a8a, v4.3.27.  Diagnosed with
valgrind.
2011-12-29 11:44:16 +01:00
a990d90b84 Bump version to 4.3.29 2011-08-03 20:36:28 +02:00
513352f50c Clean up omit_ids() not to set an extra element in idgap[] 2011-07-16 15:30:10 +02:00
b7594e6570 Update change log for 4.3.28 2011-07-16 13:47:48 +02:00
617cb41f66 Don't let POGO (#0) navigate and march ghosts
POGO can navigate dead ships, and march dead land units.  The ghosts
even get sighted and interdicted, and can hit mines (landmines only
until commit fe372539, v4.3.27).  Noted for ships in commit 9100af0b.
Has always been broken.  Fix by making shp_sel() and lnd_sel()
explicitly reject ghosts.

Same code pattern also exists in pln_sel, but dead plains fail the
efficiency test, so it's harmless there.  Apply the same fix anyway.
2011-07-16 13:47:48 +02:00
45d090b8c3 Make llook ignore land units and planes loaded on land units
Probably overlooked when trains were added in 4.0.0.
2011-07-16 13:47:48 +02:00
0a693c1fa2 Fix "sector can board" test to ignore land units on land units
boar() lets a sector board if it has mobility or usable land units.
Embarked land units are not usable.  But it tests only "on ship", not
"on land unit".  Broken in 4.0.17.
2011-07-16 13:47:36 +02:00
41dc6de306 Fix transport to reject planes loaded on land units
The transported plane remains on its carrier.  When the land unit
moves, the plane is teleported right back to it.  Broken since
Chainsaw 3 added land units.

While there, improve the message for planes on ships.
2011-07-16 13:45:55 +02:00
5b0cf9c2a3 Fix lradar to reject land units loaded on land units
Probably overlooked when trains were added in 4.0.0.

While there, improve the message for land units on ships.
2011-07-16 11:48:35 +02:00
8ed7658f9b Fix strength to ignore land units loaded on land units
They can't defend their sector, see get_dlist().

Missed when 4.2.0 made them not defend the sector.
2011-07-13 20:37:41 +02:00
0faf0034e5 Fix navigate and march to find paths longer than 7 sectors again
Broken in commit 8f008bf8, v4.3.27.  How embarrassing...
2011-07-12 07:12:57 +02:00
80a2fdc8ff Make march sub-command 'i' show military, #land units loaded 2011-07-10 21:22:52 +02:00
16d00ae7bf Update doc/debugging for recent commit a9611a57 2011-07-10 21:17:01 +02:00
c6d3f68bbb New server option -F to force start even when state looks bad
Risks crashes and further corruption, but gives deities a chance to
fix up a bad game state with edit commands and such.
2011-07-10 21:17:01 +02:00
c27564c0a9 Give init_server() internal linkage 2011-07-10 21:17:01 +02:00
2a5d12be54 Change empdump to export even when game state looks bad
Just print a warning then.  Gives deities another tool to fix up a bad
game state.
2011-07-10 21:17:01 +02:00
d63b0e1a7b Split ef_verify() into ef_verify_config(), ef_verify_state() 2011-07-10 21:17:01 +02:00