aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/pet_control/pet_glyphs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/pet_control/pet_glyphs.cpp')
-rw-r--r--engines/titanic/pet_control/pet_glyphs.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp
index 96e61c9d48..d1cb384729 100644
--- a/engines/titanic/pet_control/pet_glyphs.cpp
+++ b/engines/titanic/pet_control/pet_glyphs.cpp
@@ -222,6 +222,10 @@ void CPetGlyphs::highlight(int index) {
warning("TODO: CPetGlyphs::highlight");
}
+void CPetGlyphs::highlight(const CPetGlyph *glyph) {
+ highlight(indexOf(glyph));
+}
+
int CPetGlyphs::getHighlightedIndex(int index) {
int idx = index - _firstVisibleIndex;
return (idx >= 0 && idx < _numVisibleGlyphs) ? idx : -1;
@@ -445,4 +449,14 @@ bool CPetGlyphs::highlighted14() {
return false;
}
+int CPetGlyphs::indexOf(const CPetGlyph *glyph) const {
+ int index = 0;
+ for (const_iterator i = begin(); i != end(); ++i, ++index) {
+ if (*i == glyph)
+ return index;
+ }
+
+ return -1;
+}
+
} // End of namespace Titanic