]> git.pond.sub.org Git - empserver/log
empserver
17 years agoSimplify. Should also be more efficient.
Markus Armbruster [Wed, 31 Jan 2007 20:23:07 +0000 (20:23 +0000)]
Simplify.  Should also be more efficient.
(LwpSigCheck): New.
(lwpCatchAwaitedSig): Set it.
(lwpSigWait): Clear it.
(lwpSigWakeup): Test it.
(lwpSigWakeup): Unblock LwpSigWaiter without testing LwpSigCatched.
(lwpSigWait): Test LwpSigCatched after wakeup.
(LwpSigAwaited, LwpSigPtr): Remove.

17 years agoClean up after removal of wait command:
Markus Armbruster [Wed, 31 Jan 2007 06:08:39 +0000 (06:08 +0000)]
Clean up after removal of wait command:
(player_wakeup_all, player_wakeup): Remove.  Callers changed.
(player): Remove member waiting.

17 years agoRev. 1.16 included time.h to get time_t. Change to sys/types.h.
Markus Armbruster [Sun, 28 Jan 2007 17:22:43 +0000 (17:22 +0000)]
Rev. 1.16 included time.h to get time_t.  Change to sys/types.h.

17 years ago(lwp_rwlock_destroy): Plug memory leak.
Markus Armbruster [Sun, 28 Jan 2007 17:02:46 +0000 (17:02 +0000)]
(lwp_rwlock_destroy): Plug memory leak.

17 years ago(empth_exit, empth_rwlock_destroy): Plug memory leaks.
Markus Armbruster [Sun, 28 Jan 2007 16:59:15 +0000 (16:59 +0000)]
(empth_exit, empth_rwlock_destroy): Plug memory leaks.

17 years ago(lwpSetDesc): Unused, remove.
Markus Armbruster [Sun, 28 Jan 2007 16:40:27 +0000 (16:40 +0000)]
(lwpSetDesc): Unused, remove.

[EMPTH_LWP] (lwpProc): Remove member desc.
[EMPTH_LWP] (lwpCreate, lwpDestroy): Don't initialize / finalize it.

[EMPTH_POSIX] (empth_t): Remove member desc.
[EMPTH_POSIX] (empth_init, empth_create): Don't initialize it.

[EMPTH_W32] (loc_Thread): Remove member szDesc.
[EMPTH_W32] (empth_init, empth_create): Don't initialize it.

(empth_create, lwpCreate): Remove parameter desc.  Callers changed.

17 years ago(lwpCreate): Initialize members runtime and fd. Initializing fd is
Markus Armbruster [Sun, 28 Jan 2007 14:34:34 +0000 (14:34 +0000)]
(lwpCreate): Initialize members runtime and fd.  Initializing fd is
necessary to make lwpWakeupFd() work reliably.  Initializing runtime
isn't strictly necessary, as it is used only while the thread is on
LwpDelayq, and putting it there sets runtime.

17 years ago(lwpProc): Change type of member runtime to time_t.
Markus Armbruster [Sun, 28 Jan 2007 14:14:40 +0000 (14:14 +0000)]
(lwpProc): Change type of member runtime to time_t.
(lwpSleepUntil): Change type of parameter to time_t.

17 years ago(LWP_CHECKMARK): Change to int. Should have been done in rev. 1.14.
Markus Armbruster [Sun, 28 Jan 2007 10:17:35 +0000 (10:17 +0000)]
(LWP_CHECKMARK): Change to int.  Should have been done in rev. 1.14.

17 years ago(unit_path): Replace mpr() with pr() as unit_path() is only called
Ron Koenderink [Sat, 27 Jan 2007 02:31:08 +0000 (02:31 +0000)]
(unit_path): Replace mpr() with pr() as unit_path() is only called
from navigate or march command.

17 years ago(unit_view): Replace mpr() with pr() as unit_view() is only called
Ron Koenderink [Sat, 27 Jan 2007 02:20:30 +0000 (02:20 +0000)]
(unit_view): Replace mpr() with pr() as unit_view() is only called
from navigate or march command.

17 years ago(unit_view): New, create by expanding shp_view() to work for
Ron Koenderink [Sat, 27 Jan 2007 02:04:27 +0000 (02:04 +0000)]
(unit_view): New, create by expanding shp_view() to work for
land_unit as well.
(do_unit_move): Add view option for land units using unit_view().
Combine ship and land viewing using the unit_view().
(shp_view): Remove, not used any more, replaced by unit_view().

