Fix: VkMapping declarations violated C++ ODR rule.

This commit is contained in:
milek7
2021-02-14 14:06:19 +01:00
committed by Loïc Guilloux
parent 5a1fa18509
commit 751f595bb6
6 changed files with 16 additions and 16 deletions

View File

@@ -132,14 +132,14 @@
#define QZ_IBOOK_UP 0x3E
struct VkMapping {
struct CocoaVkMapping {
unsigned short vk_from;
byte map_to;
};
#define AS(x, z) {x, z}
static const VkMapping _vk_mapping[] = {
static const CocoaVkMapping _vk_mapping[] = {
AS(QZ_BACKQUOTE, WKC_BACKQUOTE), // key left of '1'
AS(QZ_BACKQUOTE2, WKC_BACKQUOTE), // some keyboards have it on another scancode

View File

@@ -673,7 +673,7 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
BOOL interpret_keys = YES;
if (down) {
/* Map keycode to OTTD code. */
auto vk = std::find_if(std::begin(_vk_mapping), std::end(_vk_mapping), [=](const VkMapping &m) { return m.vk_from == keycode; });
auto vk = std::find_if(std::begin(_vk_mapping), std::end(_vk_mapping), [=](const CocoaVkMapping &m) { return m.vk_from == keycode; });
uint32 pressed_key = vk != std::end(_vk_mapping) ? vk->map_to : 0;
if (modifiers & NSShiftKeyMask) pressed_key |= WKC_SHIFT;