|
|
1.1 ! root 1: #ifndef lint ! 2: static char *sccsid = "@(#)boarders.c 1.1 83/03/17"; ! 3: #endif ! 4: #include "externs.h" ! 5: ! 6: subtract(from, totalfrom, crewfrom, fromcap, pcfrom) ! 7: int from, fromcap, pcfrom; ! 8: register int totalfrom, crewfrom[3]; ! 9: { ! 10: register int n; ! 11: ! 12: if (fromcap == from && totalfrom){ /* if not captured */ ! 13: for (n = 0; n < 3; n++){ ! 14: if (totalfrom > crewfrom[n]){ ! 15: totalfrom -= crewfrom[n]; ! 16: crewfrom[n] = 0; ! 17: } ! 18: else { ! 19: crewfrom[n] -= totalfrom; ! 20: totalfrom = 0; ! 21: } ! 22: Write(SPECS + from, 0, 14 + 2*n, crewfrom[n]); ! 23: } ! 24: } ! 25: else if (totalfrom){ ! 26: pcfrom -= totalfrom; ! 27: pcfrom = pcfrom < 0 ? 0 : pcfrom; ! 28: Write(FILES + from, 0, 70, pcfrom); ! 29: } ! 30: } ! 31: ! 32: mensent(from, to, crew, captured, pc, points, key) ! 33: int from, to, key, crew[3], *captured, *pc, *points; ! 34: { /* returns # of crew squares sent */ ! 35: int men = 0; ! 36: register int n; ! 37: int c1, c2, c3; ! 38: struct shipspecs *ptr; ! 39: struct File *ptr1; ! 40: struct BP *ptr2; ! 41: ! 42: ptr = &specs[scene[game].ship[from].shipnum]; ! 43: ptr1 = scene[game].ship[from].file; /* key: 0 OBP */ ! 44: ptr2 = key ? ptr1 -> DBP : ptr1 -> OBP; /* 1 DBP */ ! 45: *pc = ptr1 -> pcrew; ! 46: *captured = ptr1 -> captured; ! 47: crew[0] = ptr -> crew1; ! 48: crew[1] = ptr -> crew2; ! 49: crew[2] = ptr -> crew3; ! 50: for (n=0; n < 3; n++){ ! 51: if (ptr2[n].turnsent && ptr2[n].toship == to) ! 52: men += ptr2[n].mensent; ! 53: } ! 54: if (men){ ! 55: c1 = men/100 ? crew[0] : 0; ! 56: c2 = (men%100)/10 ? crew[1] : 0; ! 57: c3 = men/10 ? crew[2] : 0; ! 58: c3 = *captured < 0 ? crew[2] : *pc; ! 59: } else ! 60: c1 = c2 = c3 = 0; ! 61: return(c1 + c2 + c3); ! 62: } ! 63:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.