17 years ago(unit_path): New, create by combining shp_path() and lnd_path().
Ron Koenderink [Wed, 24 Jan 2007 23:24:37 +0000 (23:24 +0000)]
(unit_path): New, create by combining shp_path() and lnd_path().
(do_unit_move): Replace shp_path() and lnd_path() with unit_path().
(shp_path, lnd_path): Remove shp_path() and lnd_path(),
not used any more.

17 years ago(unit_put): New, create by combining shp_put() and lnd_put().
Ron Koenderink [Tue, 23 Jan 2007 23:51:02 +0000 (23:51 +0000)]
(unit_put): New, create by combining shp_put() and lnd_put().
(sail_nav_fleet, shp_nav_one_sector): Replace shp_put() with unit_put().
(lnd_mar_one_sector, att_fight, move_in_land): Replace lnd_put() with unit_put().
(shp_put, lnd_put): Remove.

17 years ago(unit_list): New, create by combining shp_list() and lnd_list().
Ron Koenderink [Tue, 23 Jan 2007 01:41:37 +0000 (01:41 +0000)]
(unit_list): New, create by combining shp_list() and lnd_list().
(do_unit_move): Replace call to shp_list() and lnd_list() with unit_list().
(shp_list, lnd_list): Remove, not needed, replaced by unit_list().

17 years ago(do_unit_move): Rename unit_list parameter to ulist
Ron Koenderink [Sun, 21 Jan 2007 23:11:59 +0000 (23:11 +0000)]
(do_unit_move): Rename unit_list parameter to ulist
to prevent a future conflict with unit_list().

17 years ago(ef_open_srv, start_server): Journal must not be written before
Markus Armbruster [Sun, 21 Jan 2007 17:58:01 +0000 (17:58 +0000)]
(ef_open_srv, start_server): Journal must not be written before
empth_init(), because writing calls empth_self().  Move call of
journal_startup().
(ef_close_srv, finish_server, panic): Move call of journal_shutdown()
for symmetry.

17 years agoFix server not to create a journal on SIGHUP when !keep_journal:
Markus Armbruster [Sun, 21 Jan 2007 17:34:22 +0000 (17:34 +0000)]
Fix server not to create a journal on SIGHUP when !keep_journal:
(journal_reopen): New.
(main): Use it.  Fixes failure to obey !keep_journal.
(journal_open): Internal linkage, changed semantics and return value.
Callers changed.
(journal_close): One caller left, inline and remove.

17 years ago(do_unit_move): Combine the two length checks and type check for
Ron Koenderink [Sun, 21 Jan 2007 12:28:40 +0000 (12:28 +0000)]
(do_unit_move): Combine the two length checks and type check for
printing the ship path into one if statement.  No functional changes.

17 years ago(PS_KILL): Nobody can observe this state, as player is deleted right
Markus Armbruster [Sun, 21 Jan 2007 12:16:54 +0000 (12:16 +0000)]
(PS_KILL): Nobody can observe this state, as player is deleted right
after entering it.  Remove.
(player_kill_idle, player_login): Simplify.

17 years ago(shutdwn): Take exclusive update lock for shutdown. This makes the
Markus Armbruster [Sun, 21 Jan 2007 12:04:16 +0000 (12:04 +0000)]
(shutdwn): Take exclusive update lock for shutdown.  This makes the
shutdown block until all aborted commands terminated and gave up their
lock.  Remove the cheesy one second wait for commands to finish.  This
also locks out further commands to execute during shutdown.  However,
it also makes it impossible to kill hung player threads here.  Rely on
player_kill_idle() for that.  That doesn't quite work right now,
because it leaves a stale shared lock behind, which blocks shutdown.

17 years ago(do_look): Make public.
Ron Koenderink [Sun, 21 Jan 2007 11:48:14 +0000 (11:48 +0000)]
(do_look): Make public.

(do_unit_move): Switch look() and llook() to use
do_look() instead.

17 years ago(do_unit_move): Change unit type to be determined at the
Ron Koenderink [Sun, 21 Jan 2007 11:39:52 +0000 (11:39 +0000)]
(do_unit_move): Change unit type to be determined at the
beginning of function instead using the leader.  The leader
becomes unknown when stopping or unit list becomes
empty.  This broke printing the path for ships.  Broken
in rev 1.43.

