Commit graph

49 commits

Author SHA1 Message Date
4bb23dd1a6 Make econfig keys data and info work for relative names
File names in econfig need to be interpreted relative to configdir.
This wasn't the case everywhere for keys data and info.

Fix this by changing variables gamedir and infodir to hold absolute
names.  Change builtindir likewise, for consistency.  Store the values
from econfig in gamedir_conf, infodir_conf and builtindir_conf.

Uses new fnameat() to derive absolute names from possibly relative
ones.
2008-02-07 08:01:54 +01:00
b58bc70d07 Remove telfil, use teldir instead. 2008-02-02 09:22:10 +01:00
db02dda32f Update copyright notice 2008-01-19 10:15:37 +01:00
286dda725e Store update disable flag in the game table to make it visible in
xdump:
(gamestr): New member game_upd_disable.
(game_ca): Update accordingly.
(game_ctrl_update): New.
(disa, enab): Use it.
(updates_disabled): Rewrite and move to game.c
(disablefil): Remove.
2007-07-27 05:58:40 +00:00
4bd19812af Use the new Empire clock for implementing MOB_ACCESS:
(lndstr, plnstr, sctstr, shpstr): Change timestamp members lnd_access,
pln_access, sct_access, shp_access from real time (time_t) to ETUs
within a turn (short).
(land_ca, plane_ca, sect_ca, ship_ca): Update accordingly.
(build_ship, build_land, build_bridge, build_plane, build_tower)
(explore, check_trade, bsanct, takeover, takeover_ship)
(takeover_land): Use game_tick_to_now() instead of time() to update
the timestamp.  Change check_trade(), takeover_ship(), takeover_land()
to do that only when MOB_ACCESS is enabled, for consistency.
(lupgr, supgr, pupgr, takeover_ship): Don't touch the timestamp where
mobility isn't touched either.
(sct_do_upd_mob, shp_do_upd_mob, lnd_do_upd_mob, pln_do_upd_mob): Use
game_tick_to_now() instead of increase_mob() to compute ETUs since
the timestamp and update the timestamp.  Closes #1012699.
(increase_mob): Remove.
(mob_sect, mob_ship, mob_land, mob_plane): sct_do_upd_mob() & friends
no longer do the right thing at the update.  Use game_reset_tick() and
pass its result directly to do_mob_sect() & friends.  This is only
correct when argument is etu_per_update, which it always is.  Remove
parameter.  Callers changed.
(do_mob_sect, do_mob_ship, do_mob_land, do_mob_plane): Oops on
negative argument.

(mob_acc_globals, timestampfil, mobupdate, updating_mob)
(update_all_mob, timestamp_fixing, update_timestamps, mobility_check):
The mobupdate command was important to let deities manually
synchronize mobility updating with updates.  That's no longer needed.
The code behind it is somewhat hairy and ugly, and updating it to work
with the Empire clock is just not worth it.  Remove.  Users changed.
(player_coms): Update accordingly.
(upda): Remove display of mobility updating state.

