OSDN Git Service

Merge branch 'develop' into macos-develop
authorEric Branlund <ebranlund@fastmail.com>
Mon, 19 Dec 2022 17:38:31 +0000 (10:38 -0700)
committerEric Branlund <ebranlund@fastmail.com>
Mon, 19 Dec 2022 17:38:31 +0000 (10:38 -0700)
1  2 
src/core/asking-player.cpp

@@@ -436,13 -435,8 +435,13 @@@ bool get_value(std::string_view prompt
      std::stringstream st;
      int val;
      char tmp_val[12] = "";
 +    /* std::to_chars() requires Mac OS X 10.15 or later. */
 +#if !defined(MACH_O_COCOA) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15)
      std::to_chars(std::begin(tmp_val), std::end(tmp_val) - 1, *value);
-     st << text << "(" << min << "-" << max << "): ";
 +#else
 +    snprintf(tmp_val, sizeof(tmp_val), "%d", *value);
 +#endif
+     st << prompt << "(" << min << "-" << max << "): ";
      int digit = std::max(std::to_string(min).length(), std::to_string(max).length());
      while (true) {
          if (!get_string(st.str().data(), tmp_val, digit)) {