the #timeout command */
| 2038 | |
| 2039 | /* the #timeout command */ |
| 2040 | int |
| 2041 | wiz_timeout_queue(void) |
| 2042 | { |
| 2043 | winid win; |
| 2044 | char buf[BUFSZ]; |
| 2045 | const char *propname; |
| 2046 | long intrinsic; |
| 2047 | int i, p, count, longestlen, ln, specindx = 0; |
| 2048 | |
| 2049 | win = create_nhwindow(NHW_MENU); /* corner text window */ |
| 2050 | if (win == WIN_ERR) |
| 2051 | return ECMD_OK; |
| 2052 | |
| 2053 | Sprintf(buf, "Current time = %ld.", svm.moves); |
| 2054 | putstr(win, 0, buf); |
| 2055 | putstr(win, 0, ""); |
| 2056 | putstr(win, 0, "Active timeout queue:"); |
| 2057 | putstr(win, 0, ""); |
| 2058 | print_queue(win, gt.timer_base); |
| 2059 | |
| 2060 | /* Timed properties: |
| 2061 | * check every one; the majority can't obtain temporary timeouts in |
| 2062 | * normal play but those can be forced via the #wizintrinsic command. |
| 2063 | */ |
| 2064 | count = longestlen = 0; |
| 2065 | for (i = 0; (propname = propertynames[i].prop_name) != 0; ++i) { |
| 2066 | p = propertynames[i].prop_num; |
| 2067 | intrinsic = u.uprops[p].intrinsic; |
| 2068 | if (intrinsic & TIMEOUT) { |
| 2069 | ++count; |
| 2070 | if ((ln = (int) strlen(propname)) > longestlen) |
| 2071 | longestlen = ln; |
| 2072 | } |
| 2073 | if (specindx == 0 && p == COLD_RES) /* was FIRE_RES but has changed */ |
| 2074 | specindx = i; |
| 2075 | } |
| 2076 | putstr(win, 0, ""); |
| 2077 | if (!count) { |
| 2078 | putstr(win, 0, "No timed properties."); |
| 2079 | } else { |
| 2080 | putstr(win, 0, "Timed properties:"); |
| 2081 | putstr(win, 0, ""); |
| 2082 | for (i = 0; (propname = propertynames[i].prop_name) != 0; ++i) { |
| 2083 | p = propertynames[i].prop_num; |
| 2084 | intrinsic = u.uprops[p].intrinsic; |
| 2085 | if (intrinsic & TIMEOUT) { |
| 2086 | if (specindx > 0 && i >= specindx) { |
| 2087 | putstr(win, 0, " -- settable via #wizintrinsic only --"); |
| 2088 | specindx = 0; |
| 2089 | } |
| 2090 | /* timeout value can be up to 16777215 (0x00ffffff) but |
| 2091 | width of 4 digits should result in values lining up |
| 2092 | almost all the time (if/when they don't, it won't |
| 2093 | look nice but the information will still be accurate) */ |
| 2094 | Sprintf(buf, " %*s %4ld", -longestlen, propname, |
| 2095 | (intrinsic & TIMEOUT)); |
| 2096 | putstr(win, 0, buf); |
| 2097 | } |
nothing calls this directly
no test coverage detected