(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.
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.
oprange, show_mission, nameofitem, build_mission_list_type,
unit_map, xdvisible, trdswitchown, ontradingblock, trad, check_trade,
unit_type_name, start_stop_unit, scut, scra, mission, multifire,
perform_mission, fuel, NSC_GENITEM): Replace struct genitem with
struct empobj. Remove genitem.h and create a new file empobj.h.
Replace multiple instances of unions of ef_type structures with
one standard union empobj_storage which is a superset of the individual
instances.
short, to match shp_item and lnd_item.
(mchr_ca, lchr_ca): Replace selector item by selectors for the items.
lchr_ca's item selector was incorrect and worked only by accident.
Add M_CANAL flag to indicate which ships can navigate a canal
in a big city. Remove the hard code values for canal from
shp_nav_one_sector() for which ships can navigate a canal.
Set M_CANAL flag in ship_chr_flags[] to match the hard
coding in shp_nav_one_sector().
Update Ship-types.t with new canal flag.
Update Sector-types.t to indicate that cities have canals.
Useless, remove. Users changed to check mchr's sentinel, because
that's clearer than comparing the index to N_MAXSHIPS or sizeof(mchr)
/ sizeof(*mchr).
(mchr): Change sentinel's m_name to NULL.
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.
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.
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.
NUK_BLD_WORK): New, to encapsulate the formula in one place.
(SCT_MINEFF): New. Use it instead of literal 20.
(buil): Use CANT_HAPPEN() for internal error.
(build_ship, build_land, build_bridge, build_nuke, build_plane,
build_tower): Simplify avail calculation.
(lupgr, supgr, pupgr): Charge 15% of total build avail instead of an
undocumented amount computed from build lcm and hcm.
(build_ship, build_land, build_bridge, build_nuke, build_plane,
build_tower, lupgr, supgr, pupgr): Fix reporting of required avail
when there's not enough. Closes#942823.
(lupgr, supgr, pupgr): Code printed cost rounded down, but required
and charged unrounded cost. Confusing. Round cost down, like the
build command. Closes#942811.
(UPGR_COST, UPGR_EFF, lupgr, supgr, pupgr): New UPGR_COST, UPGR_COST replace
literal values.
(show_bridge, show_tower): Don't claim bridge building requires
`workers' (whatever that is), since it doesn't.
item storage. Rationale: Permitted values are 0..M, where M depends
on the container. The largest M is ITEM_MAX (9999). Benign
overflow/underflow occurs at those limits. Catastrophic
overflow/underflow occurs at the limits of the underlying data type.
For `unsigned short', any underflow is catastrophic. For `short',
benign undeflow happens long before catastrophic underflow. Moreover,
unsigned arithmetic tends to trip up unwary programmers.
To save space, the ancients invented `variables': a collection of
key-value pairs, missing means zero value, space for `enough' keys.
This complicates the code, as assigning to a `variable' can fail for
lack of space. Over time, `enough' increased, and for quite some time
now `variables' have been *wasting* space. This changeset replaces
them, except in struct mchrstr, struct lchrstr and struct pchrstr,
where they are read-only, and will be replaced later. It is only a
first step; further cleanup is required. To simplify and minimize
this necessarily huge changeset, the new item[] arrays have an unused
slot 0, and the old variable types V_CIVIL, ... are still defined, but
must have the same values as the item types I_CIVIL, ...
(genitem_ca, ship_ca, plane_ca, land_ca): Remove selector "sell".
(comstr, trdstr): Members trd_price, com_price have no effect. Use
them instead of trd_maxprice, com_maxprice and remove the latter.
(commodity_ca, trade_ca): Remove selector "maxprice".
between headers. Code is now fully prototyped and compiles cleanly
with gcc -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
-Wredundant-decls. Closes#723788.
thread entrypoints:
(lwpSelect, shutdown_sequence): Parameters didn't match thread entry
point prototype.
(lwpEntryPoint): Arguments didn't match thread entry point prototype.
Change linkage of functions without prototype declaration to static
where possible.
Remove some superflous declarations, replace others by suitable
includes.