* Check whether the given TextColour is valid for console usage. * @param c The text colour to compare to. * @return true iff the TextColour is valid for console usage. */
| 536 | * @return true iff the TextColour is valid for console usage. |
| 537 | */ |
| 538 | bool IsValidConsoleColour(TextColour c) |
| 539 | { |
| 540 | /* A normal text colour is used. */ |
| 541 | if (!(c & TC_IS_PALETTE_COLOUR)) return TC_BEGIN <= c && c < TC_END; |
| 542 | |
| 543 | /* A text colour from the palette is used; must be the company |
| 544 | * colour gradient, so it must be one of those. */ |
| 545 | c &= ~TC_IS_PALETTE_COLOUR; |
| 546 | for (Colours i = COLOUR_BEGIN; i < COLOUR_END; i++) { |
| 547 | if (GetColourGradient(i, SHADE_NORMAL).p == c) return true; |
| 548 | } |
| 549 | |
| 550 | return false; |
| 551 | } |
no test coverage detected