diff options
Diffstat (limited to 'engines/mutationofjb/game.cpp')
-rw-r--r-- | engines/mutationofjb/game.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/engines/mutationofjb/game.cpp b/engines/mutationofjb/game.cpp index d6ab622e99..a0f85b49b8 100644 --- a/engines/mutationofjb/game.cpp +++ b/engines/mutationofjb/game.cpp @@ -200,4 +200,29 @@ Font& Game::getSpeechFont() { return _speechFont; } +uint8 Game::colorFromString(const char *colorStr) { + struct { + const char *str; + uint8 color; + } colors[] = { + {"white", WHITE}, + {"dakrgray", DARKGRAY}, + {"lightgray", LIGHTGRAY}, + {"green", GREEN}, + {"orange", ORANGE}, + {"darkblue", DARKBLUE}, + {"lightblue", LIGHTBLUE}, + {"brown", BROWN} + }; + + for (int i = 0; i < ARRAYSIZE(colors); ++i) { + if (strcmp(colors[i].str, colorStr) == 0) { + return colors[i].color; + } + } + + warning(_("Color not found")); + return 0x00; +} + } |