Commit graph

74 commits

Author SHA1 Message Date
Ron Koenderink
c7f940a84e Move WIN32 equivalent function defines to w32/w32misc.h from misc.h.
Move Microsoft C compiler warning to w32/w32misc.h from misc.h.
2007-08-15 02:15:17 +00:00
Ron Koenderink
287aa9d162 (ssize_t, pid_t) [_WIN32]: Move from misc.h to POSIX's location
in unistd.h.
2007-08-15 01:48:40 +00:00
Ron Koenderink
9c666a7423 Create w32misc.h to contain information that does not fit in Windows
equivalent include file.
(strptime) [_WIN32]: Add extern for WIN32 equivalent for strptime().
2007-08-15 01:16:26 +00:00
Ron Koenderink
7bb0a04db2 [_WIN32] (S_IRUSR, S_IWUSR, S_IXUSR, S_IRWXU, S_IRGRP, S_IWGRP)
(S_IXGRP, S_IRWXG, S_IROTH, S_IWOTH, S_IXOTH, S_IRWXO): Move from
include/misc.h to new src/lib/w32/unistd.h.
2007-08-14 03:38:18 +00:00
Ron Koenderink
e7b04123a9 [_WIN32] (posix_mkdir): New.
[_WIN32] (mkdir): Use it.  Last argument is no longer ignored, which
was a bug.  Move declaration to unistd.h, which isn't quite right, but
works for us.
2007-08-14 03:11:26 +00:00
335d9d34ab Include reshuffle. 2007-07-15 10:07:48 +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
Ron Koenderink
568ef6048d (S_IRUSR, S_IWUSR, S_IEUSR, S_IRWXU,
S_IRGRP, S_IWGRP, S_IEGRP, S_IRWXG,
S_IROTH, S_IWOTH, S_IEOTH, S_IRWXO) [_WIN32]:
Add #ifndef for standard defines as the the MinGW environment has the
user defines already created.  Correct EXEC permision to use S_IEXEC.
Set the group and other permssions to 0 as they do not exist in WIN32.
2007-03-11 21:29:37 +00:00
Ron Koenderink
c97d79c0ee (add, disa, ef_open, logerror, main): Switch permissions to
standard defines instead of magic numbers to improve portability.
Also define WIN32 equivalents to the standard defines.
2007-03-10 16:29:51 +00:00
d38fcc6cf4 (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.
2007-01-16 19:26:31 +00:00
63bdc89835 Update copyright notice. 2007-01-09 19:09:31 +00:00
Ron Koenderink
d413884a37 [_WIN32, __GNUC__]: Reorganize the include files for WIN32 to
separate the MinGW environment from the MSVC environment and
WIN32 environment.  Reorganize the order of the includes so
the system files are always loaded first to prevent with misc.h defines.
Remove system file includes from misc.h.
2006-07-13 21:14:16 +00:00
Ron Koenderink
fa38aef700 [_WIN32, __GNU__]: Use <string.h> for strncasecmp for MinGW.
MinGW environment has an issue with conversion of strncasecmp()
to support _WIN32 and a definition in <string.h> for strncasecmp().
2006-07-11 22:30:19 +00:00
e42053d928 Break inclusion cycle: prototypes.h and commands.h included each
other.  Ensure headers in include/ can be included in any order
(except for econfig-spec.h, which is special).  New header types.h to
help avoid inclusion cycles.  Sort include directives.  Remove some
superflous includes.
2006-07-10 06:37:23 +00:00
35758fe053 (empobj, empobj_storage): Incomplete declarations. Temporary band-aid
to work around circular inclusion.
2006-07-08 06:18:46 +00:00
Ron Koenderink
0e4eb6bf0a (install_service, info, apro) [_WIN32]: Convert to standard snprintf()
from _snprintf().

[_WIN32]: Add #define snprintf to convert to _snprintf for WIN32
Visual Studio.
2006-06-23 00:13:21 +00:00
4c4fdca42b Line breaks and other formatting issues. No functional changes. 2006-05-21 13:05:24 +00:00
2ae6be9af6 (num_teles, redir_fp, pipe_fp, exec_fd, sendeof, prompt, command)
(ac_intercept, all_missiles, ac_planedamage, ac_doflak, ac_landflak)
(ac_shipflak, ac_fireflak, can_fly, do_evade, att_calcodds)
(emp_setbitmap, lnd_hit_mine, conditions, get_wp, daemonize): Internal
linkage.
2006-05-20 13:54:45 +00:00
a292d6f98a Fix insufficiently parenthesized macro expansions. 2006-04-30 16:08:45 +00:00
0c8c169f88 (s_char): Remove. Use signed char for small integers, plain char for
characters.
2006-04-29 16:25:17 +00:00
6fee3f4535 (CANT_REACH): New. Use it instead of CANT_HAPPEN() where possible.
(oops): Cope with NULL argument passed by CANT_REACH().
2006-04-17 17:36:07 +00:00
8054aafb9a (u_char, u_short, u_int): BSDisms. Figuring out whether sys/types.h
defines them would be possible, but isn't worth the trouble.  Replace
by unabbreviated types.
2006-03-25 07:05:34 +00:00
376d87c3a0 (main): Don't use access() before mkdir() to check whether the
directory to be created exists, just check errno afterwards.

[_WIN32] (F_OK, W_OK, R_OK): Unused, remove.
2006-02-18 09:29:49 +00:00
2dcf1fd1c8 (MIN, MAX): Fix insufficiently parenthesized macro expansion. 2006-02-06 21:56:38 +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
Ron Koenderink
04a8b84592 (ship_bomb, deli, do_demo, fuel, grin, look_ship)
(ltend, multifire, quite_bigdef, mine, landmine)
(do_loan, prod, printdiff, sell, sona, stre)
(tend, fire_dchrg, vers, work, ac_planedamage)
(ac_shipflak, ask_off, get_mine_dsupport, att_fight)
(ask_move_in_off, detonate, sd, land_gun)
(land_unitgun, lnd_fort_interdiction, lnd_fortify)
(perform_mission, pln_mine, pln_mobcost)
(retreat_ship1, retreat_land1, shp_sweep)
(shp_fort_interdiction, shp_missle_defense)
(new_work, growfood, upd_land, land_repair)
(get_materials, do_mob_ship, do_mob_land)
(load_it, unload_it, prod_plane, produce)
(guerrilla, upd_buildeff, spread_fallout)
(upd_ship, ship_repair, min, dmin, MIN):
Remove min() and dmin() functions and replace
with a MIN macro in misc.h.  Remove local MIN
macros and use the new one in misc.h.  This
change removes the need for the special
case for _WIN32.

(fuel, look_ship, multifire, mission, sona)
(plane_sona, ef_open, player_accept, player_main)
(ac_dog, att_get_combat, calc_mobcost)
(ask_move_in_off, intelligence_report)
(build_mission_list_type, perform_mission)
(show_mission, use_supply, dodistribute)
(allocate_memory, max, dmax, MAX):
Remove max() and dmax() functions and replace
with a MAX macro in misc.h.  Remove local MAX
macros and use the new one in misc.h.  This
change removes the need for the special
case for _WIN32.
2006-01-12 14:23:55 +00:00
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
Ron Koenderink
5aba44f5f2 (min, max) [_WIN32, __GNUC__]: Add min and max macros for
mingw/gcc compile environment.  min/max are not included
in stdlib.h in mingw/gcc environment.
2006-01-01 16:02:48 +00:00
a5b8249e98 (mkdir): Parenthesize macro parameter in expansion. 2005-12-30 17:21:42 +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
b316861e9d Autoconfigure whether char is unsigned. 2005-12-28 23:10:26 +00:00
686eadad37 (att_mode, xyas, ownxy, prbuf): Get rid of s_char. Users changed.
(ATTRIBUTE): Don't disable use of gcc __attribute__ when s_char is
signed char.  All format strings are now char *.
2005-12-28 22:30:52 +00:00
69150d10fc (EMPTH_LWP, EMPTH_POSIX, EMPTH_W32): Define in config.h instead of
compiler command line.  Don't bother to conditionalize code in .c
files that are only compiled when their thread package is used.

(_EMPTH_LWP, EMPTH_LWP, _EMPTH_POSIX, EMPTH_POSIX, _EMPTH_WIN32)
(EMPTH_W32): Identifiers beginning with an underscore and an uppercase
letter are reserved for any use.  Rename.
2005-12-28 14:27:15 +00:00
b921d3c262 (MAXNOC): Move to config.h. Remove empty options.h. 2005-12-28 13:08:26 +00:00
Ron Koenderink
9dfbf74785 [_WIN32]: Add #ifndef __GNUC__ around the pragma as pragma is not
supported by gcc.
2005-12-26 02:53:23 +00:00
Ron Koenderink
373a08a0e0 (min, max) [_WIN32]: Change WIN32 to use windef.h.
It is present in both MSVC and MinGW environments.

(F_OK, W_OK, R_OK) [_WIN32]: Add #ifndef to allow
to operation in both MSVC and MinGW environments.
2005-12-25 00:59:57 +00:00
320322cda9 (oops): Move declaration to misc.h, to make CANT_HAPPEN() usable
with just misc.h included.
2005-12-05 22:13:35 +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
fdcbb5912d (budg): Create the capital/city name from the d_name field instead of
hard coding the strings.

(plurize): New.
2005-11-13 21:23:44 +00:00
Ron Koenderink
555de3100c (dchr_ca, packing, empfile): Add packing symbol table.
(sect_ca, ship_ca, land_ca, plague_stages, empfile):
Add plague stages symbol table.

(treaty_ca, loan_ca, agreement_statuses, empfile):
Add agreement status symbol table.
Combine treatystatuses (TS_FREE, TS_SIGNED and TS_PENDING)
and loan statuses (LS_FREE, LS_SIGNED and LS_PENDING)
into a single agreement status.

(pchr_ca, level, empfile): Add packing symbol table.
2005-11-13 12:27:02 +00:00
220ce8f00f Ultrix is no longer supported, remove special case. 2005-10-22 18:24:01 +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
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
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
345ad3dfe0 Update copyright notice. 2005-03-16 22:03:16 +00:00
Ron Koenderink
1f9b34dfdd (log_error) [_WIN32]: Remove ; from the #define for vsnprintf.
This part of the for changes to logerror().
2005-03-12 19:33:18 +00:00
Ron Koenderink
157395fcb2 (log_error) [_WIN32]: Add #define for vsnprintf to pick up
_vsnprintf from the WIN32 library for changes to logerror().

(main) [_WIN32]: Add typedef for pid_t to match WIN32 definition
for getpid().  This is required for the create_pidfile() changes.
2005-03-12 17:52:29 +00:00
09b481b30a [!POSIXSIGNALS]: Thoroughly obsolete, remove. This also gets rid of
an odd case where signals were not catched when debugging.

(main, empth_start): Using sa_handler with SA_SIGINFO is wrong.
Simply don't set SA_SIGINFO; the additional signal information is not
used anyway.
2005-03-12 12:20:50 +00:00
84b8189c13 (daemon, daemonize): Rename to avoid name clash with BSD's daemon().
(daemonize): Supply missing declaration.
2005-03-09 14:45:41 +00:00
0aaf0084aa (as_extend, as_costcomp, gen_power, powcmp): Fix non-portable function
cast.
(qsort_func_t): Unused, remove.
2005-02-24 18:47:26 +00:00