(mobility_init): No need to fix up mobility on startup, as the Empire
clock runs normally even when the server is down.  Remove.  Caller
changed.
2007-07-15 09:43:57 +00:00
71320ed67f New update scheduler:
(schedulefil): New.
(set_dirs, set_paths): Rename.  Initialize schedulfil.
(read_schedule): New.  Can read several updates, which will be used in
later changesets.
(update_time): Change to array.  Will be used in later changesets.
(update_schedule_anchor): New.
(update_init): Initialize it.
(update_get_schedule): New.
(update_init): Call it to initialize update_time[].
(update_sched): Rewrite.
(update_forced, update_wanted): Replace.
(update_reschedule): New.
(main): Call it on SIGHUP to reload the schedule.
(update_trigger, update_force, force, player_coms): Drop force's
capability to schedule updates in the future, because it's not worth
the trouble to implement again.  Deities can simply edit the schedule
file to schedule updates.  Remove update_force() and
update_trigger()'s parameter.
(upda): Update for new scheduler.  Take care to keep output the same
as far as possible, even though it's ugly, to avoid breaking clients.
(update_policy, adj_update, update_times, hourslop, blitz_time):
econfig keys removed.
(update_demand, UPD_DEMAND_NONE, UPD_DEMAND_SCHED, UPD_DEMAND_ASYNC)
(update_demandpolicy, UDP_NORMAL, UDP_TIMES, UDP_NORMAL, UDP_BLITZ)
(UDP_MAX, UDP_DEFAULT, UDDEM_TMCHECK, UDDEM_COMSET, UDDEM_DISABLE)
(UDDEM_MAX, UDDEM_DEFAULT): econfig key and values replaced.  Users
changed.  wantupd.h is now empty, remove.
(demand_check): External linkage.
(update_policy_check): Now pointless, remove.
(is_daytime_near, min_to_next_daytime, regular_update_time)
(scheduled_update_time, next_scheduled_time, updatetime)
(next_update_time, next_update_check_time): Unused, Remove.

(demand_check, demandupdatecheck): Move call of demand_update_time()
from demand_check(), which controls all demand updates, to
demandupdatecheck(), which controls only unscheduled ones.  Fixes
update command not to lie about the next scheduled demand update.

(demandupdatecheck): Check updates_disabled() so that zdone no longer
claims to trigger an update when it can't.
2007-07-11 22:27:29 +00:00
63bdc89835 Update copyright notice. 2007-01-09 19:09:31 +00:00
7d75e2b8d3 (teldir, motdfil, downfil, disablefil, telfil, annfil, timestampfil):
Change to arrays.
2006-06-08 20:22:11 +00:00
02ddee69fb (banfil, authfil): Remove. Matching user is useless, because the
player can send whatever he wants.  Banning IPs is better done with a
packet filter.  That leaves restricting deity IPs.
(privip): New econfig key to restrict deity IPs.
(may_play): Implement it.
(match_user): Unused, remove.
2006-02-22 20:57:51 +00:00
e4865d473e (configdir): New, to be used for loading configuration tables.
(emp_config): Set it to econfig's directory.
2006-02-18 12:43:17 +00:00
4515b84c59 COPYING duplicates information from README. Remove. Move GPL from
LICENSE to COPYING, because that's where it usually is.  Update all
the references to these files.
2006-01-21 19:48:41 +00:00
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
fa52e6944d Normalize inclusion guards: use NAME_H for name.h. Some headers
lacked them, others used reserved identifiers.
2005-12-29 10:16:01 +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
2f1b7cd2a3 (opt_NO_LCMS, opt_NO_HCMS, opt_NO_OIL, Options,
buil, show_bridge, show_tower, nullify_objects):
Remove NO_LCMS, NO_HCMS, and NO_OIL options, not used.
Functionality can be emulated by modifiying the characteristics files.
2005-11-13 16:39:27 +00:00
Ron Koenderink
0a63d324ca (opt_NEUTRON, buil, denotate, show_nuke_capab, show_nuke_build,
Options): Remove opt_NEUTRON option.  The option can be emulated
by manipulating the flags in a nuke characteristics file.
2005-11-13 12:30:37 +00:00
Ron Koenderink
2e655eaf96 (buil, vers, opt_NONUKES, show_nuke_build, show_nuke_capab):
Remove opt_NONUKES options.  A nuke characteristics file can
be created with no entries to create the emulate the removed option.
2005-11-12 20:09:11 +00:00
dab1f0bc7d (START_UNITS, start_unit_type, deity_build_land, new): Remove
undocumented compile-time option START_UNITS.  It hasn't been used in
ages; writing a quick build script is easier than recompiling the
server.
2005-10-23 20:52:46 +00:00
687cacd887 (SNEAK_ATTACK, opt_SNEAK_ATTACK, Options, do_sneak, att_abort)
(att_fight): Remove option SNEAK_ATTACK.
2005-10-02 14:35:18 +00:00
03abca9258 Remove leftover declarations that should have been removed along with
the definitions.
2005-09-30 19:40:41 +00:00
786b34c693 (SHIPNAMES, opt_SHIPNAMES, Options, carg, name, sorde, qorde)
(show_sail, shi, att_get_combat, pr_com, satdisp, satmap, prship):
Remove nooption SHIPNAMES.
2005-07-31 17:22:32 +00:00
345ad3dfe0 Update copyright notice. 2005-03-16 22:03:16 +00:00
1583d0c6a2 (dflt_econfig): New.
(emp_config): Use it when argument is NULL.  This simplifies callers
except pconfig's main(), which now has to suppress reading the default
file.  Also fix callers to check the return value.  Previously, a typo
could easily start a grossly misconfigured program, with potentially
disastrous results.
2005-03-09 17:11:58 +00:00
afa65c8f27 Break inclusion cycles. To simplify the change, move a few
declarations to other, no less sensible places.
2005-02-12 19:26:59 +00:00
8f74995e99 (NUKEFAILDETONATE, opt_NUKEFAILDETONATE, Options, msl_hit): Remove
option NUKEFAILDETONATE.
2004-12-17 19:45:33 +00:00
46608d6c83 (ORBIT, opt_ORBIT, Options, launch_sat, pdump, plan, prod_plane):
Remove nooption ORBIT.
2004-12-17 19:29:36 +00:00
bebf6a7de0 (GUINEA_PIGS, opt_GUINEA_PIGS, Options): New option GUINEA_PIGS. 2004-12-16 22:01:30 +00:00
Marc Olzheim
d9f0f475da (turn): Change the command to allow for both an MOTD and a no-login
message.  Clean 'register' and 's_char' remnants on the way.
Circumvents bug #813167.
2004-12-16 14:17:08 +00:00
fac342ed49 Update copyright notice. 2004-09-07 15:07:16 +00:00
d89c268b8b (keymatch): Replace member km_func by km_type. Initializers adapted.
(emp_config, print_config): Cope with km_type.
(worldxset, intset, floatset, optstrset, doubleset, longset): Unused,
remove.

