Changeset - r24807:48a7f8b46730
[Not reviewed]
master
0 6 0
milek7 - 4 years ago 2021-02-14 13:06:19
me@milek7.pl
Fix: VkMapping declarations violated C++ ODR rule.
6 files changed with 16 insertions and 16 deletions:
0 comments (0 inline, 0 general)
src/video/allegro_v.cpp
Show inline comments
 
@@ -235,7 +235,7 @@ bool VideoDriver_Allegro::ClaimMousePoin
 
	return true;
 
}
 

	
 
struct VkMapping {
 
struct AllegroVkMapping {
 
	uint16 vk_from;
 
	byte vk_count;
 
	byte map_to;
 
@@ -244,7 +244,7 @@ struct VkMapping {
 
#define AS(x, z) {x, 0, z}
 
#define AM(x, y, z, w) {x, y - x, z}
 

	
 
static const VkMapping _vk_mapping[] = {
 
static const AllegroVkMapping _vk_mapping[] = {
 
	/* Pageup stuff + up/down */
 
	AM(KEY_PGUP, KEY_PGDN, WKC_PAGEUP, WKC_PAGEDOWN),
 
	AS(KEY_UP,     WKC_UP),
 
@@ -302,7 +302,7 @@ static uint32 ConvertAllegroKeyIntoMy(WC
 
	int scancode;
 
	int unicode = ureadkey(&scancode);
 

	
 
	const VkMapping *map;
 
	const AllegroVkMapping *map;
 
	uint key = 0;
 

	
 
	for (map = _vk_mapping; map != endof(_vk_mapping); ++map) {
src/video/cocoa/cocoa_keys.h
Show inline comments
 
@@ -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
 

	
src/video/cocoa/cocoa_wnd.mm
Show inline comments
 
@@ -673,7 +673,7 @@ void CocoaDialog(const char *title, cons
 
	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;
src/video/sdl2_v.cpp
Show inline comments
 
@@ -401,7 +401,7 @@ void VideoDriver_SDL::EditBoxLostFocus()
 
}
 

	
 

	
 
struct VkMapping {
 
struct SDLVkMapping {
 
	SDL_Keycode vk_from;
 
	byte vk_count;
 
	byte map_to;
 
@@ -413,7 +413,7 @@ struct VkMapping {
 
#define AS_UP(x, z) {x, 0, z, true}
 
#define AM_UP(x, y, z, w) {x, (byte)(y - x), z, true}
 

	
 
static const VkMapping _vk_mapping[] = {
 
static const SDLVkMapping _vk_mapping[] = {
 
	/* Pageup stuff + up/down */
 
	AS_UP(SDLK_PAGEUP,   WKC_PAGEUP),
 
	AS_UP(SDLK_PAGEDOWN, WKC_PAGEDOWN),
 
@@ -468,7 +468,7 @@ static const VkMapping _vk_mapping[] = {
 

	
 
static uint ConvertSdlKeyIntoMy(SDL_Keysym *sym, WChar *character)
 
{
 
	const VkMapping *map;
 
	const SDLVkMapping *map;
 
	uint key = 0;
 
	bool unprintable = false;
 

	
 
@@ -508,7 +508,7 @@ static uint ConvertSdlKeyIntoMy(SDL_Keys
 
 */
 
static uint ConvertSdlKeycodeIntoMy(SDL_Keycode kc)
 
{
 
	const VkMapping *map;
 
	const SDLVkMapping *map;
 
	uint key = 0;
 

	
 
	for (map = _vk_mapping; map != endof(_vk_mapping); ++map) {
src/video/sdl_v.cpp
Show inline comments
 
@@ -403,7 +403,7 @@ bool VideoDriver_SDL::ClaimMousePointer(
 
	return true;
 
}
 

	
 
struct VkMapping {
 
struct SDLVkMapping {
 
#if SDL_VERSION_ATLEAST(1, 3, 0)
 
	SDL_Keycode vk_from;
 
#else
 
@@ -416,7 +416,7 @@ struct VkMapping {
 
#define AS(x, z) {x, 0, z}
 
#define AM(x, y, z, w) {x, (byte)(y - x), z}
 

	
 
static const VkMapping _vk_mapping[] = {
 
static const SDLVkMapping _vk_mapping[] = {
 
	/* Pageup stuff + up/down */
 
	AM(SDLK_PAGEUP, SDLK_PAGEDOWN, WKC_PAGEUP, WKC_PAGEDOWN),
 
	AS(SDLK_UP,     WKC_UP),
 
@@ -470,7 +470,7 @@ static const VkMapping _vk_mapping[] = {
 

	
 
static uint ConvertSdlKeyIntoMy(SDL_keysym *sym, WChar *character)
 
{
 
	const VkMapping *map;
 
	const SDLVkMapping *map;
 
	uint key = 0;
 

	
 
	for (map = _vk_mapping; map != endof(_vk_mapping); ++map) {
src/video/win32_v.cpp
Show inline comments
 
@@ -114,7 +114,7 @@ bool VideoDriver_Win32::ClaimMousePointe
 
	return true;
 
}
 

	
 
struct VkMapping {
 
struct Win32VkMapping {
 
	byte vk_from;
 
	byte vk_count;
 
	byte map_to;
 
@@ -123,7 +123,7 @@ struct VkMapping {
 
#define AS(x, z) {x, 0, z}
 
#define AM(x, y, z, w) {x, y - x, z}
 

	
 
static const VkMapping _vk_mapping[] = {
 
static const Win32VkMapping _vk_mapping[] = {
 
	/* Pageup stuff + up/down */
 
	AM(VK_PRIOR, VK_DOWN, WKC_PAGEUP, WKC_DOWN),
 
	/* Map letters & digits */
 
@@ -166,7 +166,7 @@ static const VkMapping _vk_mapping[] = {
 

	
 
static uint MapWindowsKey(uint sym)
 
{
 
	const VkMapping *map;
 
	const Win32VkMapping *map;
 
	uint key = 0;
 

	
 
	for (map = _vk_mapping; map != endof(_vk_mapping); ++map) {
0 comments (0 inline, 0 general)