]> git.pond.sub.org Git - empserver/log
empserver
15 years agoUpdate change log again for 4.3.19 v4.3.19
Markus Armbruster [Sun, 7 Dec 2008 23:15:19 +0000 (18:15 -0500)]
Update change log again for 4.3.19

15 years agoFix make dist in a separate build directory without git
Markus Armbruster [Sun, 7 Dec 2008 23:13:38 +0000 (18:13 -0500)]
Fix make dist in a separate build directory without git

In that case, make copied the sources.mk from $srcdir, but unless it
existed already, the peculiar workings of VPATH did us in: make
searched for the target, found it in $srcdir, and the dependency
became circular.

Fix by keeping sources.mk in $srcdir always.  We can build it there,
because its contents depends only on git state, not on anything in the
build tree.  This avoids the need to copy sources.mk alltogether.

15 years agoLWP doesn't work with Darwin due to OS bugs, avoid it for now
Markus Armbruster [Sun, 7 Dec 2008 22:25:35 +0000 (17:25 -0500)]
LWP doesn't work with Darwin due to OS bugs, avoid it for now

Darwin's getcontext() overruns its argument buffer.

15 years agoDon't let ships double-retreat first on 'i' and then on 'h'
Markus Armbruster [Sun, 7 Dec 2008 14:23:30 +0000 (09:23 -0500)]
Don't let ships double-retreat first on 'i' and then on 'h'

When a ship is shelled, retreat condition 'i' (injured) applies.  When
there's no return fire, 'h' (helpless) applies as well.  Ships
retreated twice in that case.  Fix that.

15 years agoUpdate change log for 4.3.19
Markus Armbruster [Sun, 7 Dec 2008 01:12:18 +0000 (20:12 -0500)]
Update change log for 4.3.19

15 years agoReplace other occurences of git-FOO by git FOO
Markus Armbruster [Wed, 3 Dec 2008 12:57:14 +0000 (07:57 -0500)]
Replace other occurences of git-FOO by git FOO

15 years agoUse 'git ls-files' instead of deprecated 'git-ls-files'
Gerd Flaig [Sat, 29 Nov 2008 21:30:11 +0000 (22:30 +0100)]
Use 'git ls-files' instead of deprecated 'git-ls-files'

15 years agoFix shp_prewrite() to print the sunk message
Markus Armbruster [Tue, 25 Nov 2008 00:08:16 +0000 (19:08 -0500)]
Fix shp_prewrite() to print the sunk message

Broken in commit 861a66625, v4.3.17.

15 years agoLog out player when time per day is exceeded
Ron Koenderink [Sun, 16 Nov 2008 14:42:42 +0000 (08:42 -0600)]
Log out player when time per day is exceeded

Commit 3da4030 already changed player_main() to log out the player
when m_m_p_d was exceeded in command().  This crept in accidentally.
Complete the job by changing status() to log out the player instead of
downgrading him to visitor status.

Also, change player_main(), command() and status() to apply the time
limit to countries in sanctuary in addition to active countries.
Leave visitors alone, because those are shared logins.  Make the
disconnect message to a player consistent for all situations.

Note that commit 875a80d1 already changed player_main() to apply the
time limit only to active countries instead of all, just like status()
does, but neglected to document that.

15 years agoFix nat_timeused calculation on login
Ron Koenderink [Sun, 16 Nov 2008 02:46:52 +0000 (20:46 -0600)]
Fix nat_timeused calculation on login

Broken in commit 875a80d.

15 years agoPrevent command from execute after game restrictions
Ron Koenderink [Sat, 15 Nov 2008 22:50:44 +0000 (16:50 -0600)]
Prevent command from execute after game restrictions

If a player is at a prompt when either game hours
restrictions starts or logged in time limit is exceeded
the player is allow to enter one command.

15 years agoCapital obliteration failed to charge money and report news
Markus Armbruster [Sat, 15 Nov 2008 21:43:13 +0000 (16:43 -0500)]
Capital obliteration failed to charge money and report news

Commit 221e88f1 (v4.3.15) made caploss() expect the new owner in
sct_own, so it can distinguish between sack and obliteration.  Commit
0d139ee1 (v4.3.17) broke that in sct_prewrite(): it moved zapping the
sector owner after caploss(), and passed 0 instead of the old owner to
caploss().  Because of that, obliterating a capital didn't make the
news and didn't cost the victim money.  Fix that.

15 years agoUpdate emptime.c.patch for commit cb0a373
Ron Koenderink [Sat, 15 Nov 2008 22:21:02 +0000 (16:21 -0600)]
Update emptime.c.patch for commit cb0a373

