Commit graph

2043 commits

Author SHA1 Message Date
3a4e362de5 (FLAK_GUN_MAX): New.
(ac_doflak, ac_shipflak, ac_landflak): Use it.
(ac_shipflak, ac_landflak): Tally flak for all ships / units, then
limit to FLAK_GUN_MAX guns of average tech.  Used to limit to
FLAK_GUN_MAX guns *after* ship / land unit tech factor was applied by
exiting the loop early, then reduce *again* for nation tech of whoever
owns the last ship visited.  Makes no sense.  Exiting the loop early
is no good, because it can skip plane spotting.  This change and the
one below make low-tech ship and land unit flak more powerful;
rebalancing might be needed.

(ac_doflak, ac_landflak, ac_shipflak): Round flak randomly instead of
down.  This simplifies things.  In particular, you no longer have to
calculate how many low-tech ships to bunch together to get any flak.
2006-06-10 18:26:57 +00:00
17759f1071 (ac_fireflak): Remove parameter other, all callers pass 0. Callers
changed.
2006-06-10 17:53:24 +00:00
82bbb318dc (calc_all): Match the real update sequence. Until removal of budget
priorities (rev. 1.25), calc_all() tried to match the real sequence,
but didn't quire succeed to cope with all variations.  Then it matched
until the update sequence change in src/lib/update/main.c rev. 1.25.
This is required but not sufficient for closing #1310407.
2006-06-10 16:20:31 +00:00
Ron Koenderink
4a5700e572 (service_main) [_WIN32]: Added the missing empth_wait_for_signal() and
shutdown() for when the server is running at WIN32 service.  This fix
incorporates the changes that where done to the main thread.
2006-06-10 04:11:16 +00:00
Ron Koenderink
0c53200e8e (empth_wait_for_signal) [_WIN32]: Add thread block for the main thread,
otherwise the main thread blocks all others.
2006-06-10 03:57:50 +00:00
Ron Koenderink
0864c1fdb3 (update_main): Remove unused local variables. 2006-06-09 00:43:33 +00:00
Ron Koenderink
39b885e10e (journal_entry): Remove unused local variable. 2006-06-09 00:41:51 +00:00
Ron Koenderink
a21b4a0e72 (mtsymset, add2symset): Remove unused local variables. 2006-06-09 00:26:59 +00:00
Ron Koenderink
5b84e8087b (starv_units): Remove unused local variable. 2006-06-09 00:25:39 +00:00
Ron Koenderink
ca246d0bf9 (getpath): Remove unused local variables. 2006-06-09 00:24:06 +00:00
Ron Koenderink
961273b6a2 (feed_land): Remove unused local variables. 2006-06-09 00:17:44 +00:00
Ron Koenderink
f67f90b2cb (budg,calc_all): Remove unused local variables. 2006-06-09 00:16:48 +00:00
0c6d9e108c (cant_listen): Supply missing newline. 2006-06-08 20:55:17 +00:00
55ff194f7f (lnd_pathcost): New, factored out of lnd_mobcost().
(att_reacting_units): Use it.  Fixes overcharging of inefficient
units.  Broken when Empire3 changed land unit mobility use not to
depend on efficiency, except for supply units.
(lnd_sweep): Use it.  No functional change.

(speed_factor): New, factored out of lnd_pathcost() and shp_mobcost().
2006-06-08 20:43:13 +00:00
5e66e5bdee (ef_verify): Check pchr[].p_level matches pchr[].p_type. 2006-06-08 20:22:58 +00:00
7d75e2b8d3 (teldir, motdfil, downfil, disablefil, telfil, annfil, timestampfil):
Change to arrays.
2006-06-08 20:22:11 +00:00
7f301bb7f1 (shutdwn) [_WIN32]: Not supposed to return, so don't. 2006-06-08 20:20:02 +00:00
1ca0b5cb2b Finally merge the journal patch:
(keep_journal): New econfig key.
(player_main): Log player login and logout.
(recvclient): Log player input.
(ef_open_srv, ef_close_srv): Log startup and shutdown.
(update_main): Log update.

