]> git.pond.sub.org Git - empserver/log
empserver
15 years agoStore game down flag in the game table
Markus Armbruster [Sat, 7 Feb 2009 17:24:03 +0000 (18:24 +0100)]
Store game down flag in the game table

This avoids the silly opening of downfil all the time.

For what it's worth, it also makes the information visible in xdump,
as new game selector down.

15 years agoMove update_timeused() from may_play_now() back to callers
Markus Armbruster [Sun, 8 Feb 2009 13:16:57 +0000 (14:16 +0100)]
Move update_timeused() from may_play_now() back to callers

This backs out a small part of commit d1ff2a60, for clarity.

While there, oops when may_play_now() is called with incorrect natp
argument.

15 years agoFix reject accept
Markus Armbruster [Sun, 8 Feb 2009 08:30:41 +0000 (09:30 +0100)]
Fix reject accept

Instead of accepting the listed nations, rejected the nation listed
last, and accepted all the others.  Broken in commit 6844c94b, v4.3.4.

15 years agoUpdate copyright notice
Markus Armbruster [Sat, 7 Feb 2009 15:43:11 +0000 (16:43 +0100)]
Update copyright notice

15 years agoStreamline copyright notice in lwp.h
Markus Armbruster [Sat, 7 Feb 2009 15:37:20 +0000 (16:37 +0100)]
Streamline copyright notice in lwp.h

Should have been done along with the rest of LWP, in commit 2aea9269.

15 years agoFix update thread not successfully waking up with LWP
Ron Koenderink [Sun, 8 Feb 2009 02:09:30 +0000 (20:09 -0600)]
Fix update thread not successfully waking up with LWP

Commit 08b945568 broke empth_sleep() for LWP: it returned zero even
when woken up early.

15 years agoPrevent command from executing after game is down
Ron Koenderink [Thu, 5 Feb 2009 02:53:26 +0000 (20:53 -0600)]
Prevent command from executing after game is down

Move the gamedown() check from status to may_play_now() so it is
checked upon login, before a command is executed and after command
completion.  This fixes the situation where a player to could execute
one more command after the game was down.

Report to the deities that the game is down.

Remove to duplicate gamedown message.

15 years agoFix empth_select() for funny flag arguments
Markus Armbruster [Mon, 2 Feb 2009 07:08:38 +0000 (08:08 +0100)]
Fix empth_select() for funny flag arguments

EMPTH_POSIX and EMPTH_W32 implementations rejected values other than a
single flag.  Such values aren't used now, but it violates the
contract all the same.

15 years agoAdd maximum logged in time check for nation state NEW
Ron Koenderink [Sun, 1 Feb 2009 17:43:22 +0000 (11:43 -0600)]
Add maximum logged in time check for nation state NEW

15 years agoFix pthread's empth_select() not to change the timeout
Markus Armbruster [Sun, 1 Feb 2009 17:06:09 +0000 (18:06 +0100)]
Fix pthread's empth_select() not to change the timeout

Commit 08b94556 introduced the timeout parameter.  The empthread
implementation could change it, at least on some systems, and its user
worked around a possible change.  However, that behavior was not
documented, and it's inconvenient.  Fix the pthread implementation,
and remove the workaround.

15 years agoIntegrate air defense missions into interception
Markus Armbruster [Fri, 26 Sep 2008 01:51:21 +0000 (21:51 -0400)]
Integrate air defense missions into interception

The ancients designed interception dead simple: when you overfly a
sector, you get intercepted by the sector owner.  Fine print
interception rules govern which planes intercept.

Then complexity got piled on top of it.

Chainsaw 2 added an extra interception by surface ship owners, in the
target sector only.

Chainsaw 3 added an extra interception by land unit owners, in the
target sector only (Empire 4 later merged this extra land unit
interception with the extra surface ship interception).

Chainsaw 3 added an entirely separate kind of interception: air
defense missions.  When you enter a sector in some air defense op
area, you get intercepted.  Fine print air defense rules govern which
planes intercept.  These rules differ significantly from the
interception fine print.

Additional complexity comes from these facts:

* Air defense mission interception happens in addition to non-mission
  interception.  You can boost your total interception by setting up
  air defense.  Which means you must set it up, or forgo an advantage.

* Air defense planes are not available for non-mission interception
  duty.  You need to decide on a split.