15 years agoDon't call time() for nat_last_login, use player->curup
Markus Armbruster [Sat, 15 Nov 2008 20:58:28 +0000 (15:58 -0500)]
Don't call time() for nat_last_login, use player->curup

15 years agoFix coding style and simplify seconds_since_midnight() a bit
Markus Armbruster [Sat, 15 Nov 2008 20:48:17 +0000 (15:48 -0500)]
Fix coding style and simplify seconds_since_midnight() a bit

15 years agoClean up unused variable in status()
Markus Armbruster [Sat, 15 Nov 2008 20:54:29 +0000 (15:54 -0500)]
Clean up unused variable in status()

Unused since commit 875a80d1.

15 years agoRewrite accounting of play time
Ron Koenderink [Sat, 15 Nov 2008 19:08:19 +0000 (13:08 -0600)]
Rewrite accounting of play time

Replace daychange() and gettimeleft() by update_timeused_login(),
update_timeused() and enforce_minimum_session_time().  The new
code doesn't assume the day is always 24 hours long which can
occur when transitioning into or out of DST and such.  Logging
in after more a multiple of 128 days now resets nat_timeused
properly.

Fix nat_timeused calculation on midnight rollover to include
the time since midnight.

struct natstr member nat_dayno and struct player member timeleft
are now unused, remove them.

15 years agoFix initialization of nat_last_logout
Ron Koenderink [Mon, 10 Nov 2008 00:17:46 +0000 (18:17 -0600)]
Fix initialization of nat_last_logout

Broken in f94f81ee, v4.2.22.

15 years agoFix parsing of 24:00 in game_hours and update_demandtimes
Ron Koenderink [Mon, 10 Nov 2008 00:06:51 +0000 (18:06 -0600)]
Fix parsing of 24:00 in game_hours and update_demandtimes

daytime() rejects 24:00 as invalid.  This makes daytime_range()
fail, is_daytime_allowed() ignore this and later ranges silently.
Broken in commit acdee1e3, v4.2.15.

15 years agoNew option RAILWAYS
Markus Armbruster [Sun, 26 Oct 2008 17:24:41 +0000 (13:24 -0400)]
New option RAILWAYS

With RAILWAYS, highway-like sectors double as rail.  They need to be
at least 5% efficient to be operational, and then they additionally
extend rail into adjacent sectors that are at least 60% efficient.

New opt_RAILWAYS, SCT_HAS_RAIL(), sct_rail_track().  Update
sector_mcost(), bp_neighbors(), lnd_mar_one_sector() for RAILWAYS
mobility rules.  Update sinfra(), spyline(), satdisp_sect() to show
rail track instead of rail infrastructure for RAILWAYS.

New virtual sector selector track, implemented by nsc_sct_track().

15 years agoAge che just like reserves (1% per 24 ETUs)
Markus Armbruster [Sun, 26 Oct 2008 17:08:01 +0000 (13:08 -0400)]
Age che just like reserves (1% per 24 ETUs)

Factor aging out of age_levels() into new age_people().  Use it in
do_feed() to age che.

15 years agoPermit ships to assault the sector they're in
Markus Armbruster [Thu, 24 Apr 2008 18:38:57 +0000 (20:38 +0200)]
Permit ships to assault the sector they're in

Ships still have to be in a sea sector to assault an adjacent sector.

15 years agoDon't produce food without work
Markus Armbruster [Tue, 1 Apr 2008 18:17:52 +0000 (20:17 +0200)]
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().

15 years agoNew concept sector terrain
Markus Armbruster [Wed, 13 Feb 2008 19:54:08 +0000 (20:54 +0100)]
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.

15 years agoExplicitly specify dependency output file with gcc -MF
Markus Armbruster [Tue, 28 Oct 2008 23:27:23 +0000 (19:27 -0400)]
Explicitly specify dependency output file with gcc -MF

Used to work without that, but somehow no longer does.

15 years agoRepresent logged in time in seconds rather than minutes
Ron Koenderink [Tue, 28 Oct 2008 14:48:25 +0000 (08:48 -0600)]
Represent logged in time in seconds rather than minutes

This simplifies things.  In particular, it gets rid of random rounding
in getcommand(), which created a variation in the nightly build
depending on whether the update starts before or after the deity logs
out.

Replace struct natstr member nat_minused by nat_timeused, and update
cou_ca[] accordingly (this affects xdump nat).  Replace player member
minleft by timeleft, and getminleft() by gettimeleft().  Update
getcommand(), daychange(), player_main(), status() accordingly, taking
care not to change player output.  Change edit country key 'u' to work
in seconds.