17 years ago(do_mob_ship): Combine to two duplicate blocks of code.
Ron Koenderink [Sun, 21 Jan 2007 11:38:04 +0000 (11:38 +0000)]
(do_mob_ship): Combine to two duplicate blocks of code.

17 years ago(do_look): New, created by combining by look() and llook().
Ron Koenderink [Sun, 21 Jan 2007 11:34:21 +0000 (11:34 +0000)]
(do_look): New, created by combining by look() and llook().

(look, llook): Use the do_look() and remove the unneeded code.

17 years agoUpdate known contributors comment.
Markus Armbruster [Sat, 20 Jan 2007 21:02:08 +0000 (21:02 +0000)]
Update known contributors comment.

17 years agoAbstract from shutdown initiation mechanism:
Markus Armbruster [Sat, 20 Jan 2007 20:40:52 +0000 (20:40 +0000)]
Abstract from shutdown initiation mechanism:
(shutdown_initiate): New.
(shut): Use it.  Shutdown in zero minutes no longer cancels the
shutdown, it just works.  Use negative argument to cancel.  Logging is
less detailed.
(shutdown_sequence): Internal linkage.

(pr_wall): All callers prefix text it with the same header.  Move it
into the function.

17 years ago(player_coms): Fix shutdown's c_form: first argument is not optional.
Markus Armbruster [Sat, 20 Jan 2007 20:19:16 +0000 (20:19 +0000)]
(player_coms): Fix shutdown's c_form: first argument is not optional.

17 years ago(getlandp, getloanp, getnatp, getnewsp, getnukep, getplanep)
Markus Armbruster [Sat, 20 Jan 2007 19:16:09 +0000 (19:16 +0000)]
(getlandp, getloanp, getnatp, getnewsp, getnukep, getplanep)
(getpowerp, getshipp, gettradep, gettrep): Fix insufficiently
parenthesized macro expansion.

17 years agoUpdate for flash.c rev. 1.20: flash and wall no longer break lines.
Markus Armbruster [Sat, 20 Jan 2007 18:59:49 +0000 (18:59 +0000)]
Update for flash.c rev. 1.20: flash and wall no longer break lines.

17 years ago(sendmessage): Don't split messages into lines of no more than 60
Markus Armbruster [Sat, 20 Jan 2007 16:32:35 +0000 (16:32 +0000)]
(sendmessage): Don't split messages into lines of no more than 60
characters.  Update info flash and wall.  They were wrong, anyway:
they claimed long messages were truncated.

17 years ago(coll): Fix freeing of repaid loan. The incorrectly freed loan
Markus Armbruster [Sat, 20 Jan 2007 15:57:25 +0000 (15:57 +0000)]
(coll): Fix freeing of repaid loan.  The incorrectly freed loan
continued to exist.  Fortunately, both shark and collect refused to
touch it.  fina() and repa() oopsed in loan_owed(), and recovered by
assuming (incorrectly!) a plausible debt.  Before trdsub.c rev. 1.7,
fina() catched and logged the bug, and ignored the loan, and repa()
computed a ridiculous debt.

17 years ago(do_unit_move): Move the shp_view() code in the switch case.
Ron Koenderink [Sat, 20 Jan 2007 12:56:55 +0000 (12:56 +0000)]
(do_unit_move): Move the shp_view() code in the switch case.
No functional changes.

17 years ago(do_unit_move): New, create from common code in navi() and march().
Ron Koenderink [Sat, 20 Jan 2007 02:21:10 +0000 (02:21 +0000)]
(do_unit_move): New, create from common code in navi() and march().

(navi, move): Use do_unit_move(), remove unneeded code.

(switch_leader, pr_leader_change, get_leader): Make static as only called
from marc.c.

17 years ago(pr_leader_change, get_leader, switch_leader): Move
Ron Koenderink [Sat, 20 Jan 2007 01:42:39 +0000 (01:42 +0000)]
(pr_leader_change, get_leader, switch_leader): Move
pr_leader_change(), get_leader() and switch_leader()
from marc.c to navi.c.

17 years ago(force, shut): Remove useless test of update pending. Commands are
Markus Armbruster [Fri, 19 Jan 2007 18:41:05 +0000 (18:41 +0000)]
(force, shut): Remove useless test of update pending.  Commands are
not dispatched while it is true.

