convert experience level (1..30) to rank index (0..8) */
| 295 | |
| 296 | /* convert experience level (1..30) to rank index (0..8) */ |
| 297 | int |
| 298 | xlev_to_rank(int xlev) |
| 299 | { |
| 300 | /* |
| 301 | * 1..2 => 0 |
| 302 | * 3..5 => 1 |
| 303 | * 6..9 => 2 |
| 304 | * 10..13 => 3 |
| 305 | * ... |
| 306 | * 26..29 => 7 |
| 307 | * 30 => 8 |
| 308 | * Conversion is precise but only partially reversible. |
| 309 | */ |
| 310 | return (xlev <= 2) ? 0 : (xlev <= 30) ? ((xlev + 2) / 4) : 8; |
| 311 | } |
| 312 | |
| 313 | /* convert rank index (0..8) to experience level (1..30) */ |
| 314 | int |
no outgoing calls
no test coverage detected