Support the common SIGHUP log rotation idiom:
(empth_wait_for_shutdown, empth_wait_for_signal): Rename.
[EMPTH_LWP, EMPTH_POSIX] (empth_init, empth_wait_for_signal): Wait for
SIGHUP as well.
(main) [SIGHUP]: Reopen journal when empth_wait_for_signal() returns
SIGHUP.
2006-06-08 20:11:26 +00:00
ff2a162587 (LwpContextPtr, lwpInitSystem): Use void ** for pointer to generic
pointer.  Users changed.
2006-06-08 05:38:06 +00:00
5c7e97c522 (shutdwn): No longer a signal handler, no need to avoid sleeping.
This lets player threads send C_EXIT properly even when the server
shuts down on a signal.
2006-06-07 21:45:46 +00:00
8562a40136 Fix the previous revision. 2006-06-07 21:39:01 +00:00
7183516d91 (empth_init_signals): Don't catch SIGINT and SIGTERM.
(empth_wait_for_shutdown): New.
(main): Use it to wait for shutdown signal, then shut down.  Closes
#770492.
(empth_exit): Remove the weird special case for main thread.

Implement empth_wait_for_shutdown() for EMPTH_LWP:
[EMPTH_LWP] (lwpInitSigWait, lwpSigWait, lwpSigWakeup): New.
Declaration of lwpSigWait was accidentally committed in the previous
revision of lwp.h.
[EMPTH_LWP] (lwpInitSystem): New parameter waitset, pass it on to
lwpInitSigWait().
[EMPTH_LWP] (lwpReschedule): Call lwpSigWakeup().
[EMPTH_LWP] (empth_init): Declare signals needed by
empth_wait_for_shutdown().
(empth_wait_for_shutdown): Implement on top of lwpSigWait().

Implement empth_wait_for_shutdown() for EMPTH_POSIX:
[EMPTH_POSIX] (empth_init): Block signals, so that
empth_wait_for_shutdown() can use sigwait() safely.
(empth_wait_for_shutdown): Implement on top of sigwait().

Implement empth_wait_for_shutdown() for EMPTH_W32:
(empth_wait_for_shutdown): Implement on top of loc_BlockMainThread().
2006-06-07 21:01:16 +00:00
f51769659c (lwpDestroy): Internal linkage.
(lwpSelect, lwpStatus): Declare in lwpint.h instead of lwp.h.
2006-06-07 06:01:29 +00:00
0f2e12d3aa (lwpEntryPoint): Don't set *LwpContextPtr, that's just been done by
lwpReschedule().
2006-06-06 21:01:28 +00:00
24b56b9365 (lwpReschedule): Remove code permitting SIGALRM to be catched safely,
because there's no handler for it.
(LCOUNT, oldmask): Remove.
(lwpEntryPoint): Don't initialize oldmask.  Should have been done in
lwpInitSystem() anyway.
2006-06-06 20:57:03 +00:00
5df2ae0da7 Reorder table entries for clarity. Document. 2006-06-06 19:27:11 +00:00
d0ecb9b7ee (P_MAX): New.
(pchr): Use it rather than P_URAN.
(P_SHELL, P_GUN, P_PETROL, P_IRON, P_DUST, P_BAR, P_FOOD, P_OIL)
(P_LCM, P_HCM, P_TLEV, P_RLEV, P_ELEV, P_HLEV, P_URAN): Unused,
remove.
2006-06-06 17:57:30 +00:00
bd7b0fea5d (grin): Grind up whatever banks produce instead of P_BAR. This is in
preparation of getting rid of P_BAR & friends.