(emp_config): Fail if specified file can't be read or contains errors.
Used to succeed always, returning RET_OK.  RET_OK is not appropriate,
since this is not a command.  Return 0 on success, -1 on failure.
Callers ignore failure at the moment.  A missing or unreadable econfig
file used to be silently ignored.  It is still ignored, but no longer
silently.  It is questionable whether ignoring is wise, but that's
left for another day.

(emp_config): Improve diagnostic messages.

(set_option): Move diagnostics to caller.

(emp_config): Ignore leading whitespace in `#' comment lines.

(print_config): Simplify printing of km_comment.

(set_option): New parameter val, so it can set and clear options.
(delete_option): Remove.

(KM_ALLOC): Turn macro into enumeration constant.

(KM_INTERNAL): New.
(xdump, xdver): New version dump.

(keymatch, infodir, datadir, teldir, upfil, downfil, disablefil,
telfil, annfil, banfil, timestampfil, privname, privlog, update_times,
update_demandtimes, game_days, game_hours): Use plain char * instead
of s_char * for strings, void * for generic pointers.
2004-09-04 08:07:51 +00:00
7362ad6c19 Undo the previous revision (bad idea). 2004-08-30 20:28:15 +00:00
fd4d6b3108 (keymatch, configkeys): Move to from optlist.h to emp_config.c; static
linkage.
2004-08-30 17:36:50 +00:00
dcfd251f95 caddr_t is obsolete. Replace by void *, except for struct empfile
member cache, which becomes char * to keep pointer arithmetic simple.
2004-08-23 18:29:44 +00:00
5e381b6c57 (PLANENAMES, opt_PLANENAMES, Options, plchrstr, plchr_ca, plchr,
main): Remove nooption PLANENAMES.
2004-08-21 06:48:34 +00:00
Marc Olzheim
739a695241 Combine the definitions of include/optlist.h and the use thereof in
src/lib/gen/emp_config.c into a single file: include/econfig-spec.h.
2004-08-20 15:44:24 +00:00
7f4e59fb8d (new_work, do_feed, prod, newe): Factor out calculation of work into
new_work().

(ROLLOVER_AVAIL, opt_ROLLOVER_AVAIL, opt_ROLLOVER_AVAIL, Options,
rollover_avail_max, configkeys, vers, new_work): Replace option
ROLLOVER_AVAIL by configuration parameter rollover_avail_max.
2004-05-10 20:30:38 +00:00
07f5489977 (opt_SHIP_DECAY, Options, shiprepair): Remove option SHIP_DECAY. 2004-05-09 19:06:48 +00:00
988f9a8be7 (commfil, comminit, make): Unused, remove. 2004-04-10 17:07:43 +00:00
d64fa8d529 (opt_NEWPOWER, Options, gen_power): Remove nooption NEWPOWER.
(opt_NEW_STARVE, Options, feed_ship, feed_people): Remove nooption
NEW_STARVE.

(opt_NEW_WORK, Options, move, explore): Remove nooption NEW_WORK.
2004-03-11 10:36:55 +00:00
689f435aff (opt_GRAB_THINGS, Options, get_materials): Remove option GRAB_THINGS. 2004-03-11 08:53:27 +00:00
0c19d70c74 (mult, player_coms): Command `mult' is disabled since 4.0.0 ('96), and
its code is obviously not in working order.  Remove.
(minmult, maxmult, configkeys): Unused configuration parameters,
remove.
(tradedesc): Remove code related to mult that had no effect.
(multread, commread, commwrite, commamt, commset, multset, commprice):
Dangerous, because code bypasses ef_read() & friends, remove.
(diss): Commodity cleanup uses the above, remove.  Command is disabled
and unlikely to work anyway.
2004-03-01 09:04:02 +00:00
c1be5d8657 Don't declare things in more than one place. Move some declarations
between headers.  Code is now fully prototyped and compiles cleanly
with gcc -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
-Wredundant-decls.  Closes #723788.
2004-02-20 20:45:18 +00:00
4a3f0b8146 Add some missing declarations to headers. Remove some redundant
declarations elsewhere.  Change linkage of some functions to static.
2004-02-20 10:51:03 +00:00
966eb40899 Declare all configuration parameters in optlist.h. Remove some
redundant declarations elsewhere.
2004-02-19 16:46:18 +00:00
8cd0160176 Declare all configuration variables in optlist.h. Include that
instead of declaring them all over the place.  This uncovered type
errors:
(s_p_etu, adj_update): Defined long, sometimes declared int.  Kills
big endian machines where sizeof(long) != sizeof(int).  Change to
int.

(set_option, delete_option, optstrset, intset, floatset, doubleset,
longset, optionset, optiondel, worldxset): Change linkage to static.
2004-02-17 22:58:04 +00:00
237baffca9 Supply prototypes where possible. This uncovered type errors with
thread entrypoints:
(lwpSelect, shutdown_sequence): Parameters didn't match thread entry
point prototype.
(lwpEntryPoint): Arguments didn't match thread entry point prototype.

Change linkage of functions without prototype declaration to static
where possible.

Remove some superflous declarations, replace others by suitable
includes.
2004-02-17 17:59:30 +00:00
d7a054c20a (ROLLOVER_AVAIL, opt_ROLLOVER_AVAIL, Options, do_feed, prod, newe):
New option ROLLOVER_AVAIL; from Drake Diedrich.
2004-01-20 16:51:43 +00:00
9b7adfbecc Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
d8b7fdfae1 Import of Empire 4.2.12 2003-08-23 12:23:04 +00:00