access. This is correct, because the old code doesn't use the copy
after it changes the original in the unit structure.
(dd): Remove call of getvec() that has no effect.
getvec(). This is safe, because the old code made single copies and
always flushed them back into the unit structures before flushing
those, in use_ammo(), or discarded both the copy and the unit
structure.
getvec(). This is safe, because the old code made single copies and
always flushed them back into the unit structures before flushing
those. To do: obey ITEM_MAX.
constituents in sector. Work directly on item arrays instead of
copies made by getvec(). This is safe, because the old code made
single copies and always flushed them back into the unit structures
before flushing those.
of copies made by getvec(). This is safe, because the old code made
single copies and always flushed them back into the unit structures
before flushing those.
getvec(). This is safe, because the old code made single copies and
always flushed them back into the unit structures before flushing
those.
(build_ship, build_land, build_bridge, build_nuke, build_plane,
build_tower): Change parameter type to match uncopied item arrays.
them. From Marc Olzheim.
Type modifier 'l' was missing in many places, probably rendering the
server useless on 64-bit hosts.
(ef_flush, ef_write, ef_extend, lwpCreate, lwpDestroy): Use conversion
specifier 'p' to print pointers.
(check_market): Fix display of loan amount.
(doland): Fix unescaped '%' (undefined behavior).
(ldump, ndump, pdump, sdump): Don't use flag '0' with conversion
specifier 's' (undefined behavior).
(dump, ldump, lost, ndump, pdump, sdump, empth_create, update_sched):
Cast time_t and pthread_t to long for printing.
(lwpStackCheck, lwpStackCheckUsed, finish_sects): Insert cast to fix
argument type on all platforms.
(prod): Remove extra argument.
(perform_mission, airdamage, retreat_land1, lwpReschedule): Format
string missed arguments.
(pr_land): Fix display of attack and defense value.
(dounit): New parameter farg. Callers changed. Use it to implement
attack and defense value editing. Closes#872271.
(pr_ship): More space efficient display.
(pr_ship): Display defense value.
(doship): Implement defense value editing.
item arrays instead of copies made by getvec(). This is safe, because
the old code made single copies and always flushed them back into the
unit structures before flushing those.
Currently, use_supply() is only called for artillery, where the
trickery is not needed, so this fix isn't observable. Not sure whether
it would be needed if use_supply() were called for supply units.
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.
With variables, item increases beyond the capacity of variables
(65535) were ignored here.
This should cover all item changes not going through putvec().
(give, deliver_it): Use it instead of 9990.
(load_comm_ship, load_comm_land, rese): Use it instead of 9999.
(thre): Use it instead of 10000.
(check_market, explore, move, pln_dropoff): Use it instead of 32767.
(unload_it): Use it instead of 99999 (which couldn't possibly work,
but what do you expect from the autonav code).
(doland, detonate, spread_fallout): Use it. With variables, fallout
beyond the capacity of variables (65535) was ignored, except in
doland(), where it saturated at 9999, and spread_fallout, where it
could overflow. Now it always saturates at FALLOUT_MAX.
(doland, mine, landmine, setsector, pln_dropoff): Use it. With
variables, mining beyond the capacity of variables (65535) was
ignored. Now the mines saturate at MINES_MAX.
Simplify. Split into member sct_che (number) and sct_che_target.
Users changed.
(get_che_cnum, set_che_cnum, get_che_value, get_che_value): Che
encoding/decoding functions; remove.
(CHE_MAX): Move from var.h to sect.h.
(prsect, doland): Print / edit the new field.
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".