* In contrast to non-mission interception, interceptors flying air
  defense get intercepted.

Moreover, the air defense code breaks one of the plane code's design
assumptions, namely that just one plane sortie is active at a time.
The air defense sortie runs while the sortie it intercepts is in
progress.  This leads to two interceptions being active at the same
time: the one intercepting the original sortie, and the one
intercepting the air defense sortie.  The same plane can fly in both
interceptions, and damage received in the interception of the air
defense sortie is wiped out, triggering a seqno mismatch oops.

The previous commit already simplified non-mission interception: you
get intercepted by anyone who owns the sector, or a surface ship or a
land unit there, whether it's the target sector or not.

Now simplify mission interception, by merging air defense back into
ordinary interception: when you overfly a sector, you get intercepted
by anyone who owns the sector, or a surface ship or land unit there,
or has an air defense mission covering the sector.  That's all.  No
multiple interceptions, no separate air defense rules.

Remove air_defense().  Simplify ac_encounter() and sam_intercept()
accordingly; both lose their last parameter.

Change sam_intercept() and ac_intercept() to intercept in mission op
areas.  New parameter only_mission to suppress non-mission
interception.  Pass zero when the intercepting country owns the sector
or a surface ship or land unit in the sector.

ac_encounter() can't efficiently predict whether a country intercepts,
so it needs to call ac_intercept() unconditionally.  This kills the
optimization to collect interceptors only when needed; simplify
accordingly, replacing getilist() by getilists().

15 years agoIntercept the same all along the flight path
Markus Armbruster [Thu, 25 Sep 2008 14:22:53 +0000 (10:22 -0400)]
Intercept the same all along the flight path

In each sector, any country owning the sector, a surface ship or a
land unit gets to intercept.

Before, only the sector owner got to intercept, except for the target
sector.  There, any country owning surface ships or land units got to
intercept in addition to the sector owner.  Thus, a sector owner with
surface ships or land units there got to intercept twice.

Info Intercept claimed you get to intercept once for ships and once
again for land units, which was wrong since 4.0.9.

Info bomb suggested that flak fires only in the target sector, which
was wrong since 4.2.8.  Drop that.

15 years agoMake ships and land units spot planes along the flight path
Markus Armbruster [Thu, 25 Sep 2008 14:05:07 +0000 (10:05 -0400)]
Make ships and land units spot planes along the flight path

Sectors already spotted overflying planes in every sector along the
flight path, but ships and land units did that only in the target
sector, once if you got any ships there, in ac_encounter(), once if
you got any land units there, in ac_encounter(), once for ships firing
flak, in ac_shipflak(), and once for land units firing flak, in
ac_landflak().  Remove all that, and generalize ac_encounter()'s code
for sectors to spot planes to include ships and land units.  Unlike
before, ships and land units don't spot allied planes.

15 years agoChange when planes spot ships and land units
Markus Armbruster [Thu, 25 Sep 2008 13:10:41 +0000 (09:10 -0400)]
Change when planes spot ships and land units

Planes now spot ships and land units only when flying recon or sweep,
and along all of their flight path instead of just the target sector.
It still takes a spy plane to identify ships and land units.

Before, non-spy planes spotted ships and land units only in the target
sector, regardless of type of sortie, once for all ships and land
units, in ac_encounter(), once for ships firing flak, in
ac_shipflak(), and once for land units firing flak, in ac_landflak().
Remove all that.

15 years agoReplace unfriendly[] by rel[] in ac_encounter()
Markus Armbruster [Thu, 25 Sep 2008 11:35:42 +0000 (07:35 -0400)]
Replace unfriendly[] by rel[] in ac_encounter()

Use it to replace the getrel() in the check for allied.

15 years agoIntercept planes at their assembly point
Markus Armbruster [Thu, 25 Sep 2008 02:09:59 +0000 (22:09 -0400)]
Intercept planes at their assembly point

Change ac_encounter() to start intercepting and running air defense
missions at the assembly point instead of the first sector entered
from there.

This also fixes a coding bug: when the flight path was empty, evaded
was used uninitialized when checking whether to intercept over the
target.  The compiler even warned about that.  Since the uninitialized
evaded typically read non-zero, interception triggered by ships and
land units didn't work.  Abusable: if you managed to make your target
sector an assembly point, e.g. by placing an own or allied ship there,
you could bomb it without getting intercepted or taking flak.

