Commit graph

1339 commits

Author SHA1 Message Date
75a511a749 (main, intr) [!_WIN32]: signal() is a portability headache. Switch to
sigaction().
2005-12-28 16:59:20 +00:00
1ec32d97c4 Fix the previous revision. 2005-12-28 16:38:19 +00:00
87ace6afe4 (handleintr): Move to main.c. Internal linkage. Remove empty
handle.c
(interrupt): Internal linkage.

(interrupt): Use proper type for access from signal handler.
(intr): Don't increment to set, it's unobvious and it could overflow.
2005-12-28 16:16:41 +00:00
69150d10fc (EMPTH_LWP, EMPTH_POSIX, EMPTH_W32): Define in config.h instead of
compiler command line.  Don't bother to conditionalize code in .c
files that are only compiled when their thread package is used.

(_EMPTH_LWP, EMPTH_LWP, _EMPTH_POSIX, EMPTH_POSIX, _EMPTH_WIN32)
(EMPTH_W32): Identifiers beginning with an underscore and an uppercase
letter are reserved for any use.  Rename.
2005-12-28 14:27:15 +00:00
083f0ea350 (lwpInitSelect): The code to query the system's limit on file
descriptors was not portable.  Simply use FD_SETSIZE instead.  The
lower of the two applies, so this wastes storage if the system's limit
is significantly below FD_SETSIZE.  Not an issue, as FD_SETSIZE is
fairly small.
(lwpSleepFd): Return if fd is too large.  Returning isn't nice,
but better than the buffer overruns in the old code.
(lwpSelect): Member nfile unused, remove.
2005-12-27 19:22:07 +00:00
3aebb68ee7 Include config.h. 2005-12-27 18:04:19 +00:00
ea820f3b99 Fix missing include. 2005-12-27 17:56:57 +00:00
Ron Koenderink
233181c50d (player_new, player_accept, update_wait, market_update) [_WIN32]:
Move assignment of hostaddr and hostname from player_new() to
player_accept().  This solves the necessary of adding the socket include
file to prototypes.h for player_new().  The socket include file creates
a namespace conflict for WIN32.
2005-12-26 03:53:21 +00:00
ae24898e50 (opt_ALL_BLEED, opt_BIG_CITY, opt_BLITZ, opt_BRIDGETOWERS)
(opt_DEFENSE_INFRA, opt_DEMANDUPDATE, opt_DRNUKE, opt_EASY_BRIDGES)
(opt_FALLOUT, opt_FUEL, opt_GODNEWS, opt_GO_RENEW, opt_GUINEA_PIGS)
(opt_HIDDEN, opt_INTERDICT_ATT, opt_LANDSPIES, opt_LOANS)
(opt_LOSE_CONTACT, opt_MARKET, opt_MOB_ACCESS, opt_NOFOOD)
(opt_NOMOBCOST, opt_NO_FORT_FIRE, opt_NO_PLAGUE, opt_PINPOINTMISSILE)
(opt_RES_POP, opt_SAIL, opt_SHOWPLANE, opt_SLOW_WAR, opt_SUPER_BARS)
(opt_TECH_POP, opt_TRADESHIPS, opt_TREATIES, opt_UPDATESCHED):
Remove conditional initialization.  Values unchanged.
(ALL_BLEED, BIG_CITY, BLITZ, BRIDGETOWERS, DEFENSE_INFRA)
(DEMANDUPDATE, DRNUKE, EASY_BRIDGES, FALLOUT, FUEL, GODNEWS, GO_RENEW)
(GUINEA_PIGS, HIDDEN, INTERDICT_ATT, LANDSPIES, LOANS, LOSE_CONTACT)
(MARKET, MOB_ACCESS, NOFOOD, NOMOBCOST, NO_FORT_FIRE, NO_PLAGUE)
(PINPOINTMISSILE, RES_POP, SAIL, SHOWPLANE, SLOW_WAR, SUPER_BARS)
(TECH_POP, TRADESHIPS, TREATIES, UPDATESCHED): Unused, remove.
2005-12-25 14:53:29 +00:00
ade510f787 Turn options into ordinary econfig keys:
(configkeys): Add options.
(KM_OPTION): New.
(vers): Find options in configkeys[] instead of Options[].
(xdump): Remove xdump opt syntax.
(xdopt): Remove.
(emp_config, print_config): Remove option special case.
(option_list, Options, setoption): Remove.
2005-12-25 10:32:50 +00:00
Ron Koenderink
8b934d615b (hStdIn) [_WIN32]: Add extern to declaration. 2005-12-25 00:51:55 +00:00
cc0c3e4f3f (drop): A mining mission targeting land called pln_dropoff() instead
of pln_mine().  pln_dropoff() happens to do pretty much the right
thing, but...
(pln_mine): Refuse to mine land.
2005-12-23 19:37:52 +00:00
3bbc91876f (START_CASH, start_cash): Replace START_CASH by new econfig key
start_cash.
2005-12-23 11:16:23 +00:00
8e16ae9e43 Remove superflous #include "options.h". 2005-12-23 11:04:56 +00:00
Ron Koenderink
9b3e820d3a (nat_cap, status): Use the new function influx() to determine
if a valid capital is present or not.
2005-12-23 01:10:07 +00:00
ea93842927 (pln_equip): New mission argument 'm' for mining. 'd' is now for
cargo drops only.  Callers changed.
2005-12-22 19:48:33 +00:00
8e12bb8574 Previous rev. assumes would_abandon() returns 0 or 1. Correct, but
unmodular.  Don't.
2005-12-22 19:27:26 +00:00
91be114d9b Avoid compiler warnings in rev. 1.23 code. 2005-12-22 17:57:16 +00:00
Ron Koenderink
233fce87cd (nat_cap): Scale BTU production by capital's work.
Closes #101189.
2005-12-22 17:26:54 +00:00
Ron Koenderink
b0fa9a8ee2 (nat_cap): Remove redundant max_btus checks.
Remove deities and opt_BLITZ calculations
as dispatch() will not let you run out of BTU's.
2005-12-20 22:50:06 +00:00
a98626df2d Replace the build process. The new one requires GNU Make, Autoconf
and Autoconf macros that come with Automake.  It supports multiple
separate builds of the same source tree, and updates dependencies
automatically.  Targets info, html, install, install-html, uninstall
and dist are not yet implemented.

