소스 검색

get_one_of returns char instead of offset.

Steve Thielemann 3 년 전
부모
커밋
96d49618be
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  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
  *
- * returns offset, or < 0 if timeout.
+ * returns char, or < 0 if timeout.
  *
  * @param keys
- * @return int
+ * @return char or < 0
  */
 int Door::get_one_of(const char *keys) {
   int c;
@@ -949,7 +949,7 @@ int Door::get_one_of(const char *keys) {
       continue;
     const char *key = strchr(keys, (char)toupper(c));
     if (key != nullptr) {
-      return key - keys;
+      return *key;
     }
     *this << '\x07';
   }