15 years agoCorrect the emptime.c.patch for player.c
Ron Koenderink [Mon, 27 Oct 2008 03:12:10 +0000 (21:12 -0600)]
Correct the emptime.c.patch for player.c

Broken in commit 122171b.

15 years agoAdd a time base for nightly builds
Ron Koenderink [Sun, 26 Oct 2008 21:59:43 +0000 (15:59 -0600)]
Add a time base for nightly builds

Increment the time base at the each update.
Remove the unnecessary patches that overrode
the timestamp printouts.

15 years agoAdd more tests to nightly builds
Ron Koenderink [Sun, 26 Oct 2008 21:56:04 +0000 (15:56 -0600)]
Add more tests to nightly builds

Add Player 02 as an ally for Player 01.
Add tests for telegrams, wall, announce, relationships,
land units, wire, fire, attack, planes, autofish and autooil.

15 years agoBump version to 4.3.19
Markus Armbruster [Sun, 19 Oct 2008 18:41:55 +0000 (14:41 -0400)]
Bump version to 4.3.19

15 years agoUpdate change log for 4.3.18 v4.3.18
Markus Armbruster [Sat, 18 Oct 2008 18:40:27 +0000 (14:40 -0400)]
Update change log for 4.3.18

15 years agoOops when unit_carrier_change() arguments OLD or NEW are invalid
Markus Armbruster [Sat, 18 Oct 2008 18:21:45 +0000 (14:21 -0400)]
Oops when unit_carrier_change() arguments OLD or NEW are invalid

15 years agoAdd scrap and scuttle tests to nightly builds
Ron Koenderink [Fri, 10 Oct 2008 03:49:07 +0000 (21:49 -0600)]
Add scrap and scuttle tests to nightly builds

Also general improvements to economy for player 08.

15 years agoAdd land units tests to nightly builds and improve economy
Ron Koenderink [Wed, 8 Oct 2008 13:52:10 +0000 (07:52 -0600)]
Add land units tests to nightly builds and improve economy

Up the bar production.  Start education and tech for player 08
Improve the general economy for player 08.  Add land units building
tests to player 01, including ensuring the tech is high to build.

15 years agoFix initialization of new elements in plane, land and nuke tables
Ron Koenderink [Mon, 6 Oct 2008 23:58:59 +0000 (17:58 -0600)]
Fix initialization of new elements in plane, land and nuke tables

ef_init_srv() neglected to set struct empfile callback oninit.  This
made unit_carrier_change() crash or oops on freshly initialized
planes, land units and nukes, i.e. when build used an uid that hadn't
been used before.  Oops recovery worked.

Broken in commit 64a53c90, v4.3.17.

15 years agoAdd xdump tests to nightly builds
Ron Koenderink [Sun, 28 Sep 2008 15:03:50 +0000 (09:03 -0600)]
Add xdump tests to nightly builds

Add xdump meta test to Turn 00 Player 02 to verify player visibility.
Add xdump test to Turn 99 Player 00 to verify xdump output.
Add xdump test to Turn 99 Player 01 to player's version of xdump
output.

15 years agoAdd xdump meta and table accessible tests to nightly builds
Ron Koenderink [Sat, 27 Sep 2008 23:41:06 +0000 (17:41 -0600)]
Add xdump meta and table accessible tests to nightly builds

15 years agoMove test scripts from nightlybuild.sh to separate files
Ron Koenderink [Sat, 27 Sep 2008 01:47:16 +0000 (19:47 -0600)]
Move test scripts from nightlybuild.sh to separate files

The test scripts are now in nightly/tests/TURN/PLAYER.  For each turn,
the update script is executed first (except for turn 00), and then all
the player scripts in the appropriate turn directory.  This runs
runfeed() in different directories; change it to accomodate for that.

The update script runs "report *" on all updates.  Before, it ran only
on some of them.

15 years agoAdd missing cd to patch step for nightlybuild.sh
Ron Koenderink [Fri, 26 Sep 2008 23:33:11 +0000 (17:33 -0600)]
Add missing cd to patch step for nightlybuild.sh

If the patch step is ran without the preceeding step, the cwd
is incorrect.

15 years agoCorrection for Ubuntu Conversion
Ron Koenderink [Fri, 26 Sep 2008 03:12:24 +0000 (21:12 -0600)]
Correction for Ubuntu Conversion

Change nightlybuild.sh to allow the setting of the pthread
option for ./configure.  Remove the incorrectly added xml
header line from the ubuntu-pthread.i386.config file.

