Ron Koenderink [Fri, 29 Oct 2004 01:38:06 +0000 (01:38 +0000)]
(dchr): Negative d_cost now means that only deity can designate.
(nullify_objects, do_desi): Simpify designate restrictions of options
NO_LCMS, NO_HCMS, NO_OIL.
(show_sect_build): Suppress printing of sectors only deity can
designate. This was broken in rev. 1.15.
Marc Olzheim [Tue, 12 Oct 2004 20:25:33 +0000 (20:25 +0000)]
(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.
Marc Olzheim [Tue, 12 Oct 2004 19:48:53 +0000 (19:48 +0000)]
(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.
(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.
(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.
Marc Olzheim [Thu, 16 Sep 2004 21:18:01 +0000 (21:18 +0000)]
(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.
(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.
(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.
Ron Koenderink [Tue, 7 Sep 2004 14:04:19 +0000 (14:04 +0000)]
(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.
(tran_plane): Fix major, abusable bug: getsect() before move_ground(),
putsect() afterwards. This allowed two cooperating countries to
duplicate items.
(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.
(ANNO_KEEP_DAYS, anno_keep_days): Replace macro ANNO_KEEP_DAYS by
new configuration key. Closes #780425.
(delete_old_announcements): Do nothing when anno_keep_days is
negative.
(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.
Ron Koenderink [Sat, 28 Aug 2004 13:52:20 +0000 (13:52 +0000)]
(show_land_build, show_plane_build): Adjust the position of the $ column to match
'show ship b'. Adjust the crew column (show_plane_build) and the adjacent columns
to be right-justified.
(min_to_next_daytime): Happily returned zero if DTIME happend to be in
TIMES. This can make callers fire another update right away, possibly
several times. Observed for update policy UDP_TIMES while updates
were disabled, which makes them complete in much less than a second.
Fills up server.log real fast. Fix to consider DTIME tomorrow.
(IPKG): New.
(ichr): Set IPKG packing bonus for all sectors to 1.
(move): Use it. No functional change.
(deliver, dodistribute): Use it. Inefficient sectors now get IPKG
instead of NPKG packing bonus, cutting civilian packing bonus from 10
to 1.
(dodistribute): Export uses the better of sector or distribution
center packing bonus. Previously, it assumed that distribution center
WPKG packing is always best. Which is currently true, but needlessly
breaks the abstraction.
(NSC_EXTRA): New.
(sect_ca, NSC_GENITEM, plane_ca, land_ca): Use it for aliases and
cached functions of tech.
(xdflds, xdfldnam): Skip NSC_EXTRA fields.
Ron Koenderink [Sat, 21 Aug 2004 00:44:20 +0000 (00:44 +0000)]
(delete_old_announcements, copy_and_expire): Split off
copy_and_expire() to simplify cleanup. Previously, cleanup was
missing or incomplete on many less common code paths, which leaked
file descriptors and memory, and could corrupt the anno file. Use
stdio instead of POSIX I/O for writing. Check for I/O errors
properly. Treat bad telegram type just like bad telegram length (give
up). Closes #1013234.