17 years agoFix the previous revision.
Markus Armbruster [Fri, 19 Jan 2007 18:25:30 +0000 (18:25 +0000)]
Fix the previous revision.

17 years agoAbstract from update trigger mechanism:
Markus Armbruster [Fri, 19 Jan 2007 06:46:10 +0000 (06:46 +0000)]
Abstract from update trigger mechanism:
(update_trigger): New.
(force, zdon): Use it.
(update_sem, update_force): Internal linkage.

(update_trigger, update_force): Passing a pointer to static storage as
thread argument is racy.  Use dynamic allocation.

17 years agoClean up includes after the previous revision.
Markus Armbruster [Fri, 19 Jan 2007 06:34:45 +0000 (06:34 +0000)]
Clean up includes after the previous revision.

17 years ago(struct loc_Thread, empth_sem_wait, empth_sem_signal) [WIN32]:
Ron Koenderink [Thu, 18 Jan 2007 14:28:23 +0000 (14:28 +0000)]
(struct loc_Thread, empth_sem_wait, empth_sem_signal) [WIN32]:
Remove the semaphore mutex and replace with hThreadMutex instead

17 years ago(struct loc_RWLock_t): Rename struct loc_RWLock_t to struct loc_RWLock
Ron Koenderink [Thu, 18 Jan 2007 01:22:32 +0000 (01:22 +0000)]
(struct loc_RWLock_t): Rename struct loc_RWLock_t to struct loc_RWLock
as the struct loc_RWLock_t is not a typedef.  No functional changes.

17 years ago(struct loc_Sem_t): Rename struct loc_Sem_t to struct loc_Sem
Ron Koenderink [Thu, 18 Jan 2007 01:18:19 +0000 (01:18 +0000)]
(struct loc_Sem_t): Rename struct loc_Sem_t to struct loc_Sem
as the struct loc_Sem_t is not a typedef.  No functional changes.

17 years ago(struct loc_Thread_t): Rename struct loc_Thread_t to struct loc_Thread
Ron Koenderink [Thu, 18 Jan 2007 01:12:43 +0000 (01:12 +0000)]
(struct loc_Thread_t): Rename struct loc_Thread_t to struct loc_Thread
as the struct loc_Thread_t is not a typedef.  No functional changes.

17 years ago(empth_wait_for_signal) [WIN32]: Simplify empth_wait_for_signal()
Ron Koenderink [Thu, 18 Jan 2007 01:05:19 +0000 (01:05 +0000)]
(empth_wait_for_signal) [WIN32]: Simplify empth_wait_for_signal()
by combined the waiting for hShutdownEvent and hThreadMutex
using the optional parmeter added to loc_RunThisThread().

17 years agoRemove the wait command, it's been broken and restricted to deity
Markus Armbruster [Wed, 17 Jan 2007 20:04:03 +0000 (20:04 +0000)]
Remove the wait command, it's been broken and restricted to deity
since Empire 2, ca. 1995:
(wai): Remove.
(player_coms): Update accordingly.

17 years ago(ac_encounter): Called writemap() only for active sorties, and not
Markus Armbruster [Wed, 17 Jan 2007 19:52:12 +0000 (19:52 +0000)]
(ac_encounter): Called writemap() only for active sorties, and not
when update_pending.  This makes no sense.  The map is updated in
memory and not calling writemap() only delays the write back to disk.
Remove the conditional.

17 years ago(can_listen): Never returns; change return type to void.
Markus Armbruster [Wed, 17 Jan 2007 19:22:49 +0000 (19:22 +0000)]
(can_listen): Never returns; change return type to void.

17 years ago(recvclient): Fix race condition: when io_output_all() blocked, then
Markus Armbruster [Wed, 17 Jan 2007 19:13:53 +0000 (19:13 +0000)]
(recvclient): Fix race condition: when io_output_all() blocked, then
got unblocked by command abortion, it could then block in io_input().

17 years ago(check_all_markets): Don't flush tables to disk. Remaining code is
Markus Armbruster [Tue, 16 Jan 2007 20:50:31 +0000 (20:50 +0000)]
(check_all_markets): Don't flush tables to disk.  Remaining code is
trivial; inline function into its only caller and remove it.

17 years agoFuse market update and market check thread:
Markus Armbruster [Tue, 16 Jan 2007 20:46:32 +0000 (20:46 +0000)]
Fuse market update and market check thread:
(check_all_markets): No longer a thread entry point.  Remove the
parameter.  Remove *player setup.  Don't terminate the thread when
done.
(market_update): Call check_all_markets() instead of running it in its
own thread.  Set up *player for it.
(market_init): Create the fused update thread instead of the update
wait thread.