15 years agoSwitch Linux nightly builds to Ubuntu and add pthread build.
Ron Koenderink [Thu, 25 Sep 2008 02:18:27 +0000 (20:18 -0600)]
Switch Linux nightly builds to Ubuntu and add pthread build.

Remove the cron file for SuSE.  Add cron file for Ubuntu.
Remove LWP config file for SuSE.  Add LWP and pthread config
files for Ubuntu.

15 years agoBump version to 4.3.18
Markus Armbruster [Tue, 23 Sep 2008 01:18:24 +0000 (21:18 -0400)]
Bump version to 4.3.18

15 years agoUpdate change log again for 4.3.17 v4.3.17
Markus Armbruster [Sat, 20 Sep 2008 16:08:41 +0000 (12:08 -0400)]
Update change log again for 4.3.17

15 years agoFix standalone client build for Windows
Markus Armbruster [Sat, 20 Sep 2008 15:57:59 +0000 (11:57 -0400)]
Fix standalone client build for Windows

Need to compile with -mthreads since commit f082ef9f, v4.3.11.

15 years agoDisable incorrect autmatic supply in load and lload
Markus Armbruster [Sat, 20 Sep 2008 13:16:46 +0000 (09:16 -0400)]
Disable incorrect autmatic supply in load and lload

load_land_ship() and load_land_land() automatically resupply the land
units they load.  This can draw supplies from the sector where the
land units are.  When load() and lload() later update the sector, they
wipe out the update made for drawing supplies, and we get a seqno
mismatch oops.  Highly abusable.  Disable for now.

15 years agoUpdate change log for 4.3.17
Markus Armbruster [Thu, 18 Sep 2008 01:31:07 +0000 (21:31 -0400)]
Update change log for 4.3.17

15 years agoUpdate example to current output
Markus Armbruster [Thu, 18 Sep 2008 01:17:52 +0000 (21:17 -0400)]
Update example to current output

15 years agoFix trailing whitespace
Markus Armbruster [Thu, 18 Sep 2008 01:09:14 +0000 (21:09 -0400)]
Fix trailing whitespace

15 years agoFix whitespace: space before tab
Markus Armbruster [Wed, 17 Sep 2008 23:29:42 +0000 (19:29 -0400)]
Fix whitespace: space before tab

15 years agoUpdate known contributors comments
Markus Armbruster [Wed, 17 Sep 2008 22:54:15 +0000 (18:54 -0400)]
Update known contributors comments

15 years agoMake unit_give_away() immune to infinite recursion
Markus Armbruster [Wed, 17 Sep 2008 01:47:55 +0000 (21:47 -0400)]
Make unit_give_away() immune to infinite recursion

Put the unit before recursing into its cargo.  This breaks cycles in
the "is loaded on" relations.  Such cycles exist only in a corrupt
game state.  Mildly inefficient, because callers typically put the
unit again.

15 years agoBelatedly remove DEMANDUPDATE from info Options
Markus Armbruster [Tue, 16 Sep 2008 23:14:41 +0000 (19:14 -0400)]
Belatedly remove DEMANDUPDATE from info Options

Option gone since commit 6ca5e47f, v4.3.10.

15 years agoMake trade show exactly what's on sale, remove option SHOW_PLANE
Markus Armbruster [Tue, 16 Sep 2008 23:11:18 +0000 (19:11 -0400)]
Make trade show exactly what's on sale, remove option SHOW_PLANE

Planes and land units on ships are sold along with the ship, but trade
showed them only when SHOWPLANE was enabled.  Show them always.

Planes on land units are not sold along with the land unit, but trade
showed them when SHOWPLANE was enabled.  Don't.

15 years agoGuard unit.h against multiple inclusion
Markus Armbruster [Tue, 16 Sep 2008 22:47:06 +0000 (18:47 -0400)]
Guard unit.h against multiple inclusion

15 years agoUse unit_wipe_orders() to simplify build.c
Markus Armbruster [Sun, 14 Sep 2008 23:53:14 +0000 (19:53 -0400)]
Use unit_wipe_orders() to simplify build.c

Simplify build_ship(), build_plane(), build_land() and build_nuke().

15 years agoStop ships, planes, land units and nukes on violent takeover
Markus Armbruster [Sun, 14 Sep 2008 23:34:16 +0000 (19:34 -0400)]
Stop ships, planes, land units and nukes on violent takeover

This is for consistency with sectors, and for the same reason: pause
before spending money on stuff taken in the heat of battle.

