

			EMPIRE SUBS CHANGES



As much as possible, the game has remained semantically equivalent
to the earlier versions, despite great temptation to the contrary.
If things don't work the same way, and aren't mentioned here, then
it's probably a bug.


Interface changes:


bridgefall(sp)
	called with a sector pointer instead of x,y. 

caploss(sp, cnum, msg)
	called with a sector pointer instead of x,y

sectdamage(sp, dam)
	called with sector pointer instead of x,y
	uses new vl_ routines -- see variable-list

detonate_orbit(type, x, y, owner)
	called from detonate() in order to seperate out
	all the satellite cruft.

disloan(n, lp)
	called with loan pointer in addition to loan id.

distrea(n, tp)
	called with treaty pointer in addition to treaty id.

logerror(msg)
	NEW routine which does a "pr", logs a message to a file,
	and sends notification to the deity of the problem.
	Only one message will be sent per nation-session.
	This may still send too many messages.  Hmm.  Maybe
	disable the mail function?

ef_xxx(xxx)
	NEW subroutine library for accessing empire record
	format files.  See attached document on empire-files.

fortdef(sp, ac, tx, ty)
defdef(sp, ac, tx, ty)
shootback(sp, ac, tx, ty)
	called with sector pointer instead of x,y.

blksize(fd)
	NEW routine returns filesystem block size of fd.

getvar(vtype, sp, ptype)
putvar(vtype, amt, sp, ptype)
	no interface change.  Uses new vl_ code.  See variable-list.

getvec(mask, sp, ptype, vec)
	NEW routine, returns vector filled with the VT_TYPE of
	whatever mask is passed to getvec.  See documentation
	on variable-list (vl_getvec).

stmtch(obj, base, off, size)
	changed from prev langston code.  Works with saber now.
	Nobody is probably that interested though.

intmtch(value, ptr, size)
	NEW routine.  probably uninteresting though.

nstr_comp(np, size, type, str)
nstr_exec(conds, ncond, ptr, type)
	NEW routines for compiling and executing comparisons
	of empire nstr conditionals.  You know, " ?des=a&eff>20 " ...


nxtitem(np, ptr)
snxtitem(np, type, str)
snxtitem_area(np, type, range)
snxtitem_dist(np, type, cx, cy, dist)
snxtitem_all(np, type)
snxtitem_list(np, type, list, len)
	NEW routines for setup and selection of generic empire
	data structure called "item".  This is for planes, ships,
	treaties, loans, etc.  Uses buffered reads, very efficient,
	it's your friend.  See the associated docs on selection.

nxtsct(np, sp)
snxtsct_area(np, type, range)
snxtsct_dist(np, type, cx, cy, dist)
snxtsct_all(np, type)
	called with sector pointer instead of using static pointer.
	Also uses buffered reads.  Also your friend.

xxx_postread(n, ptr)
xxx_prewrite(n, ptr)
	NEW routines, possibly one for each empire item.  They are
	called from the empire-files routines for post-read and pre-write
	data massage.

pr()
	Now uses vsprintf exclusively.  If you don't have vsprintf,
	you'll lose.

sarg_xxx()
	Determines what kind of selection argument was passed.
	Valid types are "#1", "-10:10,-5:5", "1/2/3/4/5", "*",
	and "@2,2:10".  See the code for details.


tm_xxx
	Code moved into SUBS.  Arguments changed around.  tm_filter
	removed.  Hopefully nobody notices the changes.

trdsub
	Trade subroutines removed.  Commodity code still present.


typematch(buf, ef_type)
	NEW routine... match type of ef_item given string.


vl_find(type, typevec, amtvec, nelem)
vl_set(type, amt, typevec, amtvec, nvp, max)
vl_getvec(src_type, src_amt, src_nv, mask, dst_amt)
vl_damage(pct, typevec, amtvec, nelem)
	NEW routines for managing the variable lists.
	See variable-list documentation for details.

xyas(x, y, cnum)
	NEW routine -- return "sprintf" of x,y coords as a
	particular cnum.

xrel(absx, cnum)
yrel(absx, cnum)
xabs(relx, cnum)
yabs(rely, cnum)
	NEW routines...convert nation-relative coordinates to
	absolute coords, and abs coords back into relative coords

xnorm(x)
ynorm(y)
	NEW routine...normalize x,y coordinates.


Structures changes:

All characteristics structures now use integers to describe the various
attributes, for both speed and expandability.

There is a CASTR structure for each empire-file record type, although
currently only the ship, plane, nuke, and sector castr structures
are actually used.  Castr structs are used by the snxt/nxt item/sector
selection combo, for determining conditional selection -- the condarg
stuff.

Treaties no longer have the involved negative-countrynum setup for
pending treaties.  They now use flag settings.  See the treaty.h file,
as well as the trechk subroutine.  (trechk has not been tested; it may
well be buggy).

In general, you should not have to declare any global variable as
an extern.  (there are exceptions, of course)  Look through the include
files in EMP/h for the proper definition.  Likewise, many routines have
been extern'ed in misc.h and the various files like sect.h, ship.h,
etc.  When in doubt, look in *.h and see if it's already there.

Some defines and macros have been moved around, or removed completely.
This is usually for a reason.  If you don't see something, DON'T just
go and add it.  Try and figure out why it was removed.  Specifically,
COMS routines should NOT be doing any file opening, reading, writing,
or anything of that nature.

The sector map is gone.  Remove all references to setown(), setdes(),
sectown() and sectdes() and replace them with the proper modification
to the sector struct itself.

It should be possible to remove the limitation of "powers of two" from
the world_x/world_y pair now...I stamped out all the dependencies
I ran across.  Someone should most assuredly test this.


In UTIL/ the only programs that are up-to-date are file.c, ore.c,
and land.c for the simple reason that I used them for testing purposes.
They are by no means cleaned up...they just work.

There are two example routines I've converted (and tested) to use the
new library set.  They are shi.c, and cens.c.  I probably picked the
easiest ones, yes.  However, they do demonstrate the three new major
additions to the SUBS library, so it was an appropriate choice.


Sat Mar 11 17:59:42 PST 1989

