Commit graph

4465 commits

Author SHA1 Message Date
Ron Koenderink
9faba52ba4 (main, termio): Add the ability to set the username.
Get it from environment variable LOGNAME if set,
else get the user name from the system.

(main) [_DWIN32]: Add stdin redirection ability to the Win32 port.
The client reads until stdin redirection empty and then terminates.
2004-10-19 01:11:31 +00:00
Marc Olzheim
39facfbf53 (var.h, plague.h): Since all that was left in var.h were some plague
defines, import these defines into plague.h, drop var.h and include
plague.h where appropriate.
Remove some 'register' keywords at the same time.
No functional changes.
2004-10-12 20:25:33 +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
Marc Olzheim
442803c30a (i_type, I_NONE): shift the enum down 1, so that I_NONE does not need to
be skipped or stored in arrays of size I_MAX. I_NONE's int equivalent
becomes -1 by this patch, so all array indices of type i_type have been
checked not to use I_NONE as index.  This change reduces the size of the
arrays stored in files.
2004-10-12 19:48:53 +00:00
Marc Olzheim
19e4dc57ed (i_type): one patch too many in the previous commit. No functional changes. 2004-10-12 15:55:10 +00:00
ea4943d0bd (ac_encounter): Ignore embarked land units when checking for planes
overflying land units.  Reported by Doug Wescott.
2004-10-05 18:49:59 +00:00
bf6f2162e8 (new): When first sanctuary is a wilderness, but second isn't, code
complained about the first one.
2004-10-05 18:45:49 +00:00
c85f674059 (mcost): Unused, remove. 2004-10-05 18:41:18 +00:00
Ron Koenderink
1b8eaffce4 (info): Don't leak potentially sensitive information to player in
error messages.  Properly log all system errors and return RET_SYS.
Closes #1028552.

(info): Fix use of uninitialized variable when fopen() succeeds but
fstat() or the st_mode check fails.