15 years agoWipe orders when ship, plane, land unit or nuke changes owner
Markus Armbruster [Sun, 14 Sep 2008 23:32:34 +0000 (19:32 -0400)]
Wipe orders when ship, plane, land unit or nuke changes owner

Use new unit_wipe_orders() for violent takeover (takeover_unit() on
behalf of assault, attack, board, lboard, paradrop and pboard), and
peaceful takeover (unit_give_away() on behalf of arm, disarm, load,
unload, lload, lunload, scrap, scuttle, tend, trade).

Before, takeover_unit() cleared only group, mission and ship retreat
orders, and unit_give_away() only group and mission.  Orders that
weren't cleared:

* Mission op area (visible in xdump)

* Ship autonav orders

* Ship sail path including ship to follow and mobility quota

* Plane range limit

* Land unit retreat orders and retreat percentage

15 years agoRefactor and fix takeover.c
Markus Armbruster [Sun, 14 Sep 2008 19:13:16 +0000 (15:13 -0400)]
Refactor and fix takeover.c

Factor new takeover_unit() out of takeover_ship(), takeover_plane(),
takeover_land().  This fixes the following bugs in assault, attack,
board, lboard, paradrop and pboard:

* When the "land unit loaded on land unit" relation had a cycle,
  takeover_land() went into an infinite recursion.  Such cycles exist
  only in a corrupt game state.

* Nukes armed on planes weren't taken over along with their plane.
  Broken in commit 2e40a4bb, v4.3.3.

* Taking over land units with negative mobility increased mobility to
  zero.  Ditto planes embarked on ships or land units.

* Taking over planes embarked on ships or land units didn't clear
  their wing.

* Taking over planes and land units updated their MOB_ACCESS timestamp
  (pln_access, lnd_access), except for planes not embarked on
  anything.  This had no effect.

15 years agoFix marking of unused trade slots
Markus Armbruster [Sun, 14 Sep 2008 16:04:32 +0000 (12:04 -0400)]
Fix marking of unused trade slots

Trade code can't quite decide whether negative trd_unitid or zero
trd_owner marks unused slots.  The former is a bad idea, because blank
slots have a zero trd_unitid.

Make sure to zero trd_owner when setting trd_unitid to negative value
in trad() and check_trade().  This fixes recognition of unused slots
in set (broken in commit e16e38df, v4.2.18) and xdump (never worked).

15 years agoRemove takeover_ship() and takeover_land() parameter hostile
Markus Armbruster [Sun, 14 Sep 2008 15:30:55 +0000 (11:30 -0400)]
Remove takeover_ship() and takeover_land() parameter hostile

All callers pass non-zero.  Simplify accordingly.

15 years agoFix and simplify check_trade()
Markus Armbruster [Sun, 14 Sep 2008 15:12:45 +0000 (11:12 -0400)]
Fix and simplify check_trade()

Use unit_drop_cargo() to drop a sold land unit's cargo.

Use unit_give_away() to transfer ownership.  This fixes the following
bugs and misfeatures:

* Sold nuke wasn't taken off its plane.  Could not happen before
  commit 2e40a4bb, v4.3.3.

* Nuke on a plane wasn't sold along with the plane.  Broken in commit
  2e40a4bb, v4.3.3.

* Planes and land units on sold ships got their mobility zeroed.

* Planes on sold ships didn't get their wing reset.

15 years agoFix cargo giveaway in load, lload, unload, lunload and tend
Markus Armbruster [Sun, 14 Sep 2008 12:03:11 +0000 (08:03 -0400)]
Fix cargo giveaway in load, lload, unload, lunload and tend

Use unit_give_away() in gift().  This fixes a number of bugs:

* Nukes on planes weren't given away along with the plane.

* Likewise for land units on land units (can't happen in the stock
  game).

* Mission was not cleared by unload land/plane, lunload land/plane,
  and lload plane, except for planes on land units.

* Wing and army were never cleared.

It also happens to suppress information on planes given away along
with their land unit carriers.  Shrug.

15 years agoFix cargo giveaway in scrap and scuttle
Markus Armbruster [Sun, 14 Sep 2008 02:06:44 +0000 (22:06 -0400)]
Fix cargo giveaway in scrap and scuttle

When giving away cargo by scrapping or scuttling its carrier, the
cargo's cargo wasn't given away.  Happened for instance when a ship
carrying a land unit carrying a SAM got scrapped.

Also, wing, army and mission weren't cleared.

To fix, create unit_give_away() and use it in unit_drop_cargo().

15 years agoRefactor and fix scuttle and scrap code
Markus Armbruster [Sat, 13 Sep 2008 22:35:50 +0000 (18:35 -0400)]
Refactor and fix scuttle and scrap code

