abermud/DATA/
/* Fast File Controller v0.1 */
#include "kernel.h"
#ifdef	RCSID
static char RCS[] =
	"$Header: opensys.c,v 1.1 89/03/13 09:37:25 rsalz Exp $";
#endif	/* RCSID */


closeworld()
{
    if (spawned || filrf == NULL)
	return;
    sec_write(filrf, objinfo, 400, 4 * numobs);
    sec_write(filrf, ublock, 350, 16 * 64);
    sec_write(filrf, (int*)shimge, 390, 16);
    sec_write(filrf, (int*)globaldata, 391, 128 * sizeof (short) / sizeof (int));
    closelock(filrf);
    filrf = NULL;
}

FILE *
openworld()
{
    if (spawned)
	return NULL;
    if (filrf != NULL)
	return filrf;
    if ((filrf = openlock(UNIVERSE, "r+")) == NULL)
	crapup("Cannot find World file");
    sec_read(filrf, objinfo, 400, 4 * numobs);
    sec_read(filrf, ublock, 350, 16 * 64);
    sec_read(filrf, (int*)globaldata, 391, 128 * sizeof (short) / sizeof (int));
    sec_read(filrf, (int*)shimge, 390, 16);
    return filrf;
}