mirror of https://github.com/OpenTTD/OpenTTD
(svn r1970) Fix some warnings which Cygwin showed
parent
a571f31c95
commit
34f14e657d
|
@ -332,9 +332,8 @@ static void NetworkFindIPs(void)
|
||||||
// If something fails, make sure the list is empty
|
// If something fails, make sure the list is empty
|
||||||
_network_ip_list[0] = 0;
|
_network_ip_list[0] = 0;
|
||||||
|
|
||||||
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
|
sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
return;
|
if (sock == INVALID_SOCKET) return;
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
// On windows it is easy
|
// On windows it is easy
|
||||||
|
|
|
@ -150,7 +150,11 @@ typedef unsigned long in_addr_t;
|
||||||
|
|
||||||
static inline bool SetNonBlocking(int d)
|
static inline bool SetNonBlocking(int d)
|
||||||
{
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
u_long nonblocking = 1;
|
||||||
|
#else
|
||||||
int nonblocking = 1;
|
int nonblocking = 1;
|
||||||
|
#endif
|
||||||
#if defined(__BEOS__) && defined(BEOS_NET_SERVER)
|
#if defined(__BEOS__) && defined(BEOS_NET_SERVER)
|
||||||
return setsockopt(d, SOL_SOCKET, SO_NONBLOCK, &nonblocking, sizeof(nonblocking)) == 0;
|
return setsockopt(d, SOL_SOCKET, SO_NONBLOCK, &nonblocking, sizeof(nonblocking)) == 0;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -110,7 +110,7 @@ typedef enum {
|
||||||
|
|
||||||
// To keep the clients all together
|
// To keep the clients all together
|
||||||
typedef struct NetworkClientState {
|
typedef struct NetworkClientState {
|
||||||
int socket;
|
SOCKET socket;
|
||||||
uint16 index;
|
uint16 index;
|
||||||
uint32 last_frame;
|
uint32 last_frame;
|
||||||
uint32 last_frame_server;
|
uint32 last_frame_server;
|
||||||
|
|
32
win32.c
32
win32.c
|
@ -135,23 +135,20 @@ static const VkMapping _vk_mapping[] = {
|
||||||
AS(VK_MULTIPLY, WKC_NUM_MUL),
|
AS(VK_MULTIPLY, WKC_NUM_MUL),
|
||||||
AS(VK_SUBTRACT, WKC_NUM_MINUS),
|
AS(VK_SUBTRACT, WKC_NUM_MINUS),
|
||||||
AS(VK_ADD, WKC_NUM_PLUS),
|
AS(VK_ADD, WKC_NUM_PLUS),
|
||||||
AS(VK_DECIMAL, WKC_NUM_DECIMAL),
|
AS(VK_DECIMAL, WKC_NUM_DECIMAL)
|
||||||
{0}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint MapWindowsKey(uint key)
|
static uint MapWindowsKey(uint sym)
|
||||||
{
|
{
|
||||||
const VkMapping *map = _vk_mapping - 1;
|
const VkMapping *map;
|
||||||
uint from;
|
uint key = 0;
|
||||||
do {
|
|
||||||
map++;
|
|
||||||
from = map->vk_from;
|
|
||||||
if (from == 0) {
|
|
||||||
return 0; // Unknown key pressed.
|
|
||||||
}
|
|
||||||
} while ((uint)(key - from) > map->vk_count);
|
|
||||||
|
|
||||||
key = key - from + map->map_to;
|
for (map = _vk_mapping; map != endof(_vk_mapping); ++map) {
|
||||||
|
if ((uint)(sym - map->vk_from) <= map->vk_count) {
|
||||||
|
key = sym - map->vk_from + map->map_to;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (GetAsyncKeyState(VK_SHIFT)<0) key |= WKC_SHIFT;
|
if (GetAsyncKeyState(VK_SHIFT)<0) key |= WKC_SHIFT;
|
||||||
if (GetAsyncKeyState(VK_CONTROL)<0) key |= WKC_CTRL;
|
if (GetAsyncKeyState(VK_CONTROL)<0) key |= WKC_CTRL;
|
||||||
|
@ -1500,7 +1497,8 @@ static FiosItem *FiosAlloc(void)
|
||||||
return &_fios_items[_fios_count++];
|
return &_fios_items[_fios_count++];
|
||||||
}
|
}
|
||||||
|
|
||||||
static HANDLE MyFindFirstFile(char *path, char *file, WIN32_FIND_DATA *fd)
|
static HANDLE MyFindFirstFile(const char *path, const char *file,
|
||||||
|
WIN32_FIND_DATA *fd)
|
||||||
{
|
{
|
||||||
char paths[MAX_PATH];
|
char paths[MAX_PATH];
|
||||||
|
|
||||||
|
@ -1842,7 +1840,7 @@ const DriverDesc _video_driver_descs[] = {
|
||||||
#endif
|
#endif
|
||||||
{"win32", "Win32 GDI Video Driver", &_win32_video_driver, Windows_NT3_51},
|
{"win32", "Win32 GDI Video Driver", &_win32_video_driver, Windows_NT3_51},
|
||||||
{ "dedicated", "Dedicated Video Driver", &_dedicated_video_driver, 0},
|
{ "dedicated", "Dedicated Video Driver", &_dedicated_video_driver, 0},
|
||||||
{NULL}
|
{ NULL, NULL, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
const DriverDesc _sound_driver_descs[] = {
|
const DriverDesc _sound_driver_descs[] = {
|
||||||
|
@ -1851,7 +1849,7 @@ const DriverDesc _sound_driver_descs[] = {
|
||||||
{"sdl", "SDL Sound Driver", &_sdl_sound_driver, 1},
|
{"sdl", "SDL Sound Driver", &_sdl_sound_driver, 1},
|
||||||
#endif
|
#endif
|
||||||
{"win32", "Win32 WaveOut Driver", &_win32_sound_driver, Windows_NT3_51},
|
{"win32", "Win32 WaveOut Driver", &_win32_sound_driver, Windows_NT3_51},
|
||||||
{NULL}
|
{ NULL, NULL, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
const DriverDesc _music_driver_descs[] = {
|
const DriverDesc _music_driver_descs[] = {
|
||||||
|
@ -1861,7 +1859,7 @@ const DriverDesc _music_driver_descs[] = {
|
||||||
#endif
|
#endif
|
||||||
// Win32 MIDI driver has higher priority than DMusic, so this one is chosen
|
// Win32 MIDI driver has higher priority than DMusic, so this one is chosen
|
||||||
{"win32", "Win32 MIDI Driver", &_win32_music_driver, Windows_NT3_51},
|
{"win32", "Win32 MIDI Driver", &_win32_music_driver, Windows_NT3_51},
|
||||||
{NULL}
|
{ NULL, NULL, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
byte GetOSVersion(void)
|
byte GetOSVersion(void)
|
||||||
|
|
Loading…
Reference in New Issue