Factor unit_drop_cargo() out of scra(), scuttle_ship(),
scuttle_land(), fix it up:

* Some messages were sent as bulletins instead of printing them.

* Nukes were always destroyed.  They're now treated exactly like other
  cargo.

* scuttle destroyed some cargo silently, and listed other cargo as
  "scuttled".  It now simply lets unit_update_cargo() running from
  carrier prewrite callbacks list all cargo "lost".

Simplify its callers.  scuttle_ship() and scuttle_land() are now
trivial, inline and remove.

15 years agoRequire friendly relations for trade ship to pay off
Markus Armbruster [Sat, 13 Sep 2008 22:05:58 +0000 (18:05 -0400)]
Require friendly relations for trade ship to pay off

15 years agoRefuse to auto-scuttle where it doesn't pay
Markus Armbruster [Sat, 13 Sep 2008 19:57:36 +0000 (15:57 -0400)]
Refuse to auto-scuttle where it doesn't pay

When called from the scuttle command, scuttle_tradeship() asks for
confirmation when scuttling doesn't pay.  When called from the autonav
code, it can't ask.  Change it to fail then, and use that in
nav_ship() to avoid scuttle where it doesn't pay.  Also simplify some.

15 years agoFix when scuttle_tradeship() asks for confirmation
Markus Armbruster [Sat, 13 Sep 2008 21:07:15 +0000 (17:07 -0400)]
Fix when scuttle_tradeship() asks for confirmation

Fix scuttle to ask for confirmation when scuttling a tradeship in an
unsuitable sector even when the tradeship is pirated.  Broken when
commit a99bc3be (v4.2.13) suppressed that for pirated tradeships
wholesale because it let pirates ferret out where the ship was built.

15 years agoFix scuttle_tradeship() to require 2% efficiency
Markus Armbruster [Sat, 13 Sep 2008 20:47:10 +0000 (16:47 -0400)]
Fix scuttle_tradeship() to require 2% efficiency

15 years agoClean up rules on where you can scrap stuff
Markus Armbruster [Sat, 13 Sep 2008 19:27:42 +0000 (15:27 -0400)]
Clean up rules on where you can scrap stuff

You can now scrap ships in own or friendly, efficient harbors, planes
in own or allied, efficient airfields, and land units in any own or
allied sector.

When something can't be scrapped because of these rules, print a
suitable message.

Before, you could scrap ships regardless of relations to sector owner
(info claimed friendly was required), land units regardless of
relations, but not while on ships, and planes even in friendly
airfields (info claimed allied was required).

When scrapping in a deity sector, scrap claimed it gave the cargo to
POGO, which is somewhat bogus, as POGO can't own such stuff.

15 years agoFix scrap and scuttle output when there's output about cargo
Markus Armbruster [Sat, 13 Sep 2008 13:45:26 +0000 (09:45 -0400)]
Fix scrap and scuttle output when there's output about cargo

scra() and scut() printed their "scrapped in" / "scuttled in" message
in two parts.  Messages for scrapped / scuttled cargo were printed
between the parts.  Fix by printing in one go, after the cargo
messages.

15 years agoFix missing include in cargo.c
Markus Armbruster [Sun, 14 Sep 2008 16:04:58 +0000 (12:04 -0400)]
Fix missing include in cargo.c

15 years agoRemove take_plane_off_ship(), take_plane_off_land()
Markus Armbruster [Sun, 14 Sep 2008 14:02:17 +0000 (10:02 -0400)]
Remove take_plane_off_ship(), take_plane_off_land()

Commit 3e370da5 left them pretty trivial.  Inline, simplify, remove.

15 years agoNo need to take dead planes off carrier anymore
Markus Armbruster [Sun, 14 Sep 2008 13:53:08 +0000 (09:53 -0400)]
No need to take dead planes off carrier anymore

Until commit 3e370da5, dead planes had to be explicitely taken off
their carrier to update load counters.  This is no longer necessary;
simplify pln_put1() and scut().  scut() got it wrong, by the way: it
failed to take planes off land units.

15 years agoIndentation fix
Markus Armbruster [Sun, 14 Sep 2008 13:39:25 +0000 (09:39 -0400)]
Indentation fix

15 years agoFix cargo list shutdown oops
Markus Armbruster [Sun, 14 Sep 2008 13:37:26 +0000 (09:37 -0400)]
Fix cargo list shutdown oops