15 years agoRemove useless strncpy() in ac_encounter()
Markus Armbruster [Wed, 24 Sep 2008 23:31:15 +0000 (19:31 -0400)]
Remove useless strncpy() in ac_encounter()

15 years agoFix SAM interception for intercepts other than the first
Markus Armbruster [Wed, 24 Sep 2008 22:49:54 +0000 (18:49 -0400)]
Fix SAM interception for intercepts other than the first

A country's SAMs launched only in the first interception of a sortie.
That was because ac_intercept() made sam_intercept() delete all SAMs
from the list of available interceptors.  sam_intercept() also deleted
any SAMs out of range.  Don't do that, delete unused SAMs along with
other unused interceptors on return from ac_encounter().

15 years agoFix air defense and flak over sectors allied to the planes
Markus Armbruster [Wed, 24 Sep 2008 11:21:19 +0000 (07:21 -0400)]
Fix air defense and flak over sectors allied to the planes

Planes were not subject to air defense and flak over allied sectors.

Air defense was broken when Empire 2 changed it to happen after
spotting.

Flak was broken when 4.2.8 made ships and land units fire flak in
every sector, not just the target sector.  Although an allied sector
doesn't fire flak, it may still contain hostile ships and land units.

Also makes use of ilist[] more robust: before, if relations somehow
went sour after unfriendly[] was initialized, the sector intercept
would run with an invalid interceptor list, and crash.

15 years agoSimplify ac_encounter()'s logic for stealthy evasion
Markus Armbruster [Wed, 24 Sep 2008 02:07:52 +0000 (22:07 -0400)]
Simplify ac_encounter()'s logic for stealthy evasion

15 years agoaircombat.c isn't used for intercepting missiles, simplify
Markus Armbruster [Wed, 24 Sep 2008 01:37:38 +0000 (21:37 -0400)]
aircombat.c isn't used for intercepting missiles, simplify

Chainsaw had missiles flying missions together with planes, and to
make that work, aircombat.c got code for coping with missiles.  Since
Empire 2, missiles fly separately and don't go through aircombat.c
anymore.  The missile code there has been useless for more than a
decade.  Remove it.

This simplifies ac_encounter(), sam_intercept(), ac_intercept(),
ac_airtoair(), and gets rid of count_non_missiles(), all_missiles().

15 years agoFix making contact by spotting planes from sectors
Markus Armbruster [Wed, 24 Sep 2008 00:53:15 +0000 (20:53 -0400)]
Fix making contact by spotting planes from sectors

ac_encounter() passed MAXNOC instead of the sector owner to setcont(),
and setcont() does nothing for such an argument.  Screwed up from the
start, in commit 144c7cb5, v4.2.22.

15 years agoRefactor interception over ships and land units
Markus Armbruster [Mon, 22 Sep 2008 02:25:19 +0000 (22:25 -0400)]
Refactor interception over ships and land units

ac_encounter() lets all owners of ships and land units in the target
sector intercept, but not more than once.

Move the interception code behind reporting of both ships and land
units.  Before, it was duplicated for ships and land units.  Land
units didn't get reported when no bombers got through interception
triggered by ships.

15 years agoMake planes report non-hostile ships and lands in target sector
Markus Armbruster [Sun, 21 Sep 2008 15:02:10 +0000 (11:02 -0400)]
Make planes report non-hostile ships and lands in target sector

Before, ac_encounter() reported only ships and land units hostile to
the planes.

15 years agoPass only PM_* mission flags to ac_encounter()
Markus Armbruster [Sun, 21 Sep 2008 14:25:59 +0000 (10:25 -0400)]
Pass only PM_* mission flags to ac_encounter()

Since the previous two commits, ac_encounter() checks its
mission_flags argument only for proper mission flags PM_R and PM_S,
not for plane flags P_A, P_S, P_I.

This makes the code to put plane flags into mission flags useless.
Remove it from bomb(), drop(), fly(), para(), reco(),
perform_mission(), mission_pln_arm(), air_defense(), pln_arm().

Much of that code was useless even before: P_X and P_H since Chainsaw
3 option STEALTHV became mandatory in Empire 2, and P_MINE since
commit cc0c3e4f (v4.3.0) cleaned up mine drops.