(info) [_WIN32]: Fix '//' to be '\\'.  Add file type check to prevent
opening hidden or operating system files.
2004-10-05 01:17:08 +00:00
Ron Koenderink
d895fe1d00 Remove the unused/not needed code. 2004-10-03 16:16:05 +00:00
1e1f8088a8 (item_prewrite): New.
(checksect, shp_prewrite, lnd_prewrite): Use it.
2004-09-19 07:56:57 +00:00
311ad32a88 (shoo): Code to enfore the mobility limit assumed double m were
integer.  When 5 * sect.sct_mobil - 4 < nshot < 5 * sect.sct_mobil,
nshot was rounded up to the next multiple of 5.  This could shoot more
people than present, resulting in negative population.  Before
rev. 1.3, putvar() swept this error under the rug.
2004-09-19 07:16:44 +00:00
e8a089fe14 (load_it): Loaded negative amount if ship had more cargo than ordered.
This can happen when unload_it() can't unload, e.g. because sector is
full.  This can push the sector's amount beyond ITEM_MAX, and can even
overflow to negative amounts.
2004-09-17 13:06:08 +00:00
67480d040d (dodistribute): Import could export a civilian when the dist center
didn't have any.
2004-09-17 12:58:51 +00:00
786418ae02 (ac_doflak): Don't supply more shells than actually required for flak. 2004-09-17 12:56:48 +00:00
f12043a1f1 Doc fix. 2004-09-17 12:55:52 +00:00
57bea595cd (scra): Obey ITEM_MAX. 2004-09-17 12:55:33 +00:00
8b8fba25ed (multifire): Remove some dead code. 2004-09-17 12:54:49 +00:00
5cb994b4fe (do_demo): Simplify. 2004-09-17 12:54:14 +00:00
Marc Olzheim
44433afac6 (dchr): Init the packaging of trailing dummy structs with IPKG instead
of 0.  No functional change.
2004-09-17 09:22:12 +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
308430e751 Fix the previous rev. 2004-09-12 05:00:48 +00:00
aa6ad9d791 (NSC_SITYPE): New.
(dchr_ca): Use it to fix selector pkg's ca_type.
2004-09-11 15:25:38 +00:00
675fcd388a (sect_ca, ship_ca, plane_ca, land_ca, nuke_ca): Make selector coastal,
nplane, nland, nchoppers, nxlight, timestamp NSC_EXTRA.
2004-09-11 12:50:32 +00:00
32011f1d49 (ship_ca): New selectors xstart, xend, ystart, yend, cargostart,
cargoend, amtstart, amtend (for order) and mobquota, path, follow (for
sail).
(news_ca): New selector uid.
Selectors are now believed to be complete, except for nat_ca[], which
is not used.
2004-09-11 09:36:14 +00:00
630e8e105a (valstr, nstr_exec, nstr_comp_val, nstr_exec_val, xdprval): Support
strings with length limit instead of zero termination.
(ship_ca, land_ca): New selectors rflags, rpath.  The latter is such a
string.
2004-09-11 08:45:17 +00:00
66eaa28f92 (comtch, stmtch): Make more similar, document. No functional changes. 2004-09-10 19:36:02 +00:00
18fdb41bd0 Doc fix. 2004-09-10 19:04:05 +00:00
d446db0ac1 (mchr_ca, lchr_ca): Fix selector flag's ca_type.
(xdprval): Make sure floating-point numbers always contain a decimal
point, so they're easily distinguished from integers.
2004-09-10 18:58:30 +00:00
7d34832100 (fldoff): Use offsetof() instead. Rest of struct.h is unused, remove. 2004-09-10 18:41:58 +00:00
65bb65f63d (plnstr): Member pln_fuel was always equal to plchr[pln_type].pl_fuel.
Replace all uses, so pln_fuel can be removed later.
2004-09-10 18:27:53 +00:00
9dbc1cb5e3 Use plain char * instead of s_char *. 2004-09-10 18:18:31 +00:00
fac342ed49 Update copyright notice. 2004-09-07 15:07:16 +00:00
351a4f6d2f Fix incomplete comment. 2004-09-07 14:16:36 +00:00
0f7097c319 Update for 4.2.18. 2004-09-07 14:16:24 +00:00
Ron Koenderink
9e670d8dc7 (info): `info' was not checking for all types of common files in
Windows, therefore could miss info files depending on the status
(archive, read-only).  Also changed the error message to user to
provide a more accurate description of the problem.  Closes #1018297.
2004-09-07 14:04:19 +00:00
7f73d82073 Explain roots of LWP. 2004-09-07 08:49:46 +00:00
532d3051b6 Unused, remove. 2004-09-07 08:47:00 +00:00
5bd904f825 (tran_plane): Fix major, abusable bug: getsect() before move_ground(),
putsect() afterwards.  This allowed two cooperating countries to
duplicate items.

(tran_plane): Don't report interdiction damage twice.

(tran_plane): Simplify loop collecting planes.
2004-09-07 06:34:08 +00:00
d4fe345edb (news): Add a comment to explain why argument is ignored when HIDDEN
is on.
2004-09-07 06:16:23 +00:00
b3730786b5 (mchr_ca): Add missing entry for member `frnge'.
(xdprval): Silence compiler warning.
2004-09-07 06:12:15 +00:00
3dc73b39d2 (NEWS_PERIOD, news_keep_days): Replace macro NEWS_PERIOD by new
configuration key news_keep_days.
2004-09-04 19:32:48 +00:00
2dd13e096d (xdprval): Fix escaping of negative characters. 2004-09-04 13:11:02 +00:00
0262aaf464 (xdprval): Escape the space character so that a line can be simply
split into fields at space.
2004-09-04 08:15:33 +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
4798d1466b (xdprval): Fix for strings containing backslashes. 2004-08-31 17:53:34 +00:00
5346422665 (xdprval): Fix for strings with characters printed as escapes. Print
null pointer as `nil' to distinguish it from empty string.
2004-08-31 17:45:45 +00:00
7a4f133d1c (hard_tech): Unused, remove.
(configkeys): Fix km_flags of key anno_keep_days.
2004-08-30 21:12:15 +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