Commit graph

3314 commits

Author SHA1 Message Date
3376589007 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.
2008-10-28 19:35:51 -04:00
0d48dae06b Explicitly specify dependency output file with gcc -MF
Used to work without that, but somehow no longer does.
2008-10-28 19:27:23 -04:00
Ron Koenderink
14319b89ec 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.
2008-10-28 08:48:25 -06:00
Ron Koenderink
436328f641 Correct the emptime.c.patch for player.c
Broken in commit 122171b.
2008-10-26 21:12:10 -06:00
Ron Koenderink
122171b8d1 Add a time base for nightly builds
Increment the time base at the each update.
Remove the unnecessary patches that overrode
the timestamp printouts.
2008-10-26 15:59:43 -06:00
Ron Koenderink
4c8bb492a3 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.
2008-10-26 15:56:04 -06:00
69c20a2f7b Bump version to 4.3.19 2008-10-19 14:41:55 -04:00
5572686e32 Update change log for 4.3.18 2008-10-18 14:40:27 -04:00
c0c416b011 Oops when unit_carrier_change() arguments OLD or NEW are invalid 2008-10-18 14:21:45 -04:00
Ron Koenderink
488b80841b Add scrap and scuttle tests to nightly builds
Also general improvements to economy for player 08.
2008-10-18 12:06:11 -04:00
Ron Koenderink
a758e38510 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.
2008-10-18 12:06:11 -04:00
Ron Koenderink
f180712625 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.
2008-10-18 10:53:42 -04:00
Ron Koenderink
62843e166c 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.
2008-10-18 10:53:36 -04:00
Ron Koenderink
8b77d0ca07 Add xdump meta and table accessible tests to nightly builds 2008-10-18 10:53:36 -04:00
Ron Koenderink
17f44e8104 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.
2008-10-16 20:50:11 -04:00
Ron Koenderink
945b473250 Add missing cd to patch step for nightlybuild.sh
If the patch step is ran without the preceeding step, the cwd
is incorrect.
2008-10-16 20:46:56 -04:00
Ron Koenderink
1047c5703f 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.
2008-09-25 21:12:24 -06:00
Ron Koenderink
787e501420 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.
2008-09-24 20:18:27 -06:00
c497da4dcf Bump version to 4.3.18 2008-09-22 21:18:24 -04:00
a32a5cd050 Update change log again for 4.3.17 2008-09-20 12:08:41 -04:00
774b590f55 Fix standalone client build for Windows
Need to compile with -mthreads since commit f082ef9f, v4.3.11.
2008-09-20 11:57:59 -04:00
65410d16fd 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.
2008-09-20 09:16:46 -04:00
e0f7751f6b Update change log for 4.3.17 2008-09-17 21:38:42 -04:00
b2f75427bd Update example to current output 2008-09-17 21:31:46 -04:00
d702068457 Fix trailing whitespace 2008-09-17 21:31:40 -04:00
a9653c475b Fix whitespace: space before tab 2008-09-17 19:29:42 -04:00
db4770426e Update known contributors comments 2008-09-17 18:54:15 -04:00
6589601e56 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.
2008-09-16 21:47:55 -04:00
5820e12504 Belatedly remove DEMANDUPDATE from info Options
Option gone since commit 6ca5e47f, v4.3.10.
2008-09-16 19:14:41 -04:00
3e15a8e226 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.
2008-09-16 19:11:18 -04:00
4a44b51f8c Guard unit.h against multiple inclusion 2008-09-16 18:47:06 -04:00
60000b1a42 Use unit_wipe_orders() to simplify build.c
Simplify build_ship(), build_plane(), build_land() and build_nuke().
2008-09-15 19:40:44 -04:00
574e20f6f5 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.
2008-09-15 19:40:44 -04:00
e7ce50405e 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
2008-09-15 19:40:44 -04:00
5f6e27ff80 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.
2008-09-15 19:40:44 -04:00
94a3108b23 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).
2008-09-15 19:40:44 -04:00
69b74bb5dd Remove takeover_ship() and takeover_land() parameter hostile
All callers pass non-zero.  Simplify accordingly.
2008-09-15 19:40:44 -04:00
b8ab065a6e 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.
2008-09-15 19:40:43 -04:00
8cf32c4854 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.
2008-09-15 19:40:43 -04:00
d2b1bef0f5 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().
2008-09-15 19:40:43 -04:00
f3651f17e5 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.
2008-09-15 19:40:13 -04:00
3318e4e4e5 Require friendly relations for trade ship to pay off 2008-09-15 19:04:17 -04:00
faca0eeac5 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.
2008-09-15 18:59:26 -04:00
693c1a64c3 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.
2008-09-15 18:48:33 -04:00
96796dc756 Fix scuttle_tradeship() to require 2% efficiency 2008-09-15 07:49:24 -04:00
221324cc10 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.
2008-09-15 07:49:24 -04:00
06dd3d80ac 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.
2008-09-15 07:49:24 -04:00
0103372471 Fix missing include in cargo.c 2008-09-15 07:48:33 -04:00
b024d57b38 Remove take_plane_off_ship(), take_plane_off_land()
Commit 3e370da5 left them pretty trivial.  Inline, simplify, remove.
2008-09-14 10:21:27 -04:00
4478df7da6 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.
2008-09-14 10:21:27 -04:00