15 years agoFix mixed ASW patrols
Markus Armbruster [Sat, 20 Sep 2008 17:21:48 +0000 (13:21 -0400)]
Fix mixed ASW patrols

A reconnaissance patrol (recon and sweep) uses sonar when ASW planes
participate.  ac_encounter() enabled sonar when P_A was in
mission_flags.  These get computed by pln_arm() and callers.  However,
they set P_A only when *all* planes were capable, including escorts.

Fix by checking actual plane capabilities instead.  Closes #1389451.

15 years agoFix recon and sweep not to spy after all spy planes are gone
Markus Armbruster [Sat, 20 Sep 2008 17:11:44 +0000 (13:11 -0400)]
Fix recon and sweep not to spy after all spy planes are gone

A reconnaissance patrol (recon and sweep) reports much more detail
when spy planes participate.  However, ac_encounter() didn't stop
doing that after all spy planes were shot down or aborted.

Fix by recalculating plane capabilities for every sector.

15 years agoReimplement max_idle without a separate thread
Ron Koenderink [Sun, 1 Feb 2009 12:22:26 +0000 (06:22 -0600)]
Reimplement max_idle without a separate thread

Remove the KillIdle thread.  Add timeout to struct iop, initialized in
io_open().  Obey it in io_input() by passing it to empth_select().  If
empth_select() times out, report that back through io_input() to
recvclient() and player_login().  If player_login() receives a timeout
indication, print a message and terminate the session.  If
recvclient() receives a timeout indication, flash a message to the
player and initiate a shut down the player's session.

Create WIN32 sys/time.h to define struct timeval.  This creates some
conflicts with WIN32 windows.h definitions.  Including windows.h in
show.c and info.c creates conflicts, so remove that.  Modify service.c
to include sys/socket.h instead of windows.h to remove the conflict
with sys/time.h.

15 years agoFix client to allow multiple to clients to run concurrently for WIN32
Ron Koenderink [Sun, 1 Feb 2009 14:58:37 +0000 (08:58 -0600)]
Fix client to allow multiple to clients to run concurrently for WIN32

Remove the names for the bounce_empty, bounce_full and ctrl_c_event
events. The named events were being shared between all clients running
on a WIN32 machine which created the affect of disconnecting a client
when an input event occurred in another client.  Broken in commit
f082ef9f (v4.3.11).

15 years agoFactor out gamehours and max minutes per day checks
Ron Koenderink [Sun, 1 Feb 2009 12:29:57 +0000 (06:29 -0600)]
Factor out gamehours and max minutes per day checks

Combine the checks from player_main(), command() and status() into
may_play_now().

15 years agoPrevent command from executing outside of game hours
Ron Koenderink [Sat, 24 Jan 2009 16:25:57 +0000 (10:25 -0600)]
Prevent command from executing outside of game hours

If a player is at a prompt when game hours restrictions start,
they can enter one more command.  Not fixed in commit 3da4030a,
v4.3.19.

15 years agoFix enforcing game hours for players already logged in
Ron Koenderink [Sat, 24 Jan 2009 16:21:19 +0000 (10:21 -0600)]
Fix enforcing game hours for players already logged in

Broken in commit 875a80d1, v4.3.19.

15 years agoSuppress the git checkout information for nightlybuilds
Ron Koenderink [Wed, 21 Jan 2009 01:50:33 +0000 (19:50 -0600)]
Suppress the git checkout information for nightlybuilds

15 years agoUpdate windows configuration for nightlybuild
Ron Koenderink [Wed, 21 Jan 2009 01:35:17 +0000 (19:35 -0600)]
Update windows configuration for nightlybuild

15 years agoSimplify the time() replacement for nightlybuilds
Ron Koenderink [Wed, 14 Jan 2009 01:20:34 +0000 (19:20 -0600)]
Simplify the time() replacement for nightlybuilds

Move the time() replacement from emptime.c.patch file
to nightlybuild.sh.

15 years agoPrevent distribution from abandoning the distribution center
Ron Koenderink [Wed, 7 Jan 2009 13:57:37 +0000 (07:57 -0600)]
Prevent distribution from abandoning the distribution center

If there are no civilians in the distribution center, distribution
could abandon the sector by distributing out all the military.

