DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T s

⟦cff56c9be⟧ TextFile

    Length: 1169 (0x491)
    Types: TextFile
    Names: »savelev.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Ularn/savelev.c« 

TextFile

/* savelev.c	*/
#include "header.h"

extern struct cel *cell;

/*
 *	routine to save the present level into storage
 */
savelevel()
{
	struct cel *pcel;
	char *pitem,*pknow,*pmitem;
	short *phitp,*piarg;
	struct cel *pecel;

	pcel = &cell[level*MAXX*MAXY];	/* pointer to this level's cells */

	/* pointer to past end of this level's cells */
	pecel = pcel + MAXX*MAXY;	

	pitem=item[0]; 
	piarg=iarg[0]; 
	pknow=know[0]; 
	pmitem=mitem[0]; 
	phitp=hitp[0];
	while (pcel < pecel) {
		pcel->mitem  = *pmitem++;
		pcel->hitp   = *phitp++;
		pcel->item   = *pitem++;
		pcel->know   = *pknow++;
		pcel++->iarg = *piarg++;
	}
}

/*
 *	routine to restore a level from storage
 */
getlevel()
{
	struct cel *pcel;
	char *pitem,*pknow,*pmitem;
	short *phitp,*piarg;
	struct cel *pecel;

	pcel = &cell[level*MAXX*MAXY];	/* pointer to this level's cells */

	/* pointer to past end of this level's cells */
	pecel = pcel + MAXX*MAXY;	

	pitem=item[0]; 
	piarg=iarg[0]; 
	pknow=know[0]; 
	pmitem=mitem[0]; 
	phitp=hitp[0];
	while (pcel < pecel) {
		*pmitem++ = pcel->mitem;
		*phitp++ = pcel->hitp;
		*pitem++ = pcel->item;
		*pknow++ = pcel->know;
		*piarg++ = pcel++->iarg;
	}
}