Bind F10 to open dhewm3Settings menu, unless F10 is already bound

Also fix MSVC build: For some reason Microsoft's sad excuse of a compiler
 only sets __cplusplus to a value from this millenium if the
/Zc:__cplusplus compiler option is set, but that's only supported from
VS2017 15.7 on. The alternative is to use _MSVC_LANG, which always holds
the version that __cplusplus *should* have...
This commit is contained in:
Daniel Gibson 2024-05-23 02:11:54 +02:00
parent 2892e416f5
commit ef529cf49a
2 changed files with 11 additions and 1 deletions

View file

@ -132,7 +132,7 @@ public:
void Swap( idList<type> &other ); // swap the contents of the lists
void DeleteContents( bool clear ); // delete the contents of the list
#if __cplusplus >= 201103L
#if __cplusplus >= 201103L || defined(_MSVC_LANG) && _MSVC_LANG >= 201103L
// begin and end allow using C++11 for(ElemType& e : myIdlist) { ... }
type* begin() {
return list;

View file

@ -253,6 +253,16 @@ bool Init(void* _sdlWindow, void* sdlGlContext)
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, nullptr, io.Fonts->GetGlyphRangesJapanese());
//IM_ASSERT(font != nullptr);
const char* f10bind = idKeyInput::GetBinding( K_F10 );
if ( f10bind && f10bind[0] != '\0' ) {
if ( idStr::Icmp( f10bind, "dhewm3Settings" ) != 0 ) {
// if F10 is already bound, but not to dhewm3Settings, show a message
common->Printf( "... the F10 key is already bound to '%s', otherwise it could be used to open the dhewm3 Settings Menu\n" , f10bind );
}
} else {
idKeyInput::SetBinding( K_F10, "dhewm3Settings" );
}
imgui_initialized = true;
return true;
}