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 x

⟦c9c9106e3⟧ TextFile

    Length: 4257 (0x10a1)
    Types: TextFile
    Names: »xstatus.c«

Derivation

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

TextFile

/*
 * $Header: xstatus.c,v 3.0 88/03/10 12:08:10 hale Exp $
 */

/*

        Copyright 1987      Greg Hale

Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation.  No representations are made about the
suitability of this software for any purpose.  It is
provided "as is" without express or implied warranty.

*/


#include "xgo.h"

extern int demflg;

#define WACCEPT 0
#define WDECINE 1
#define WSCORE 2
#define WQUIT 3
#define WTALLY 4
#define WPASS 5
#define WCANCEL 6
#define WPLAY 7
#define WEXIT 8
#define WSWITCH 9
#define WSHOW 10
#define WRES 11
#define WSAVE 12
#define WLOAD 13
#define WCLEAR 14

#define ACT(x) act[x][0]=1
#define ISACT(x) act[x][0]
#define WASACT(x) act[x][1]
#define redraw(x) if (!WASACT(x))
#define iferase(x) if (WASACT(x) && !ISACT(x))
static act[20][2];


extern int loadflg;

updact()
{
	int i;
	for (i=0; i<20; i++) {
		act[i][1] = act[i][0];
		act[i][0]=0;
	}
}

AreWe(s)
int s;
{
	return (status & s);
}

SetStat(s)
int s;
{
	status = status | s;
	switch (s) {
		WHEN HANDICAP:
			updact();
			ACT(WPLAY);
			ACT(WSWITCH);
			ACT(WEXIT);
			ACT(WRES);
			ACT(WSAVE);
			ACT(WLOAD);
			ACT(WCLEAR);
			UnmapAll();
			redraw(WPLAY) XMapWindow(Wplay);
			redraw(WSWITCH) XMapWindow(Wswitch);
			redraw(WEXIT) XMapWindow(Wexit);
			redraw(WRES) XMapWindow(Wresign);
			redraw(WSAVE) XMapWindow(Wsave);
			redraw(WCLEAR) XMapWindow(Wclear);
			if (loadflg) redraw(WLOAD) XMapWindow(Wload);
		WHEN SCORE:
			updact();
			ACT(WQUIT);
			ACT(WEXIT);
			ACT(WTALLY);
			ACT(WCANCEL);
			ACT(WRES);
			ACT(WSAVE);
			ACT(WLOAD);
			redraw(WCLEAR) XMapWindow(Wclear);
			UnmapAll();
			redraw(WQUIT) XMapWindow(Wquit);
			redraw(WEXIT) XMapWindow(Wexit);
			redraw(WTALLY) XMapWindow(Wtally);
			redraw(WCANCEL) XMapWindow(Wcancel);
			redraw(WRES) XMapWindow(Wresign);
			redraw(WSAVE) XMapWindow(Wsave);
			if (loadflg) redraw(WLOAD) XMapWindow(Wload);
		WHEN QUIT:
			updact();
			ACT(WEXIT);
			ACT(WACCEPT);
			ACT(WDECINE);
			UnmapAll();
			redraw(WACCEPT) XMapWindow(Waccept);
			redraw(WEXIT) XMapWindow(Wexit);
			redraw(WDECINE) XMapWindow(Wdecline);
		WHEN PLAY:
			updact();
			ACT(WEXIT);
			ACT(WPASS);
			ACT(WSCORE);
			ACT(WSHOW);
			ACT(WRES);
			ACT(WSAVE);
			ACT(WLOAD);
			UnmapAll();
			redraw(WPASS) XMapWindow(Wpass);
			redraw(WSCORE) XMapWindow(Wscore);
			redraw(WEXIT) XMapWindow(Wexit);
			redraw(WSHOW) XMapWindow(Wshow);
			redraw(WRES) XMapWindow(Wresign);
			redraw(WSAVE) XMapWindow(Wsave);
			if (loadflg) redraw(WLOAD) XMapWindow(Wload);
		DEFAULT: ;
	}
}

UnmapAll()
{
	iferase(WACCEPT) XUnmapWindow(Waccept);
	iferase(WDECINE) XUnmapWindow(Wdecline);
	iferase(WSCORE) XUnmapWindow(Wscore);
	iferase(WQUIT) XUnmapWindow(Wquit);
	iferase(WTALLY) XUnmapWindow(Wtally);
	iferase(WPASS) XUnmapWindow(Wpass);
	iferase(WCANCEL) XUnmapWindow(Wcancel);
	iferase(WPLAY) XUnmapWindow(Wplay);
	iferase(WEXIT) XUnmapWindow(Wexit);
	iferase(WSWITCH) XUnmapWindow(Wswitch);
	iferase(WSHOW) XUnmapWindow(Wshow);
	iferase(WRES) XUnmapWindow(Wresign);
	iferase(WSAVE) XUnmapWindow(Wsave);
	iferase(WCLEAR) XUnmapWindow(Wclear);
	if (loadflg) iferase(WLOAD) XUnmapWindow(Wload);
}

ClrStat(s)
int s;
{
	status = status & ~s;
}
\f


/*
 * $Log:	xstatus.c,v $
 * Revision 3.0  88/03/10  12:08:10  hale
 * Added save games, a few changes to the I/O,
 * added load and clear options.  Not thouroughly tested, though, and
 * I think a few bugs are in the load code.  A library of sample problems
 * has been started and saved with the working directory.
 * 
 * Revision 1.4  88/02/19  13:49:47  hale
 * Added io changes for loading games.
 * Load game is cleaned up.  Variable board
 * sizes and formats available in save game
 * as well as printed comments.
 * 
 * Revision 1.3  88/02/14  00:23:33  hale
 * Added load file option during game to restore game to starting
 * state.  Also, clear board operation.  Restoring game puts current
 * player in sync.  With the demo mode, this is invaluable.
 * 
 * Revision 1.2  88/02/13  12:55:14  hale
 * added logging.
 * 
 */