15 years agoCleaned up check_nat_name() function
Ron Koenderink [Tue, 6 Jan 2009 23:48:37 +0000 (17:48 -0600)]
Cleaned up check_nat_name() function

No functional changes.  Rename temp to p and nonb to allblank.

15 years agoAdd standard checks to the assigning of a country name
Ron Koenderink [Tue, 6 Jan 2009 23:22:26 +0000 (17:22 -0600)]
Add standard checks to the assigning of a country name

Add check to ensure a country by that name does not exist.
Ensure the length is not too long.  Note this is a change
behaviour for edit and change commands which used to silently
truncate long names.  Enforce that a country name can not have
control characters in it.  Ensure that a country name is not
blank or just spaces.

15 years agoSimplify load() and lload()
Markus Armbruster [Mon, 5 Jan 2009 14:22:13 +0000 (15:22 +0100)]
Simplify load() and lload()

Also make them more similar.  No functional change.

15 years agoMake load, unload, lload and lunload usable for deities
Markus Armbruster [Mon, 5 Jan 2009 09:12:57 +0000 (10:12 +0100)]
Make load, unload, lload and lunload usable for deities

Fix ownership tests in load(), lload(), load_plane_ship(),
load_land_ship(), load_plane_land(), load_land_land().

15 years agoCheck for unit on trading block last in load() and lload()
Markus Armbruster [Mon, 5 Jan 2009 09:07:09 +0000 (10:07 +0100)]
Check for unit on trading block last in load() and lload()

This is to make them more similar, and to get the market code out of
the way.

15 years agoFactor move_amount() out of load_comm_ship() and load_comm_land()
Markus Armbruster [Sun, 4 Jan 2009 18:00:31 +0000 (19:00 +0100)]
Factor move_amount() out of load_comm_ship() and load_comm_land()

15 years agoFix loopholes that let you load and unload foreign commodities
Markus Armbruster [Sun, 4 Jan 2009 11:00:45 +0000 (12:00 +0100)]
Fix loopholes that let you load and unload foreign commodities

The Chainsaw 3 feature to let you load/unload to a specific amount
through a negative amount argument created loopholes: it let you load
your ships in friendly sectors with the unload command, and unload
friendly ships with the load command.  Likewise for land units, with
allied instead of friendly, of course.

Empire 4.0.0 fixed that for the case of loading a land unit from an
allied sector.  Get rid of that check, and fix it for good in
load_comm_ok().

15 years agoFix load, unload, lload, lunload not to give away civilians
Markus Armbruster [Sun, 4 Jan 2009 10:59:10 +0000 (11:59 +0100)]
Fix load, unload, lload, lunload not to give away civilians

The game generally doesn't let you give away civilians.  But the check
in load_comm_ok() for that compared the sector old owner to the player
instead of the ship's or land unit's owner, which is incorrect for
foreign ships or land units.  Fix that.

Also make fix the message there not to assume that the civilians are
owned by the player.  This can't currently happen, but will when these
commands support use by deities properly.

15 years agoFactor load_comm_ok() out of load_comm_ship() and load_comm_land()
Markus Armbruster [Sun, 4 Jan 2009 10:57:26 +0000 (11:57 +0100)]
Factor load_comm_ok() out of load_comm_ship() and load_comm_land()

Functional change: attempting to load or unload foreign civilians no
longer fails command.

15 years agoMake lload require own sector and lunload own land unit
Markus Armbruster [Mon, 5 Jan 2009 14:02:21 +0000 (15:02 +0100)]
Make lload require own sector and lunload own land unit

This is for consistency with load and unload.

Before, you could use lunload for allied land units and lload in
allied sectors, but the command failed when stuff was loaded in allied
sectors.  Doing that with lload no longer fails the command, because
the check that does that in load_comm_land() is now masked by the new
checks in lload().  Note that loading with lunload still fails the
command; that inconsistency will be removed in a later commit.

load_plane_land() already refused to load planes from foreign sectors.
This commit makes that check redundant, so remove it.  Functional
change: lload now refuses to load foreign planes silently, unless both
land unit and plane were named by number.  This is consistent with
load.

15 years agoMake lload and lunload work on foreign lands only when named
Markus Armbruster [Mon, 5 Jan 2009 12:50:20 +0000 (13:50 +0100)]
Make lload and lunload work on foreign lands only when named

