예제 #1
0
파일: dr_2.c 프로젝트: gburd/wsim
void
thinkofgrapples()
{
	struct ship *sp, *sq;
	char friendly;

	foreachship(sp) {
		if (sp->file->captain[0] || sp->file->dir == 0)
			continue;
		foreachship(sq) {
			friendly = sp->nationality == capship(sq)->nationality;
			if (!friendly) {
				if (sp->file->struck || sp->file->captured != 0)
					continue;
				if (range(sp, sq) != 1)
					continue;
				if (grappled2(sp, sq))
					if (toughmelee(sp, sq, 0, 0))
						ungrap(sp, sq);
					else
						grap(sp, sq);
				else if (couldwin(sp, sq)) {
					grap(sp, sq);
					sp->file->loadwith = L_GRAPE;
				}
			} else
				ungrap(sp, sq);
		}
	}
}
예제 #2
0
파일: driver2.c 프로젝트: dank101/4.2BSD
thinkofgrapples()
{
	register int n, l, friendly;

	for (n=0; n < scene[game].vessels; n++){
		if (!scene[game].ship[n].file -> captain[0] && pos[n].dir){
			for (l=0; l < scene[game].vessels; l++){
				if ((friendly = scene[game].ship[l].file -> captured) < 0)
					friendly = scene[game].ship[n].nationality == scene[game].ship[l].nationality;
				else
					friendly = scene[game].ship[n].nationality == scene[game].ship[friendly].nationality;
				if (!friendly){
					if (range(n,l) == 1 && !scene[game].ship[n].file -> struck && scene[game].ship[n].file -> captured < 0){
						if (grapple(n,l))
							if (toughmelee(n,l,0,0))
								ungrap(n, l);
							else
								grap(n, l);
						else if (couldwin(n,l)){
							grap(n, l);
							loadwith[n] = GRAPE;
						}
					}
				}
				else
					ungrap(n,l);
			}
		}
	}
}