Commit graph

100 commits

Author SHA1 Message Date
Ron Koenderink
7b94794365 (cens, desi, dump, do_desi, doland, file_sct_init, grow_continents)
(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.
2005-11-17 03:21:32 +00:00
Ron Koenderink
d581485d32 (plurize): Fix the strncat() len parameter to prevent an overflow of buf.
(numstr, esplur, splur, iesplur, plurize): Move the prototype defintions from
misc.h to prototypes.h.  Remove unneccessary headers in plur.c.
2005-11-13 23:18:37 +00:00
Ron Koenderink
d8422caa84 (init_server, ef_load, xundump): Add ability to customize game
configurations.  The custom game configurations are loaded via
text files in the data directory.  Closes #752881.
2005-11-12 16:53:52 +00:00
Ron Koenderink
1b74e7ac42 (mission_short_name): Remove mission_short_name, not used. 2005-11-04 18:27:28 +00:00
ae81dade53 (ef_init, ef_init_srv): Rename old ef_init() ef_init_srv(), call new
ef_init().  Move initialization of map sizes to ef_init().
(main): Don't initialize map sizes by hand, call ef_init().

(fileinit): Internal linkage.
2005-10-29 15:16:50 +00:00
747d1333cc (intmatch): Assumes that struct size is a multiple of sizeof(int), out
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.
2005-10-29 07:15:14 +00:00
a6a87af6ed (disassoc): Rewrite for POSIX, return status. Caller changed.
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.
2005-10-25 18:42:03 +00:00
f5a1430bcf (map, draw_map): Remove undocumented feature that lets deities run map
as another country.  It appeared around Chainsaw 3.0 and never fully
worked.  See also #1335316.
2005-10-23 08:32:49 +00:00
5270cc57f2 [NOSTRDUP]: Drop support for systems without strdup(). 2005-10-22 18:12:22 +00:00
ed5ba9fe3e (player_find_other): Replace by getplayer. player_find_other()
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.
2005-10-02 16:30:43 +00:00
caac6e41ca (get_assembly_point): New.
(bomb, drop, fly, para, reco): Use it.
2005-10-01 14:07:35 +00:00
09b0b83971 (IO_CONN, io_conn, IOQ_BUFSIZE, MAXIOV, LND_NOTANY, plur)
(techfactfire, reltech, P_DISTING, PLN_MAXDEF, filetruncate, sct_init)
(nxtsctp, AN_SAILDIR, UDTIMES_MAX, BLITZTIME): Unused, remove.
2005-09-30 19:51:32 +00:00
03abca9258 Remove leftover declarations that should have been removed along with
the definitions.
2005-09-30 19:40:41 +00:00
8cc53c1c2b (status): Internal linkage. 2005-07-23 16:41:18 +00:00
6147446fc1 New doc & doc fixes. Remove s_char on the way.
(C_MOD): Turn into enumeration constant.
2005-06-25 17:22:45 +00:00
65b6eaeee5 (player_login): Replace pr_player() by equivalent pr_id().
(pr_player, upr_player): Internal linkage.

(pr_hilite): Unused, remove.
2005-06-13 19:05:37 +00:00
71e164ed30 Document, in particular use of UTF-8. Simplify code in a couple of
places, but no functional changes.
2005-06-13 19:02:49 +00:00
b5ff7e3beb (copy_ascii_no_funny, copy_utf8_no_funny)
(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.
2005-06-13 18:16:44 +00:00
58a0d40777 (player_login, player_main): Move the C_INIT that terminates the login
phase to player_login().  No functional change.
(showvers): Trivial, used just once.  Inline, remove.
2005-06-13 09:45:32 +00:00
ac671d25e4 (parse): Support 127 arguments instead of 100, to match
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.
2005-06-13 09:33:54 +00:00
2f35354097 (dispatch): Argument buf is user text and must be printed as such. In
error messages, print just the command name instead.
2005-06-13 08:57:39 +00:00
ddfd5c1699 (play_list): player->combuf[] is user text and must be printed as
such.
(ufindbreak, ufindpfx): Rename, move to pr.c, external linkage.
2005-06-13 08:42:27 +00:00
Ron Koenderink
c3915edb54 (hidd,peek): Rename hidden command to peek.
This prevents a conflict in the info files with
HIDDEN option.
2005-06-01 12:26:22 +00:00
9b28594b5b (nxtitemp): Remove last parameter. Non-zero argument doesn't make
sense and is never passed.  Callers changed.
2005-05-28 08:22:42 +00:00
Ron Koenderink
2cc44bb182 Support UTF-8 encoded Unicode for user communications.
(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.
2005-05-26 01:58:48 +00:00
Marc Olzheim
e15b045713 (wu,typed_wu): close() a sent telegram before waking up other threads.
Remove s_char and register on the way.
2005-03-26 00:23:25 +00:00
345ad3dfe0 Update copyright notice. 2005-03-16 22:03:16 +00:00
Ron Koenderink
9227a314c5 (service_stoppped,stop_service,loc_Ctrl_C_Handler,
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.
2005-03-15 18:19:07 +00:00
3f472fc729 (finish_server): New, factored out of termination code. Fixes two
places in service_main() that lacked close_files().
(close_files, loc_NTTerm): Static linkage.
2005-03-12 16:28:28 +00:00
ed7adb7cf6 (loginit): Working directory is the data directory; simplify.
(loginit, logerror): Use plain char * instead of s_char *.
2005-03-10 19:33:12 +00:00
d20fb6ba39 (init_server, start_server): Move signal and thread initialization
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.
2005-03-09 19:37:48 +00:00
830c171dd2 (start_server, main, service_main): Call emp_config() earlier.
(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.
2005-03-05 20:38:01 +00:00
Ron Koenderink
85150431ed (delete_old_news,init_nreport): Add void for extern prototypes. 2005-03-03 00:23:49 +00:00
Ron Koenderink
3d3d6755aa (nreport, filereport, ncache, addfree, findfree, delete_old_news)
(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.
2005-03-02 23:53:10 +00:00
5ba8cab9b5 (total_work): Remove redundant conversion to int.
(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.
2005-02-20 19:36:41 +00:00
ff67d93711 (max_population): New, factored out of max_pop().
(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.
2005-02-17 21:04:08 +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
Ron Koenderink
b3ec8c14da The previous rev. was committed accidentally, revert. 2004-12-30 02:51:12 +00:00
Ron Koenderink
70fcb70707 (main,install_service,remove_service,service_main) [_WIN32]:
Add the ability to specify the service name, to install
multiple services and to set -D and -e options during install.
2004-12-30 02:19:44 +00:00
Ron Koenderink
e342a73130 (main,close_files,loc_NT_Term,empth_exit):
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.
2004-12-21 03:10: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
Ron Koenderink
042372d4c2 (have_looked,have_found,set_have_looked,set_have_found,print_found):
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().
2004-12-16 11:12:28 +00:00
Ron Koenderink
4a6346b0df (sct_pstage, sct_ptime, shp_pstage, shp_ptime, lnd_pstage, lnd_ptime):
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.
2004-12-12 19:39:35 +00:00
Marc Olzheim
e9a040adb9 Do not include var.h where no longer needed. Clean up register keywords in these file at the same time. No functional changes. 2004-10-12 20:08:51 +00:00
1e1f8088a8 (item_prewrite): New.
(checksect, shp_prewrite, lnd_prewrite): Use it.
2004-09-19 07:56:57 +00:00
Marc Olzheim
d30942632b (I_NONE, I_CIVIL, I_MILIT, I_SHELL, I_GUN, I_PETROL, I_IRON, I_DUST,
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.
2004-09-16 21:18:01 +00:00
fac342ed49 Update copyright notice. 2004-09-07 15:07:16 +00:00
8982ff2e18 (pln_arm): Callers don't use parameter tech; remove it. Callers
changed.
2004-08-30 16:13:37 +00:00
e16e38dfab (trad, set): Treat trade file slots with zero owner as unused, so that
freshly extended trade file makes sense.  When set() removes a lot,
simply zero the slot.

(set): Initialize trd_uid.

(trade_check_ok): Use check_land_ok() & friends instead of doing it by
hand, but wrong.  This fixes bying planes and land units loaded on
ships that moved after loading.

(check_trade_ok): New.
(trade_check_ok): Use it.  Remove unused argument lot.  Callers
changed.
2004-08-28 15:22:50 +00:00
92799db17b (dodeliver): Move from sect.c to deliver.c. No functional changes.
(deliver): Static linkage.
2004-08-28 07:10:38 +00:00