load and unload work on foreign ships only when their argument
explicitely names them, i.e. you have to ask for them by number.  When
any other syntax is used, load() ignores foreign ships.  This makes
sense.  Change lload() to work just like that.

15 years agoFix relation checks in load, unload, lload, lunload
Markus Armbruster [Sun, 4 Jan 2009 09:49:17 +0000 (10:49 +0100)]
Fix relation checks in load, unload, lload, lunload

The check for ship owner's relations to the player was backward: it
checked the player's relations to the ship's owner instead.  Abusable:
you could load and unload any ship by declaring friendly to its owner.
Broken since Chainsaw let you load and unload friendly ships.

The check for land unit owner's relations to the player was similarly
backward, similarly abusable, and also broken since day one.

lload and lunload checked sector owner's relations to the land unit's
owner instead of to the player.  Harmless, because the two must be the
same to reach the check.

15 years agoDon't warn deities about capital redesignation
Markus Armbruster [Fri, 2 Jan 2009 08:09:09 +0000 (09:09 +0100)]
Don't warn deities about capital redesignation

15 years agoChange info not to prepend a header line to the info page
Markus Armbruster [Sun, 28 Dec 2008 18:54:16 +0000 (19:54 +0100)]
Change info not to prepend a header line to the info page

The contents of the line was partly useless (repetition of the command
argument) and partly misleading (modification time of the formatted
info file, ifndef _WIN32).

15 years agoFix line break accident
Markus Armbruster [Sun, 28 Dec 2008 16:59:26 +0000 (17:59 +0100)]
Fix line break accident

15 years agoMake the "You lost your capital" message point to info capital
Markus Armbruster [Sun, 28 Dec 2008 16:49:21 +0000 (17:49 +0100)]
Make the "You lost your capital" message point to info capital

New players appear to be unable to figure out how to set a new
capital, in particular a mountain capital.  Hope this helps.

15 years agoMake sure land units with maximum mobility can attack mountains
Markus Armbruster [Sun, 28 Dec 2008 16:28:28 +0000 (17:28 +0100)]
Make sure land units with maximum mobility can attack mountains

Before, land units could not attack a high-mobility terrain sector at
all when the mobility cost to enter it exceeded maximum mobilty.

15 years agoFix land unit attack mobility cost
Markus Armbruster [Sun, 28 Dec 2008 13:01:15 +0000 (14:01 +0100)]
Fix land unit attack mobility cost

Land units were erroneously charged the much lower raw path cost,
except when attacking high-mobility terrain (mountains).  Broken in
commit 2673a258, v4.3.6.

15 years agoFold nstr_resolve_sel() into only remaining caller
Markus Armbruster [Sun, 28 Dec 2008 17:26:42 +0000 (18:26 +0100)]
Fold nstr_resolve_sel() into only remaining caller

No functional change.

15 years agoSmarter identifier resolution in conditions involving strings
Markus Armbruster [Sat, 27 Dec 2008 14:29:54 +0000 (15:29 +0100)]
Smarter identifier resolution in conditions involving strings

Conditions comparing strings behaved rather erratically: while wing=m
was smartly interpreted as wing='m' (because m is ambiguous as plane
selector), wing=e was not so smartly interpreted as wing=effic
(because e unambiguously identifies effic; this was then rejected due
to incompatible types), and wing=g was even less smartly interpreted
as wing=group.

Address this by a redesign of the identifier resolution rules in
nstr_comp(): If the condition contains just one identifier, it names a
selector.  If it contains two, try to intepret either as selector or,
if the other can be interpreted as selector, as value for that.
String selectors accept any identifier as value, numeric selectors
only the ones listed in their table.

Interpret both identifiers as selectors only if their types are
compatible (makes rpath=gu work for ships) and their tables, if any,
match (makes type=spy work for land units).

If more than one interpretation makes sense, drop any value
interpretations of identifiers that are unabbreviated selector names,
and selector interpretations of those that are not (makes wing=w work
for planes).

Change nstr_match_val() to accept any identifier as value for a string
selector.  Replace nstr_mkselval() by nstr_resolve_val(), to resolve
string values in addition to symbolic ones.  Remove resolution to
string from nstr_resolve_id(), drop its last parameter.  Remove unused
nstr_string_ok().  New nstr_is_name_of_ca(), nstr_ca_comparable().

