File:  [Research Unix] / researchv10no / games / trek / shield.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

# include	"trek.h"

/**
 **	shield and cloaking device control
 **/

CVNTAB Udtab[]
{
	"d",		"own",
	"u",		"p",
	0
};

shield()
{
	protect(SHIELD);
}

cloak()
{
	protect(CLOAK);
}

protect(sw)
int	sw;
{
	register int		i;
	char			*device;
	int			ind;
	char			*stat;

	if (sw == CLOAK)
	{
		/* cloaking device */
		if (Status.ship == QUEENE) {
			error("Ye Faire Queene does not have the cloaking device.\n");
			return;
		}
		device = "Cloaking device";
		ind = CLOAK;
		stat = &Status.cloaked;
	}
	else
	{
		/* shields */
		device = "Shields";
		ind = SHIELD;
		stat = &Status.shldup;
	}
	if (Damage[ind])
	{
		error(device, " inoperable\n");
		return;
	}
	if(sw) {
		if(lineended()) {
			printf("%s %s; ", device,
				(*stat?"up":"down")
				);
		}
		if((i=getcodpar("Up or down", Udtab))<0) return;
	} else {
		i = !*stat;
	}
	if(*stat==i)
		return;
	if (i)
		if(sw!=CLOAK)
			Status.energy =- Param.shupengy;
		else
			Status.cloakdate = Status.date;
	Move.free = 0;
	if(sw!=CLOAK)
		Move.shldchg = 1;
	*stat = i;
	return;
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.