System configuration is now automatic.  Previously, you had to choose
one of several canned system configurations, defined in Make.sysdefs.
Currently, system configuration always uses UCONTEXT for LWP, and
chooses LWP only if its requirements are met.

Feature configuration changed: instead of editing build.conf (further
processed by doconfig), you pass arguments to configure.  Note that
build.conf settings that can be overridden in econfig have no
configure equivalent; just edit econfig instead.

Because generated headers complicate makefiles, fold gamesdef.h into
its users: path.c and ipglob.c become path.c.in and ipglob.c.in,
constants.c, vers.c, options.h simply hardcode defaults (most of them
are run-time configurable).

Call the client empire instead of emp_client.  This matches what the
old standalone build did.
2005-12-20 20:25:35 +00:00
Ron Koenderink
cdfb94dc1f (nati, player_coms): Add ability for deities to request a nation report for any country.
Closes #1083167.
2005-12-20 17:06:47 +00:00
Ron Koenderink
16d0f5d133 (natstate): Add STAT_SANCT case so the nation report properly
shows SANCTUARY instead of VISITOR for countries in sanctuary.
2005-12-20 01:49:55 +00:00
Ron Koenderink
f3303bce1e (capi): Do not check capital location if the country
is has NF_SACKED set.
2005-12-19 01:52:13 +00:00
Ron Koenderink
e3459cba5d (caploss): Remove the moving of a sacked capital.
This corrects the incorrect display of the old capital in the nation output.