Examples for conditions that are now interpreted differently:

    condition    old interpretation  new interpretation
    wing=g       wing=group          wing='g'
    w=g          wing=group          rejected as ambiguous (1)
    w=e          wing=effic (2)      wing='e'

(1) because both wing='g' and 'w'=group make sense
(2) rejected as incomparable later on

15 years agoSimplify type coercion in condition evaluation
Markus Armbruster [Sat, 27 Dec 2008 15:59:53 +0000 (16:59 +0100)]
Simplify type coercion in condition evaluation

Change nstr_mkselval() to generate values with promoted types only,
and replace nstr_coerce_val() by new and simpler nstr_optype() in
nstr_comp().

Replace the only remaining use of nstr_coerce_val() in surv() by
nstr_promote(), and remove nstr_coerce_val().

This loses one half of the unimplemented sketch of coercions to
NSC_STRING.  Drop the other half from nstr_exec_val().

15 years agoFix reporting of shot spies in news
Markus Armbruster [Thu, 25 Dec 2008 12:55:33 +0000 (13:55 +0100)]
Fix reporting of shot spies in news

Broken in commit 89e33f62, v4.3.16.

15 years agoLand units with zero reaction radius can't go on reserve mission
Markus Armbruster [Sun, 14 Dec 2008 21:49:18 +0000 (16:49 -0500)]
Land units with zero reaction radius can't go on reserve mission

15 years agoRemove econfig key mission_mob_cost
Markus Armbruster [Sun, 14 Dec 2008 21:04:47 +0000 (16:04 -0500)]
Remove econfig key mission_mob_cost

Questionable feature, and hasn't been used in a long time.

15 years agoRemove oprange()'s mission parameter
Markus Armbruster [Sun, 14 Dec 2008 19:05:40 +0000 (14:05 -0500)]
Remove oprange()'s mission parameter

Use the current mission instead.  Make mission() set it before calling
oprange(), and clean up somewhat.

15 years agoCheck capabilities required for mission before range
Markus Armbruster [Sun, 14 Dec 2008 18:40:32 +0000 (13:40 -0500)]
Check capabilities required for mission before range

Checking range first could complain about range when the mission
couldn't work regardless of range.  Not helpful.

15 years agoDrop checks whether we can get the op-sector from mission()
Markus Armbruster [Sun, 14 Dec 2008 18:20:49 +0000 (13:20 -0500)]
Drop checks whether we can get the op-sector from mission()

getsect() can fail here only when the coordinates are invalid.  The
first check uses coordinates from a successful sarg_xy(), so they
can't be invalid.  The second check uses coordinates of an object to
be put on the mission.  If these are invalid, game state is corrupt,
and failing the mission command doesn't improve the situation a bit.

15 years agoSimplify mission() by separating off clear_mission()
Markus Armbruster [Sat, 22 Nov 2008 20:15:03 +0000 (15:15 -0500)]
Simplify mission() by separating off clear_mission()

15 years agoStreamline signature of show_mission()
Markus Armbruster [Sat, 22 Nov 2008 20:04:15 +0000 (15:04 -0500)]
Streamline signature of show_mission()

Remove unused parameter, and return status.

15 years agoMove show_mission() to sole caller, give it internal linkage
Markus Armbruster [Sat, 22 Nov 2008 20:02:18 +0000 (15:02 -0500)]
Move show_mission() to sole caller, give it internal linkage

15 years agoAll missions now have op areas, simplify mission()
Markus Armbruster [Sat, 22 Nov 2008 20:19:27 +0000 (15:19 -0500)]
All missions now have op areas, simplify mission()

15 years agoMake escort mission obey op-area
Markus Armbruster [Sat, 22 Nov 2008 19:52:20 +0000 (14:52 -0500)]
Make escort mission obey op-area

Before, the escort mission didn't support an op-area, and planes on
escort mission escorted anywhere.  Change mission() to define the
op-area for escort missions as well.  Show it in mission() and
show_mission().  Check it in find_escorts().

15 years agoRemove non-mission land unit reaction
Markus Armbruster [Tue, 25 Nov 2008 01:31:22 +0000 (20:31 -0500)]
Remove non-mission land unit reaction

