void restore_attrib (void) { int i; for(i = 0; i < A_MAX; i++) { /* all temporary losses/gains */ if(ATEMP(i) && ATIME(i)) { if(!(--(ATIME(i)))) { /* countdown for change */ ATEMP(i) += ATEMP(i) > 0 ? -1 : 1; if(ATEMP(i)) /* reset timer */ ATIME(i) = 100 / ACURR(A_CON); } } } (void)encumber_msg(); }
void showtotal(void) { double rsum, wsum, rtsum, wtsum, mssum; int dn; rsum = wsum = rtsum = wtsum = mssum = 0.0; for (dn = 0; dn < cur.dk_ndrive; dn++) { rsum += cur.dk_rbytes[dn] / etime; wsum += cur.dk_wbytes[dn] / etime; rtsum += cur.dk_rxfer[dn] / etime; wtsum += cur.dk_wxfer[dn] / etime; mssum += ATIME(cur.dk_time, dn) / etime; } print_fld_str(FLD_IO_DEVICE, "Totals"); print_fld_size(FLD_IO_READ, rsum); print_fld_size(FLD_IO_WRITE, wsum); print_fld_size(FLD_IO_RTPS, rtsum); print_fld_size(FLD_IO_WTPS, wtsum); print_fld_float(FLD_IO_SEC, mssum, 1); end_line(); }
void init_attr(int np) { int i, x, tryct; for (i = 0; i < A_MAX; i++) { ABASE(i) = AMAX(i) = urole.attrbase[i]; ATEMP(i) = ATIME(i) = 0; np -= urole.attrbase[i]; } /* The starting ability distribution has changed slightly since 3.4.3 so that players with different races but the same role will have the same stats, as far as is possible. Instead of capping scores at the racial maximum, we cap them at STR18(100) for Strength, or 20 for other stats. Then, if any stats end up over the racial cap, we reduce them to the cap and redistribute them on rng_main. The result is that the number of seeds consumed from rng_charstats_role depends purely on role. Note: there were previously two loops here, one to top up to np points, one to cut down to np points. The latter was dead code, and has been removed. */ int pass; for (pass = 1; pass < 3; pass++) { tryct = 0; while (np > 0 && tryct < 100) { x = rn2_on_rng(100, pass == 1 ? rng_charstats_role : rng_main); for (i = 0; (i < A_MAX) && ((x -= urole.attrdist[i]) > 0); i++) ; if (i >= A_MAX) continue; /* impossible */ int current_max = (pass == 1 ? ATTRMAX(i) : i == A_STR ? STR18(100) : 20); if (ABASE(i) >= current_max) { tryct++; continue; } tryct = 0; ABASE(i)++; AMAX(i)++; np--; } for (i = 0; i < A_MAX; i++) { if (ABASE(i) > ATTRMAX(i)) { np += ABASE(i) - ATTRMAX(i); AMAX(i) -= ABASE(i) - ATTRMAX(i); ABASE(i) = ATTRMAX(i); } } } }
void showdrive(int dn) { print_fld_str(FLD_IO_DEVICE, cur.dk_name[dn]); print_fld_size(FLD_IO_READ, cur.dk_rbytes[dn]/etime); print_fld_size(FLD_IO_WRITE, cur.dk_wbytes[dn]/ etime); print_fld_size(FLD_IO_RTPS, cur.dk_rxfer[dn] / etime); print_fld_size(FLD_IO_WTPS, cur.dk_wxfer[dn] / etime); print_fld_float(FLD_IO_SEC, ATIME(cur.dk_time, dn) / etime, 1); end_line(); }
void init_attr (int np) { int i, x, tryct; for(i = 0; i < A_MAX; i++) { ABASE(i) = AMAX(i) = urole.attrbase[i]; ATEMP(i) = ATIME(i) = 0; np -= urole.attrbase[i]; } tryct = 0; while(np > 0 && tryct < 100) { x = rn2(100); for (i = 0; (i < A_MAX) && ((x -= urole.attrdist[i]) > 0); i++) ; if(i >= A_MAX) continue; /* impossible */ if(ABASE(i) >= ATTRMAX(i)) { tryct++; continue; } tryct = 0; ABASE(i)++; AMAX(i)++; np--; } tryct = 0; while(np < 0 && tryct < 100) { /* for redistribution */ x = rn2(100); for (i = 0; (i < A_MAX) && ((x -= urole.attrdist[i]) > 0); i++) ; if(i >= A_MAX) continue; /* impossible */ if(ABASE(i) <= ATTRMIN(i)) { tryct++; continue; } tryct = 0; ABASE(i)--; AMAX(i)--; np++; } }