EF_PLANE is closed before EF_LAND: if a land unit carries a plane, the
plane goes away before its carrier, and unit_onresize() oopses.  Fix
by not checking cargo list consistency there when the file is already
gone.

unit_cargo_init() has a similar issue, at least theoretically: it
rebuilds cargo lists one after the other.  Zap them all first.

15 years agoFix commit 738fb28f's screwy line endings
Markus Armbruster [Sun, 14 Sep 2008 14:19:24 +0000 (10:19 -0400)]
Fix commit 738fb28f's screwy line endings

15 years agoDo not update player's bank balance when the change is zero
Ron Koenderink [Sat, 13 Sep 2008 23:33:24 +0000 (17:33 -0600)]
Do not update player's bank balance when the change is zero

Hackish work around for a race condition in the nightly build's
regression tests: sometimes the update starts right after the
force command yields, sometimes a bit later.  If it is late, we
use one random number here, for the bye, and throwing off the
random sequence.

15 years agoMake prewrite callbacks more robust
Markus Armbruster [Sat, 13 Sep 2008 17:21:12 +0000 (13:21 -0400)]
Make prewrite callbacks more robust

Treat zero owner just like efficiency below minimum.  Before, cargo
was taken off carriers only when efficiency fell below minimum, not
when owner changed to zero.

Run item_prewrite() unconditionally, for simplicity.

15 years agoRename llp to lp in lnd_postread() and lnd_prewrite()
Markus Armbruster [Sat, 13 Sep 2008 17:00:16 +0000 (13:00 -0400)]
Rename llp to lp in lnd_postread() and lnd_prewrite()

15 years agoAllow any length RW lock names for WIN32
Ron Koenderink [Sat, 13 Sep 2008 22:39:45 +0000 (16:39 -0600)]
Allow any length RW lock names for WIN32

Dynamically allocate the string space for RW
lock names for WIN32 (ntthread.c).  This
makes the WIN32 more consistent with the other
environments.

15 years agoAllow any length thread names for WIN32
Ron Koenderink [Sat, 13 Sep 2008 21:18:29 +0000 (15:18 -0600)]
Allow any length thread names for WIN32

Dynamically allocate the string space for thread
name in WIN32 (ntthread.c) thread space.  This
makes the WIN32 more consistent with the other
environments.  It also addresses WIN32 issue of
the print width of 17 being used and only having
space for 16 characters in the fixed allocation.

15 years agoUse new snxtitem_cargo() to simplify a couple of loops
Markus Armbruster [Sat, 13 Sep 2008 01:22:14 +0000 (21:22 -0400)]
Use new snxtitem_cargo() to simplify a couple of loops

Change snxtitem_all() loops that skip everything but a carrier's cargo
to use snxtitem_cargo() in scra(), scuttle_ship(), scuttle_land(),
takeover_ship(), takeover_land(), trade_desc(), feed_ship().

15 years agoRewrite the broken code to move cargo with its carrier
Markus Armbruster [Fri, 12 Sep 2008 23:31:48 +0000 (19:31 -0400)]
Rewrite the broken code to move cargo with its carrier

The old code did not move a carrier's cargo (planes, land units,
nukes) when the carrier moved.  Instead, it fixed up the location in
the postread callback.  Anything not going through ef_read(), in
particular the update, saw it in its old, incorrect location, until a
fixed up copy got written back.

Moreover, the timestamp did not change when cargo moved, so
incremental dumps did not pick up the movement.

The new code moves the cargo along with the carrier.

New unit_update_cargo() moves or destroys a carrier's cargo (planes,
land units, nukes) along with the carrier.  Call it from
shp_prewrite(), pln_prewrite() and lnd_prewrite() when the carrier
moves or gets destroyed.

Remove the code to destroy cargo from shp_prewrite(), pln_prewrite(),
lnd_prewrite().

Remove the code to fix up cargo location from pln_postread(),
lnd_postread(), nuk_postread().

This changes the message for ship and land unit cargo getting
destroyed from "sunk" and "MIA" to "lost".

15 years agoMake the item iterator capable of iterating over a cargo list
Markus Armbruster [Fri, 12 Sep 2008 22:46:54 +0000 (18:46 -0400)]
Make the item iterator capable of iterating over a cargo list

New snxtitem_cargo() initializes an iterator for a cargo list, with
new enum ns_seltype member NS_GROUP and new struct nstr_item member
next.  Extend nxtitem() and nxtitemp() to step through the list.

15 years agoClean up struct nstr_sect and struct nstr_item a bit
Markus Armbruster [Fri, 12 Sep 2008 22:41:55 +0000 (18:41 -0400)]
Clean up struct nstr_sect and struct nstr_item a bit

