Rename close_files() to ef_close_srv() and move to fileinit.c.
Replace calls to close_files() with ef_fin_srv().
Call ef_close_srv() from ef_fin_srv().
(ef_close_srv, ef_fin_srv): New.
(init_files, init_server, ef_init_srv):
Rename init_files() to ef_open_srv() and move to fileinit.c.
Remove call to init_files() from init_server() and replace
with a call to ef_open_srv() from ef_init_srv().
(ef_open_srv): New.
(ef_load, init_server, ef_init_srv):
Move the call to ef_load() from init_server() to ef_init_srv().
(global_init, init_server, ef_init_srv):
Move the call to global_init() from init_server() to ef_init_srv().
(nullify_objects, global_init, init_server):
Split nullify_objects() into init_lchr() and init_dchr().
Locate init_lchr() and init_dchr() in init.c.
Add calls to init_lchr() and to init_dchr() from global_init().
(init_lchr(), init_dchr()): New.
(grow_islands, set_coastal, update_coastal_flag, coast_sea_to_land)
(coast_land_to_sea): Determine sct_coastal flag when the sector type
is set. Old method only updated the sct_coastal flag when doing
cens() or a dump(). Other uses of sct_coastal could get stale values,
including selector coastal. Rework set_coastal() into NEW functions
update_coastal_flag(), coast_sea_to_land(), coast_land_to_sea() and
set_coastal(). Fix a bug where the deity designation would not
properly set the coastal flag. Fix a bug where the one sector lake
would not properly compute coastal flag. Fix a bug that makes
fairland treat the last sector it adds to an island as non-coastal.
of laziness. The assumption is true on any sane machine, due to
alignment constraints. But the function doesn't provide enough value
to make me fix or document this. Remove it.
(lookup): Replace it.
Problems with the old code:
* Insufficient error checking.
* It used TIOCNOTTY (obsolete BSDism) to get rid of the controlling
tty, except for hpux || Rel4, where it attempted to use the POSIX
way, but screwed up.
* It left file descriptors 0, 1, 2 in a somewhat weird state.
searches for a player other than US for country CNUM, which is in
state PS_PLAYING. Since there can be at most one player in state
PS_PLAYING, and no caller pass that player as US, they can simply use
getplayer() instead.
(copy_utf8_to_ascii_no_funny): New.
(flash, wall, prmptrd, uprmptrd, getcommand): Use them to filter
input.
(uprnf, pr_flash): Use them to filter output.
(prtoascii): No longer used, remove.
(player_commands, player_commands_index): Internal linkage.
player->argp[]. Assign complete argument vector. This should make
buffer overruns blatantly obvious.
(parse): Don't bother checking SPACE argument, just crash. It is
extremely unlikely that such a programming error wouldn't be
discovered by even them most superficial testing.
(NF_UTF8, togg): New client flag.
(flash, wall): User text input filtering.
(parse, prmptrd): Normal text input filtering.
(uprmptrd, ugetstring): New, to get user text.
(getele, flash, wall): Use them.
(getele): No need to filter out funny characters; input filtering
takes care of them.
(sendmessage, ufindbreak): Work on user text.
(uprnf): New, to print user text.
(rea, gamedown, show_motd): Use it.
(prnf): Unused, remove.
(pr, upr_player): Normal text output filtering (with highlighting).
(pr_flash): User text output filtering.
empth_request_shutdown,loc_BlockMainThread,empth_init,
service_ctrl_handler) [_WIN32]: Remove the Windows Build UI and
replace with Ctrl-c signal trap. The shutdown event that was used for
STOPPING the service is now used for both foreground and background
(service) modes of operation. Also move the shutdown event from service
code to empth_t library.
from init_server() to start_server(), and service startup next to its
Unix equivalent disassoc(). This way, threading is always initialized
after daemonizing, which is simpler and more portable.
(main): Call loginit() later, after emp_config(). Previously, the
program logged to the default datadir until emp_config().
(init_server, start_sever): Split start_server() into initialization
and actual startup. Move initialization before disassoc().
(main, init_server): Log server startup only after initialization is
complete.
(init_nreport, update_main, start_server): Switch news to be sorted
list with all new news items added at the end of the list. The
removal of expired news items is done at update time. Closes#766755.
(total_work): New parameter maxpop. Callers changed.
(newe, prod): Use total_work(). Old code failed to limit military
workers, thus didn't match the update.
(do_feed): Simplify.
(max_pop): Use it. Don't support null argument anymore.
(nati, gen_power): Use max_population() instead of max_pop() with null
argument.
(show_sect_stats): Use max_population() to simplify the code.
(prod, upd_buildeff): Use max_population() to get correct new maximum
population for limiting work when tearing down a big city.
Previously, this was broken in upd_buildeff(). In prod(), it was
broken when the new designation had odd maximum population, which
should not occur.
Add Windows Service to the server.
This includes adding install service and remove service option.
Move the start code from main to separate function.
Make close_files() and loc_NT_Term() global.
Move disassoc() to be earlier in the startup sequence.
collapse to shiplist function set (add,free,print,on). Fix bug where ship
uid was a unsigned char instead of short. Switch to head pointer instead
of head record with a linked list. Add a free().
Use `short' instead of `unsigned short'. With variables, plague stage
and time were stored unsigned and used signed, which worked. Removal
of variables dropped the conversion to signed, which broke
plague_people() (plague.c rev. 1.6): stage didn't progress correctly
due to catastrophic underflow of time.
I_BAR, I_FOOD, I_OIL, I_LCM, I_HCM, I_UW, I_RAD, I_MAX): Turn macros
into enumeration constants.
(i_type): New. Use where appropriate. No functional changes, except
that I_NONE is now catched properly in a few places.