Land unit reactions are overly complex because we have two different
concepts controlling them: reaction radius (set with lrange) and
reserve mission (set with mission).  You need to deal with both to set
up or query reactions.

Commit 8d0e1af5 "fixed" this by making reserve missions meaningless.

The previous commit made reserve missions meaningful again: they
support an op-area now.  This brought back the problem of having to
deal with two separate commands to accomplish one thing.

Fix this for good by removing non-mission land unit reaction
alltogether.  The only feature we lose by that is the ability to order
land units to react until the order is explicitely cancelled.  That's
because missions are implicitely cleared by many commands and events,
while non-mission reaction wasn't.  Closes #858121 and #858122.

Remove the non-mission reaction case from att_reacting_units().

Don't limit reserve missions to the land unit's reaction radius: make
lnd_reaction_range() return the type's maximum radius instead of
lnd_rad_max.

The reaction radius is now useless.  Remove the lrange command, and
struct lndstr member lnd_rad_max along with its selector react.
Remove land command's column rd.  Make ldump show column react as
zero.  Deprecate edit key 'P' in dounit(), and don't show it in
pr_land().

15 years agoMake land units on reserve mission react within op-area
Markus Armbruster [Sat, 22 Nov 2008 19:40:37 +0000 (14:40 -0500)]
Make land units on reserve mission react within op-area

Before, they always reacted to their maximum range, and the op-area
was unused.  Change mission() to define the op-area for reserve
missions as well.  Remove the special-case for showing reserve
missions from mission() and show_mission().  New lnd_reaction_range()
factored out of att_reacting_units().  Use it in oprange() to cover
reserve missions.  Pass the mission as separate parameter to oprange()
for now, because miss() doesn't set it in the object until later.

15 years agoNew in_oparea(), factored out of build_mission_list_type()
Markus Armbruster [Sat, 22 Nov 2008 17:06:54 +0000 (12:06 -0500)]
New in_oparea(), factored out of build_mission_list_type()

15 years agoDon't reduce mission op area when range shrinks
Markus Armbruster [Fri, 21 Nov 2008 13:05:24 +0000 (08:05 -0500)]
Don't reduce mission op area when range shrinks

The mission command limits op area radius to the possible range.
That's okay, as it doesn't actually restrict possible op areas.  When
the mission is executed, it was limited again.  Don't do that; remove
the limiting code from build_mission_list_type() and show_mission().

The removed limiting had no effect, except when the range shrunk.
Then limiting reduced the op area more than necessary.  For instance,
consider an object O with initial range 3 on a mission around M with
range 3:

    - - - y - - -
     - - z y - -
    - - z x y - -
     - O x x M -
    - - z x y - -
     - - z y - -
    - - - y - - -

Initially, all sectors not marked - are in range and in the op area.
If the range drops to two, sectors marked O, x and z are still in
range of O.  But only the x are still in range of M.  The O and z got
excluded.

Range can currently shrink when plane range is reduced (range
command), or a ship, plane or land unit somehow loses tech (deity
intervention).

15 years agoRemove reserve mission's reaction radius bonus
Markus Armbruster [Mon, 17 Nov 2008 00:57:45 +0000 (19:57 -0500)]
Remove reserve mission's reaction radius bonus

Reserve missions are now useless.  They'll become useful again in a
later commit.

15 years agoUse #if 0 to disable code, not comments
Markus Armbruster [Mon, 17 Nov 2008 02:19:37 +0000 (21:19 -0500)]
Use #if 0 to disable code, not comments

15 years agoClean up removal of reserve mission mobility bonus
Markus Armbruster [Mon, 17 Nov 2008 02:18:17 +0000 (21:18 -0500)]
Clean up removal of reserve mission mobility bonus

Land units on reserve missions used to pay only half the usual
mobility for combat.  This bonus was commented out in the code in
4.0.0, but not in info.  Remove it from both.

15 years agoRemove commented out logerror() calls
Markus Armbruster [Mon, 17 Nov 2008 02:13:36 +0000 (21:13 -0500)]
Remove commented out logerror() calls

Probably ancient debug cruft.

15 years agoBump version to 4.3.20
Markus Armbruster [Sun, 14 Dec 2008 15:44:02 +0000 (10:44 -0500)]
Bump version to 4.3.20

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().