Commit graph

82 commits

Author SHA1 Message Date
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
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
8a0854b6b8 (mchrstr, lchrstr): Change from variable-style storage of load
capacities to straight arrays.  Users now subscript the array instead
of calling vl_find() or walking the variable data structure.
(mchr, lchr): Initializers adapted.
(vl_find): No longer used.  Remove file.
2004-08-17 14:09:04 +00:00
Ron Koenderink
a965b2d25e (prod_eff): New, factored out of produce() and prod().
(upd_ship): Oil and food production used special rules that didn't
match ordinary production and didn't make much sense.  Made them
follow ordinary production rules.  This puts uw and mil to work, and
makes ship tech and efficiency relevant to production.  Closes #917461
and #955072.
2004-08-17 13:17:50 +00:00
d993fdef90 (pln_mine, pln_dropoff): Split off aerial mining into new pln_mine().
Callers changed.

(drop): Do not disclose anything about target sector before planes
actually got there, unless the target sector is owned by the player or
an ally.  This plugs a major loophole.  Consequently, the command can
no longer always refuse to attempt to drop stuff where it won't work.
Instead, the planes fly out to try.  Other plane commands (para, bomb)
behave exactly the same.  Also closes #909859.
(pln_dropoff): Cope with planes trying to drop where they can't.

(drop): Refuse to drop civilians into allied sectors, for consistency
with other means to move around stuff.
2004-08-14 17:12:20 +00:00
1127762cc1 (pln_oneway_to_carrier_ok): New.
(fly, reco): Use it to prevent flying to a carrier that doesn't have
space for the planes.  Previously, planes that did this were
teleported home, which could be abused.

(fly): Fail if pln_sel() comes up empty, just like the other commands
to fly planes.
2004-08-13 20:22:03 +00:00
c2debd73fc (shp_set_tech, pln_set_tech, lnd_set_tech): New, factored out of build
and upgrade code.
(build_ship, build_plane, build_land, supgr, pupgr, lupgr): Use them.
Upgrading planes no longer sets plane range to maximum.

(pupgr): Just clear the mission, don't bother to clear op area.

(doship, doplane, dounit): Editing tech now updates stats, like an
upgrade command.  Proper range checking.
(warn_deprecated): New.
(pr_ship, doship): Deprecate key 'D'.
(pr_land, dounit): Deprecate key 'A' and 'D'.
2004-05-16 14:19:38 +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
b665d57de1 Should have been committed yesterday, together with sona.c. 2004-05-10 20:20:50 +00:00
ca80c373bf (comstr, buy, check_market, display_mark, reset, sell): Change comstr
member com_type from mnemo character to item type.
(whichitem): Unused, remove.

(check_market): Use full item name instead of mnemo in telegrams.

(display_mark): Separate arguments for item type and cheapest only.
Cheapest only of specific item type is not implemented.

(rese): Guard against bad com_type.  Delete some code that had no
effect.
2004-04-10 18:48:30 +00:00
60bbb6b0c0 (buy, mark, display_mark): Move argument evaluation from
display_mark() to callers.  buy() no longer accepts "all".  It used to
display all lots, but didn't let you buy any.  Similar nonsense
happened for "" if buy() prompted for it.

(display_mark): Fix size of cheapest_items[].

(player_coms): Document mark accepting "all".
2004-04-10 08:43:19 +00:00
e42f7e8210 (build_ship, orde, qorde, nav_loadship, load_it, unload_it): Store
item types instead of mnemo characters in shpstr members shp_tstart[]
and shp_tend[].
(com_num): No longer used, remove.

(orde): Simplify swap code.

(prhold): New, factored out of qorde().
2004-04-08 19:14:09 +00:00
5d302eaad5 (strtox, strtoy): New. Use it instead of inputxy() to avoid the
double-remainder problem: x-coordinate SHRT_MAX+1 is truncated to 0 by
cast to coord, then converted by xabs().  This is wrong unless WORLD_X
divides SHRT_MAX+1.
(sarg_xy, sarg_getrange, sarg_range): Use them.
(inputxy): No longer used, remove.

(sarg_type): Use NS_UNDEF instead of 0.

(sarg_list): Change confusing loop control.  Properly diagnose
overlong lists; used to silently ignore list tail and return MAX+1,
which made a later snxtitem_list() fail.

(atoip): No longer used, remove.  Parsing was broken anyway.

(sarg_type, sarg_xy, sarg_area, sarg_range, sarg_list, sarg_getrange):
Use plain char * instead of s_char *.
2004-04-07 17:13:47 +00:00
543b0cba4f (NS_UNDEF, NS_LIST, NS_DIST, NS_AREA, NS_ALL, NS_XY, NS_GROUP): Turn
macros into enumeration constants.
(ns_seltype): New.  Use where appropriate.
2004-04-06 21:37:52 +00:00
acdee1e3b6 (weekday, daytime, daytime_range): New; replace kw_parse(). Parsing
is somewhat stricter.
(is_wday_allowed, is_daytime_allowed, is_daytime_nar,
min_to_next_daytime): New.
(demand_update_time, scheduled_update_time, next_scheduled_time,
update_time, gamehours): Use them to replace kw_parse().
(kw_parse): No longer used, remove.
2004-04-04 15:52:26 +00:00
ded3daf70d (gamehours): All callers ignore the value assigned to hour[]. Remove
parameter.  Remove calls without effect.  Other callers changed.
2004-04-04 14:20:30 +00:00
2df3f002e1 (getminleft): Parameter hours unused since the previous rev., remove.
Change parameter mpd from int * to int, because its only use is *mpd
as r-value.  Callers changed.
2004-04-04 14:07:51 +00:00
47c8a32ae3 (debug): New.
(main): Set it on -d.
(oops, CANT_HAPPEN): New.
2004-04-02 15:40:43 +00:00
245b5a21e2 (getvec, putvec): No longer used, remove. 2004-03-11 22:08:16 +00:00