Members read were always set to ef_read, remove and call directly.

Member flag was only assigned to, never used, remove.

Change member group to char to match struct empobj.

15 years agoZap next uid in clink_rem(), check it in clink_add()
Markus Armbruster [Fri, 12 Sep 2008 02:10:14 +0000 (22:10 -0400)]
Zap next uid in clink_rem(), check it in clink_add()

The former ensures that next links are valid even for uids not on any
list.  The latter oopses on adding an uid to a list when it is already
on a list, unless it is at the tail.

15 years agoExpire lost items at the update instead of continuously
Markus Armbruster [Wed, 10 Sep 2008 11:30:48 +0000 (07:30 -0400)]
Expire lost items at the update instead of continuously

Replace thread DeleteItems running delete_lostitems() by simple
function delete_old_lostitems(), and call it from update_main().

15 years agoReplace econfig key lost_items_timeout by lost_keep_hours
Markus Armbruster [Wed, 10 Sep 2008 11:23:46 +0000 (07:23 -0400)]
Replace econfig key lost_items_timeout by lost_keep_hours

15 years agoFix commit d46b0b72 (didn't even compile with pthreads)
Markus Armbruster [Fri, 12 Sep 2008 22:05:25 +0000 (18:05 -0400)]
Fix commit d46b0b72 (didn't even compile with pthreads)

15 years agoFix journal_entry() to separate thread and event by space
Markus Armbruster [Fri, 12 Sep 2008 21:52:40 +0000 (17:52 -0400)]
Fix journal_entry() to separate thread and event by space

Broken in commit effc1b18.

15 years agoAdd missing error check for thread creation for WIN32
Ron Koenderink [Fri, 12 Sep 2008 01:14:35 +0000 (19:14 -0600)]
Add missing error check for thread creation for WIN32

_beginthread() call in empth_create() has two error
return values 0L and 1L.  Add the missing check for 0L.

15 years agoEnsure the empth_sleep() always yields for WIN32
Ron Koenderink [Fri, 12 Sep 2008 01:06:10 +0000 (19:06 -0600)]
Ensure the empth_sleep() always yields for WIN32

The WIN32 version did not block when the sleep was
already reached by the time empth_sleep() did the
time remaining calculation.  The other versions
of empth_sleep() do always yield.

15 years agoMake empth_name() and empth_set_name() take a thread argument
Markus Armbruster [Thu, 11 Sep 2008 23:25:34 +0000 (19:25 -0400)]
Make empth_name() and empth_set_name() take a thread argument

15 years agoUse empty schedule file for the nightly build
Ron Koenderink [Thu, 11 Sep 2008 20:58:32 +0000 (14:58 -0600)]
Use empty schedule file for the nightly build

This ensures that no unplanned updates occur
during the nightly build sequence.  Remove
unnecesary enables and disables from the script.
Remove unnecessary argument for force command.

15 years agoChange the thread name in play_cmd() to show country number
Ron Koenderink [Thu, 11 Sep 2008 20:50:08 +0000 (14:50 -0600)]
Change the thread name in play_cmd() to show country number

This makes the journal easier to read.  We can't use the country
number earlier, because it is not unique then.

15 years agoUse the thread name to identify threads in the journal
Ron Koenderink [Thu, 11 Sep 2008 20:49:28 +0000 (14:49 -0600)]
Use the thread name to identify threads in the journal

This makes the journal easier to read, and makes journals
from the nightly build easier to diff.

Since we use only the 10 first characters of the name,
abridge existing thread names to make them unique within
that many characters.

15 years agoNew empth_name() and empth_set_name()
Ron Koenderink [Thu, 11 Sep 2008 20:46:31 +0000 (14:46 -0600)]
New empth_name() and empth_set_name()

15 years agoRemove bogus comment from empthread.h
Markus Armbruster [Thu, 11 Sep 2008 11:51:03 +0000 (07:51 -0400)]
Remove bogus comment from empthread.h

Became bogus in commit d500a707.

15 years agoFix double free() in unit_onresize()
Markus Armbruster [Thu, 11 Sep 2008 11:50:18 +0000 (07:50 -0400)]
Fix double free() in unit_onresize()

Introduced in commit 64a53c90.

15 years agoSimplify tests for presence of load
Markus Armbruster [Mon, 8 Sep 2008 00:37:52 +0000 (20:37 -0400)]
Simplify tests for presence of load

Instead of counting the load with lnd_nland() / lnd_nxlight(), check
whether there's at least one loaded with lnd_first_on_land() /
pln_first_on_land().