(caploss): Remove unnecessary include files.
2005-12-18 19:54:44 +00:00
Ron Koenderink
7944db242c (nati): Fix the grammer for No capital output. 2005-12-18 15:43:56 +00:00
Ron Koenderink
9217e75761 (shp_nav_one_sector, mchr[], ship_chr_flags[], Ship-types, Sector-types):
Add M_CANAL flag to indicate which ships can navigate a canal
in a big city.  Remove the hard code values for canal from
shp_nav_one_sector() for which ships can navigate a canal.
Set M_CANAL flag in ship_chr_flags[] to match the hard
coding in shp_nav_one_sector().
Update Ship-types.t with new canal flag.
Update Sector-types.t to indicate that cities have canals.
2005-12-18 15:16:52 +00:00
Ron Koenderink
6157409f20 (influx): Remove carriage return. 2005-12-18 03:53:52 +00:00
Ron Koenderink
c2ee177256 (zdon): Do not allow a country that is in-flux to request an update.
Closes #1025597.
2005-12-17 20:27:08 +00:00
Ron Koenderink
5ffef496ea (coun_list, repo_list, nati): Replace in-flux determination code with influx().
(influx): New.
2005-12-17 20:18:54 +00:00
Ron Koenderink
d1e2d91961 (repo_list): Remove unreachable state (STAT_NORM | STAT_SANCT). 2005-12-17 19:55:52 +00:00
3dc35a77f7 (xundump): Eat whitespace after table, so that caller can check for
trailing junk more easily.  This fixes that check in ef_load().
2005-12-17 15:09:43 +00:00
Ron Koenderink
4799984997 (gen_power): Do not include land units with spy capability in the
land unit count. Closes #910398.
2005-12-17 12:41:39 +00:00
965bf6dbe4 (xundump): Fix table row counting, broken by rev. 1.23. 2005-12-17 08:25:57 +00:00
fdea1beb34 (lwpNewContext): Fix the previous revision. 2005-12-12 07:34:52 +00:00
d343fee727 Remove superflous include. 2005-12-11 10:09:09 +00:00
72f4cef34f (lwpNewContext) [MAKECONTEXT_SP_HIGH]: Work around makecontext()
lossage.
(IRIX5CFLAGS, SOLCFLAGS): Define MAKECONTEXT_SP_HIGH.  This is wrong
for Solaris 10.
2005-12-11 08:18:15 +00:00
588329ab35 (lwpCreate): Check for lwpNewContext() success. 2005-12-10 20:42:42 +00:00
e841fc0826 (lwpNewContext) [UCONTEXT]: Fix the previous revision. 2005-12-10 20:41:44 +00:00
9e3db08fda Redesign interface to machine-dependent code to cleanse lwp.c of
machine-dependencies:
(lwpNewContext): New, factored out of lwpCreate().
(lwpSwitchContext): New, factored out of lwpReschedule().
(LWP_EXTRASTACK, STKALIGN, lwpInitContext, lwpSave, lwpRestore): Move
to arch.c.  Remove for UCONTEXT, else static linkage unless macro or
AIX32.

(lwpReschedule): Skip lwpStatus() when not actually switching.

(LwpStackGrowsDown): New.
(lwpInitSystem): Initialize it.
(lwpStackCheck, lwpStackCheckUsed): Use it.
2005-12-10 19:28:24 +00:00
2218a7a9a1 (lwpProc): Members lowmark and himark are confusing, replace by
ustack, usize.
(lwpCreate): Initialize them.
(lwpStackCheckInit, lwpStackCheck, lwpStackCheckUsed): Rewrite using
them.  lwpStackCheckUsed() was off by LWP_REDZONE when stack grows
down.

(lwpDestroy): Don't bother to clear memory to be freed.
2005-12-10 17:26:22 +00:00
bd7b1f480a Clean up the move of lwpProc (lwpint.h rev. 1.11, lwp.h rev. 1.8). 2005-12-10 16:55:38 +00:00
ef79cd67ef (lwpInitContext) [UCONTEXT]: Failed to initialized uc_stack.ss_flags. 2005-12-10 15:03:11 +00:00
bb33660672 Clean up the move of lwpProc (lwpint.h rev. 1.11, lwp.h rev. 1.8). 2005-12-10 15:00:35 +00:00
a540be8fe3 (empth_start, empth_init, empth_alarm) [_EMPTH_POSIX]: We do raise
SIGALRM!  Revert rev. 1.21.

(empth_alarm): Internal linkage.
2005-12-09 20:52:30 +00:00
16fe285ec7 (lwpCreate) [UCONTEXT]: ss_sp is the (base) address of the stack area,
not the initial stack pointer.  Fix.  ss_size was wrong as well.
Amazing that this ever worked.
2005-12-07 20:39:55 +00:00
bc270377d5 [UCONTEXT] (lwpInitContext): Failed to initialize context.uc_link as
required by the API.
2005-12-07 20:32:25 +00:00
28e116dac4 (lwpCreate): Check STKALIGN is sane.
(lwpCreate): Used to allocate one byte more than necessary.  The fix
won't save memory (malloc() will add the byte back), it's just clearer
this way.

(lwpCreate): Clean up computation of sp.  Rename parameter size to
stacksz.

(lwpCreate): Always compute newp->lowmark and newp->highmark from sp,
not from s.  Old code misaligned newp->himark for stacks growing
upward when stack size argument wasn't aligned.
2005-12-07 20:28:12 +00:00
3bc2c1ae08 (stkalign_t, STKALIGN): Replace. 2005-12-07 19:47:26 +00:00
aab54fcd54 (lwpProc, lwpSem): Declare as incomplete type in include/lwp.h. Move
complete declaration to src/lib/lwp/lwpint.h.
(lwpQueue): Move to src/lib/lwp/lwpint.h.
(empth_main, empth_flags): New.
(empth_init): Initialize them.
(empth_create, empth_exit): Use them instead of lwpProc members.
2005-12-07 19:15:37 +00:00