Pārlūkot izejas kodu

get_one_of returns char instead of offset.

Steve Thielemann 3 gadi atpakaļ
vecāks
revīzija
96d49618be
1 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. 3 3
      door.cpp

+ 3 - 3
door.cpp

@@ -933,10 +933,10 @@ std::string Door::input_string(int max) {
 /**
 /**
  * @brief Get one of these keys
  * @brief Get one of these keys
  *
  *
- * returns offset, or < 0 if timeout.
+ * returns char, or < 0 if timeout.
  *
  *
  * @param keys
  * @param keys
- * @return int
+ * @return char or < 0
  */
  */
 int Door::get_one_of(const char *keys) {
 int Door::get_one_of(const char *keys) {
   int c;
   int c;
@@ -949,7 +949,7 @@ int Door::get_one_of(const char *keys) {
       continue;
       continue;
     const char *key = strchr(keys, (char)toupper(c));
     const char *key = strchr(keys, (char)toupper(c));
     if (key != nullptr) {
     if (key != nullptr) {
-      return key - keys;
+      return *key;
     }
     }
     *this << '\x07';
     *this << '\x07';
   }
   }