(grin): Avail use was wrong when amount was reduced due to the space
limit.
2006-06-06 17:53:59 +00:00
f284b0beab (P_SHELL, P_GUN, P_PETROL, P_IRON, P_DUST, P_BAR, P_FOOD, P_OIL)
(P_LCM, P_HCM, P_TLEV, P_RLEV, P_ELEV, P_HLEV, P_URAN): Use -1 instead
of 0 for `no product', shift down product indexes and update
product.config and sector.config accordingly.
(budg, prod, show_sect_capab, produce, produce_sect): Adapt test for
no product.
(ef_elt_byname): Remove the hack to hide pchr[0].
(prod_eff): Oops on no product.
2006-06-05 17:44:25 +00:00
08937006d7 (prprod): New, factored out of prod().
(prod): Separate enlistment code from production code.  Simplifies
control flow, and thus gets rid of several compiler warnings.
2006-06-05 15:29:28 +00:00
32e4fbd284 Move signal stuff into src/lib/empthread/, no functional change:
(empth_init_signals): New, factored out of start_server().  Call from
empth_init().
(panic): Move to posix.c, internal linkage.
(empth_obj): Add new posix.o

(empth_start, empth_alarm) [EMPTH_POSIX]: Clean up pointless messing
with signal handlers.
(empth_init, empth_wakeup) [EMPTH_POSIX]: Clean up a bit.
2006-06-05 08:51:02 +00:00
1479673302 Missed a use of MOB_ROAD. 2006-06-05 07:05:43 +00:00
5ad86bc7ce 4.0.2 made land unit mobility costs differ significantly from normal
move costs, but failed to make A* use these costs.  This broke land
unit path finding.  Fix:
(MOB_ROAD, MOB_MOVE, MOB_MARCH): Split MOB_ROAD into MOB_MOVE and
MOB_MARCH.  Users changed.
(lnd_mobcost, sector_mcost): Move minimum mobcost logic to
sector_mcost(), where it is visible to A*.  Also fixes unit reaction
path cost.

(lnd_path): Fix confusing message: don't claim there's no path when
all we really know is that there's no railway.
2006-06-04 17:41:12 +00:00
6ab05ae8a1 Path finding for trains never worked; it ignored the need for rail:
(sector_mcost, bp_neighbors): Fix for MOB_RAIL and sct_rail == 0.
Closes #781528.
2006-06-04 17:27:17 +00:00
20c02295a6 (BestDistPath): All callers pass MOB_ROAD to parameter mob_type,
remove it.  Callers changed.
2006-06-04 16:49:24 +00:00
0ea38208d1 (P_WALKING): Unused, remove.
(getpath): Remove P_WALKING case.
2006-06-04 16:42:36 +00:00
44318648bf Explain why not to edit configs in-place. 2006-06-04 12:27:10 +00:00
3aea20e1de (ichr, pchr, dchr, intrchr): Move initializer to new builtin config
files item.config, product.config, sect.config, infra.config.
(empfile): Declare the new config files.  Reorder table entries so
that read_builtin_tables() reads the config files in the right order.

(bigcity_dchr, opt_BIG_CITY, init_dchr): Remove.  Deities can edit
sect.config instead.
2006-06-04 09:34:39 +00:00
a835a4b4d3 Fix the previous revision. 2006-06-04 09:01:51 +00:00
8fa0dcbe17 Don't check values for immutable fields match when initializing an
empty table:
(initialized): New.
(xundump): Set it.
(fldval_must_match): Ignore NSC_CONST when it's clear.
2006-06-04 08:37:37 +00:00
b7922c9bd8 Fix rev. 1.11. 2006-06-04 08:33:03 +00:00
33e9b773ad Fix the revision before previous. 2006-06-04 08:26:12 +00:00
0b1f561e97 Comments, whitespace. 2006-06-02 05:49:29 +00:00
f70445af2b Fix the previous revision. 2006-06-02 05:43:31 +00:00
da88d91899 (pchrstr, pchr_ca, pchr, sctstr, dchr_ca, dchr): Replace pchrstr
member p_effic by sctstr member d_peffic.  Tables updated.
(show_sect_capab): Adapted.
(prod_eff): Adapted; requires changing first parameter to sector type.
Callers changed.
(P_MDUST): Remove, because pchr[P_MDUST] now identical to
pchr[P_DUST].
2006-06-02 05:35:54 +00:00
568b9d6639 Allow symbolic references not just to symbol tables:
(xunsymbol1): Use ef_elt_byname().
(setsym): Accept any table reference, not just to symbol table.
(symval): New.
(setsym, add2symset): Use it.
(mtsymset): Last remaining user of getsymtab(); inline and simplify.
(getsymtab): Remove.

(xunsymbol1, xunsymbol): Rename.
2006-06-01 19:15:30 +00:00
a1546476bf (xunsymbol1): Fix diagnostics. 2006-06-01 19:06:56 +00:00
401e072824 Fix the previous revision. 2006-06-01 18:57:42 +00:00
6fadcf6e8e (buil): Use ef_elt_byname() instead of typematch().
(typematch): Unused, remove.
2006-06-01 18:57:03 +00:00
c432e3107d Symbolic names for table entries in conditionals, closes #928376:
(ef_elt_byname): New.
(nstr_match_val): Use it to generalize to arbitrary table with
uniquely named elements.  Use ca_type to find table, remove parameter
type.  Callers changed.
(nstr_mkselval): Adapt sanity check accordingly.
(NSC_TYPEID): No longer needed, remove, users changed to use
appropriate integer type instead.  This fixes signedness of sector
selectors des and newdes.
(meta_type): Remove entry for NSC_TYPEID.
(nstr_coerce_val): Can't detect typeid - integer mismatch anymore.
Was nice to have; perhaps revive it later.
2006-06-01 18:48:42 +00:00