17 years ago(market_init): New.
Markus Armbruster [Tue, 16 Jan 2007 20:22:06 +0000 (20:22 +0000)]
(market_init): New.
(start_server): Call it.  Move initialization stuff to it, with error
checking added.
(market_update): Internal linkage.

17 years agoFuse update wait thread and update thread:
Markus Armbruster [Tue, 16 Jan 2007 20:06:27 +0000 (20:06 +0000)]
Fuse update wait thread and update thread:
(update_main): No longer a thread entry point.  Remove the parameter.
Remove *player setup.  Don't terminate the thread when done.
(update_pending): Move to src/server/update.c.
(update_wait): Call update_main() instead of running it in its own
thread.  Set up *player for it.
(update_init): Create the fused update thread instead of the update
wait thread.

17 years agoFix the previous revision.
Markus Armbruster [Tue, 16 Jan 2007 19:54:12 +0000 (19:54 +0000)]
Fix the previous revision.

17 years ago(exit_nomem): New.
Markus Armbruster [Tue, 16 Jan 2007 19:26:31 +0000 (19:26 +0000)]
(exit_nomem): New.

(update_init): New.
(start_server): Call it.
(start_server, update_sched): Move initialization stuff to it, with
error checking added.
(update_sched): Internal linkage.

17 years agoSynchronize commands and update properly with a lock (towards
Markus Armbruster [Mon, 15 Jan 2007 19:57:26 +0000 (19:57 +0000)]
Synchronize commands and update properly with a lock (towards
resolving #1458175 and #1504036):
(update_lock): New.
(update_shed): Initialize it.
(update_wait, dispatch): Take exclusive update_lock around the update,
shared update_lock around commands.  This makes the update block until
all aborted commands terminated and gave up their lock.  Remove the
cheesy and unsafe two second wait for commands to finish.  It also
makes player threads block before executing commands while the update
is pending, removing the need to fail commands then.  So don't.

17 years ago(struct loc_Thread_t, struct loc_Sem_t, hThreadStartEvent)
Ron Koenderink [Mon, 15 Jan 2007 13:34:33 +0000 (13:34 +0000)]
(struct loc_Thread_t, struct loc_Sem_t, hThreadStartEvent)
(loc_RunThisThread, empth_init, empth_create, empth_wait_for_signal)
[EMPTH_W32]: Remove some incorrect references to semaphones
in the comments.  No functional changes.

17 years ago(loc_RunThread, empth_init, empth_threadMain, empth_yield)
Ron Koenderink [Mon, 15 Jan 2007 12:45:35 +0000 (12:45 +0000)]
(loc_RunThread, empth_init, empth_threadMain, empth_yield)
(empth_select, empth_sleep, empth_wait_for_signal)
(empth_sem_wait) [EMPTH_W32]: Add the ability to wait additional
event in loc_RunThread() when acquiring the hThread mutex.

(empth_rwlock_t, empth_rwlock_create, empth_rwlock_destroy)
(empth_rwlock_wrlock, empth_rwlock_rdlock, empth_rwlock_unlock): New.

(empth_rwlock_t, empth_rwlock_create, empth_rwlock_destroy)
(empth_rwlock_wrlock, empth_rwlock_rdlock, empth_rwlock_unlock)
[EMPTH_W32]: WIN32 implementation.

(empth_rwlock_t, empth_rwlock_create, empth_rwlock_destroy)
(empth_rwlock_wrlock, empth_rwlock_rdlock, empth_rwlock_unlock)
(lwp_rwlock, lwp_rwlock_create, lwp_rwlock_destroy)
(lwp_rwlock_wrlock, lwp_rwlock_rdlock, lwp_rwlock_unlock)
[EMPTH_LWP]: LWP implementation.

(empth_rwlock_t, empth_rwlock_create, empth_rwlock_destroy)
(empth_rwlock_wrlock, empth_rwlock_rdlock, empth_rwlock_unlock)
[EMPTH_POSIX]: pthread implementation.

17 years ago(produce_sect): Use bp_put_items() after calls that may update vec[].
Markus Armbruster [Sun, 14 Jan 2007 10:07:37 +0000 (10:07 +0000)]
(produce_sect): Use bp_put_items() after calls that may update vec[].
This is more robust than using bp_put_item() for those elements of
vec[] that the call may change.  The old code missed some changes:
upd_buildeff() changing population when tearing down a big city,
enlist(), and produce().  The first two should have been harmless, the
last one made budget mispredict repairs when required materials were
produced in the same update.

17 years ago(do_feed, produce_sect): Move bp_put_item() calls from do_feed() to
Markus Armbruster [Sun, 14 Jan 2007 10:03:19 +0000 (10:03 +0000)]
(do_feed, produce_sect): Move bp_put_item() calls from do_feed() to
produce_sect(), for consistency with the other update functions that
update sct_item[].  Parameter bp is now unused, remove.

17 years ago(do_feed): Don't update sp->sct_avail for growing of emergency ration,
Markus Armbruster [Sun, 14 Jan 2007 09:46:30 +0000 (09:46 +0000)]
(do_feed): Don't update sp->sct_avail for growing of emergency ration,
that's the caller's job.

17 years agoFix the previous revision.
Markus Armbruster [Sun, 14 Jan 2007 09:38:09 +0000 (09:38 +0000)]
Fix the previous revision.

17 years ago(bp_put_items): New.
Markus Armbruster [Sun, 14 Jan 2007 09:11:25 +0000 (09:11 +0000)]
(bp_put_items): New.
(bp_set_from_sect): Use it.

17 years ago(produce_sect): Don't truncate population; that's already done in
Markus Armbruster [Sun, 14 Jan 2007 08:59:07 +0000 (08:59 +0000)]
(produce_sect): Don't truncate population; that's already done in
do_feed().

17 years agoDocument.
Markus Armbruster [Sat, 13 Jan 2007 18:08:49 +0000 (18:08 +0000)]
Document.

(BP_CIVIL, BP_SHELL, BP_GUN): These were used write-only.  Remove.
(bud_key): Update accordingly.

(bp_item_idx): enumeration type for the bp_item[] indexes.  Use where
appropriate.

(bp_get_item): Oops on access to an item that is not tracked.

17 years ago(bp): Rename member val to bp_item, member avail to bp_avail. Users
Markus Armbruster [Sat, 13 Jan 2007 17:33:59 +0000 (17:33 +0000)]
(bp): Rename member val to bp_item, member avail to bp_avail.  Users
changed.  Switch from int to short, to match struct sctstr members
sct_item and sct_avail.

Symbolic indexes for struct bp member bp_item[]:
(BP_NONE, BP_CIVIL, BP_MILIT, BP_SHELL, BP_GUN, BP_LCM, BP_HCM)
(BP_MAX): New.
(bug_key): Use them.  Values are now array indexes, not indexes + 1.
(bp_get_item, bp_put_item, bp_set_from_sect): Update for changed
bud_key[].

17 years ago(alloc_bp, bp_alloc): Rename.
Markus Armbruster [Sat, 13 Jan 2007 17:11:17 +0000 (17:11 +0000)]
(alloc_bp, bp_alloc): Rename.
(fill_update_array, bp_set_from_sect): Rename.
(gt_bg_nmbr, pt_bg_nmbr, bp_get_item, bp_get_avail, bp_put_item,
bp_put_avail): Separate accessor functions for item and avail.

17 years ago(get_wp, bp_ref): Replace function returning pointer into a struct bp
Markus Armbruster [Sat, 13 Jan 2007 12:01:12 +0000 (12:01 +0000)]
(get_wp, bp_ref): Replace function returning pointer into a struct bp
by function returning to struct bp.  Leave member access to callers.
Callers changed.

17 years agoUpdate known contributors comment.
Markus Armbruster [Sat, 13 Jan 2007 10:16:43 +0000 (10:16 +0000)]
Update known contributors comment.

17 years agoReplace the revolting build pointer data structure by a proper data
Markus Armbruster [Sat, 13 Jan 2007 09:07:59 +0000 (09:07 +0000)]
Replace the revolting build pointer data structure by a proper data
type.  Make it abstract because that's possible.  Change data layout
so that the slots belonging to a sector are together in memory, it's
nicer to the cache.
(bp): The new type.  Users changed.
(get_wp): Update accordingly.
(alloc_bp): New.
(update_main, calc_all): Use it.  Before, calc_all() allocated 1/7
more than necessary.

17 years ago(get_materials): Redesign.
Markus Armbruster [Wed, 10 Jan 2007 07:15:45 +0000 (07:15 +0000)]
(get_materials): Redesign.
(shiprepair, planerepair, landrepair): Use it.  Behavioral change:
ship repairs outside harbors and plane repairs by a carrier can use
fewer materials.  Before, such repairs consumed each required
commodity as far as available.  Now, they consume the same fraction of
the real cost of each commodity, i.e. commodity use is limited by the
most scarce commodity.  Neither old nor new behavior make much sense,
but the new code is simpler.

17 years agoUpdate copyright notice.
Markus Armbruster [Tue, 9 Jan 2007 19:09:31 +0000 (19:09 +0000)]
Update copyright notice.

17 years agoBump version to 4.3.10.
Markus Armbruster [Mon, 8 Jan 2007 18:26:24 +0000 (18:26 +0000)]
Bump version to 4.3.10.

17 years agoUpdate for 4.3.9. v4.3.9
Markus Armbruster [Sat, 6 Jan 2007 12:46:01 +0000 (12:46 +0000)]
Update for 4.3.9.

17 years ago(marc, navi): Switch the parsing logic to facilitate the merging marc()
Ron Koenderink [Sat, 6 Jan 2007 12:35:44 +0000 (12:35 +0000)]
(marc, navi): Switch the parsing logic to facilitate the merging marc()
and navi() in the future.  No functional changes.

17 years ago(landrepair): Allow land unit repairs in allied sectors
Ron Koenderink [Thu, 4 Jan 2007 13:22:06 +0000 (13:22 +0000)]
(landrepair): Allow land unit repairs in allied sectors

17 years ago(decl): Prevent the deity from changing relations for a player to
Ron Koenderink [Wed, 3 Jan 2007 12:54:41 +0000 (12:54 +0000)]
(decl): Prevent the deity from changing relations for a player to
self.  Closes #1384998.  Allow the deity to set the relations of a
player towards the deity.

17 years ago(arm): Prevent a nuke from being on two planes at the same time.
Ron Koenderink [Tue, 2 Jan 2007 23:57:40 +0000 (23:57 +0000)]
(arm): Prevent a nuke from being on two planes at the same time.
Closes #1602998.

17 years ago(do_land_mob): Combine to two duplicate blocks of code.
Ron Koenderink [Tue, 2 Jan 2007 12:52:02 +0000 (12:52 +0000)]
(do_land_mob): Combine to two duplicate blocks of code.

17 years ago(march, navi): Switch to struct empobj * for leader and rename to leader.
Ron Koenderink [Tue, 2 Jan 2007 12:50:56 +0000 (12:50 +0000)]
(march, navi): Switch to struct empobj * for leader and rename to leader.
No functional changes.

17 years ago(setstr): Fix type error in variadic argument.
Markus Armbruster [Sun, 31 Dec 2006 17:21:11 +0000 (17:21 +0000)]
(setstr): Fix type error in variadic argument.

17 years ago(planerepair): Fix so only the player's own planes and allied planes
Ron Koenderink [Sun, 31 Dec 2006 17:19:46 +0000 (17:19 +0000)]
(planerepair): Fix so only the player's own planes and allied planes
are repaired.  Closes #757081.

17 years ago(shutdown_init): Has no effect, remove.
Markus Armbruster [Sun, 31 Dec 2006 17:05:57 +0000 (17:05 +0000)]
(shutdown_init): Has no effect, remove.

17 years agoNew option AUTO_POWER; closes #1009993:
Markus Armbruster [Sun, 31 Dec 2006 16:56:34 +0000 (16:56 +0000)]
New option AUTO_POWER; closes #1009993:
(opt_AUTO_POWER, update_power): New.
(update_main): Implement AUTO_POWER.
(powe): Disable power new when AUTO_POWER is on.

(powe): New power update.
(gen_power): Compute power into buffer passed by caller, make write to
power file optional.

17 years ago(genpower, powcmp): Sort struct powstr powbuf[] instead of struct
Markus Armbruster [Sun, 31 Dec 2006 13:38:46 +0000 (13:38 +0000)]
(genpower, powcmp): Sort struct powstr powbuf[] instead of struct
powsort order[].  Marginally less efficient, but simpler.
(powsort): Unused, remove.

17 years ago(update_main): Move logging of the update up to a more logical place.
Markus Armbruster [Sun, 31 Dec 2006 13:16:17 +0000 (13:16 +0000)]
(update_main): Move logging of the update up to a more logical place.

17 years ago(get_leader, pr_leader_change): New.
Ron Koenderink [Sun, 31 Dec 2006 12:31:18 +0000 (12:31 +0000)]
(get_leader, pr_leader_change): New.
(set_leader, set_flagship): Replace with get_leader() and
pr_leader_change().

17 years ago(planerepair) Remove the CANT_HAPPEN owner check
Ron Koenderink [Sat, 30 Dec 2006 21:05:36 +0000 (21:05 +0000)]
(planerepair) Remove the CANT_HAPPEN owner check
as allied planes and previously allied planes can
be on the ship.

17 years ago(do_mob_land): Fix to use all excess mobility for fortification, not
Ron Koenderink [Fri, 29 Dec 2006 19:56:00 +0000 (19:56 +0000)]
(do_mob_land): Fix to use all excess mobility for fortification, not
just up to the land unit's current mobility.

17 years ago(planerepair): Move the carrier sanity to before the carrier variable is
Ron Koenderink [Thu, 28 Dec 2006 17:44:03 +0000 (17:44 +0000)]
(planerepair): Move the carrier sanity to before the carrier variable is
used.

17 years ago(do_mob_land): Disable automatic land unit fortification with excess
Ron Koenderink [Tue, 26 Dec 2006 19:17:22 +0000 (19:17 +0000)]
(do_mob_land): Disable automatic land unit fortification with excess
mobility when MOB_ACCESS is on.  It leads to excessively deep
recursion and thus miserable performance as the number of land units
grows.

17 years ago(produce): Randomly flushed level production below 1.0 to zero. Fix.
Ron Koenderink [Tue, 26 Dec 2006 19:15:41 +0000 (19:15 +0000)]
(produce): Randomly flushed level production below 1.0 to zero.  Fix.

(produce): Assign rounded level production to *ACTUAL instead of
randomly rounded one.

17 years agoInclude pthread.h in the implementation instead of the header.
Markus Armbruster [Tue, 26 Dec 2006 16:52:11 +0000 (16:52 +0000)]
Include pthread.h in the implementation instead of the header.

17 years ago(ef_open) [_WIN32]: Fix to get a read lock instead of a write lock for
Ron Koenderink [Wed, 29 Nov 2006 12:16:43 +0000 (12:16 +0000)]
(ef_open) [_WIN32]: Fix to get a read lock instead of a write lock for
EFF_RDONLY and to get a write lock instead of a total file lock for
file opened for writing.

17 years agoFix rev. 1.24, which failed to charge mobility for sweeping without
Markus Armbruster [Tue, 21 Nov 2006 22:26:30 +0000 (22:26 +0000)]
Fix rev. 1.24, which failed to charge mobility for sweeping without
moving.

17 years agoBump version to 4.3.9.
Markus Armbruster [Sat, 21 Oct 2006 06:49:04 +0000 (06:49 +0000)]
Bump version to 4.3.9.

17 years ago4.3.8 last minute changes. v4.3.8
Markus Armbruster [Fri, 20 Oct 2006 18:33:29 +0000 (18:33 +0000)]
4.3.8 last minute changes.

17 years ago(upd_ship): Don't produce stuff when broke, to match sector behavior.
Markus Armbruster [Fri, 20 Oct 2006 18:30:26 +0000 (18:30 +0000)]
(upd_ship): Don't produce stuff when broke, to match sector behavior.

17 years agoUpdate for 4.3.8.
Markus Armbruster [Fri, 13 Oct 2006 18:29:22 +0000 (18:29 +0000)]
Update for 4.3.8.

17 years ago(switch_leader): Generalize the code, no functional changes.
Ron Koenderink [Tue, 10 Oct 2006 20:23:19 +0000 (20:23 +0000)]
(switch_leader): Generalize the code, no functional changes.
(navi): Change switch_flagship() to call switch_leader() instead.
(switch_flagship): Remove, not needed, replaced with switch_leader().

17 years ago(take_casualties): Code for distributing casualties among units did
Markus Armbruster [Sun, 8 Oct 2006 09:32:49 +0000 (09:32 +0000)]
(take_casualties): Code for distributing casualties among units did
not make sense, and in its confusion destroyed land land units when it
shouldn't.  Minimally invasive fix; code is still ugly and
incomprehensible.