示例#1
0
文件: dr_4.c 项目: a565109863/src
void
ungrap(struct ship *from, struct ship *to)
{
	int k;
	char friend;

	if ((k = grappled2(from, to)) == 0)
		return;
	friend = capship(from)->nationality == capship(to)->nationality;
	while (--k >= 0) {
		if (friend || die() < 3) {
			cleangrapple(from, to, 0);
			makesignal(from, "ungrappling $$", to);
		}
	}
}
示例#2
0
文件: driver2.c 项目: dank101/4.2BSD
checkup()
{
	register int k, n, explode, sink;

	readpos();
	for (n=0; n < scene[game].vessels; n++){
		explode = scene[game].ship[n].file -> explode;
		sink = scene[game].ship[n].file -> sink;
		if (die() >= 5 && (explode == 1 || sink == 1)){
			explode = 2;
			if (sink != 1)
				Write(FILES + n, 0, 232, explode);
			else
				Write(FILES + n, 0, 234, explode);
			pos[n].dir = 0;	/* hopefully enough to kill ship */
			Write(n, 0, 10, 0);
			if (fouled(n) || grappled(n)){
				for (k=0; k < 10; k++){
					if (scene[game].ship[n].file -> fouls[k].turnfoul)
						cleanfoul(n,scene[game].ship[n].file -> fouls[k].toship,k);
				}
				for (k=0; k < 10; k++){
					if (scene[game].ship[n].file -> grapples[k].turnfoul)
						cleangrapple(n,scene[game].ship[n].file -> grapples[k].toship,k);
				}
			}
			if (sink != 1){
				makesignal("exploding!", 0, n);
				for (k=0; k < scene[game].vessels; k++)
					if (k != n && pos[k].dir && range(n,k) < 4)
						table(RIGGING, EXPLODE, specs[scene[game].ship[n].shipnum].guns/13, k, n, 6);
			}
			else {
				makesignal("sinking!", 0, n);
			}
		}
	}
}