Files
@ r1223:fe9a8d21f70b
Branch filter:
Location: cpp/openttd-patchpack/source/network_core.h
r1223:fe9a8d21f70b
3.8 KiB
text/x-c
(svn r1727) - Fix: now CmdBuildRailVehicle() behaves correctly if DC_EXEC is set
this commit alters ai.c a little to get rid of the workaround from r1725 so AI players could still build locomotives
this commit alters ai.c a little to get rid of the workaround from r1725 so AI players could still build locomotives
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | #ifndef NETWORK_CORE_H
#define NETWORK_CORE_H
// Network stuff has many things that needs to be included
// by default. All those things are in this file.
// =============================
// Include standard stuff per OS
// Windows stuff
#if defined(WIN32)
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#ifdef _MSC_VER
#pragma comment (lib, "ws2_32.lib")
#endif //_MSC_VER
#if ! (defined(__MINGW32__) || defined(__CYGWIN__))
#define ENABLE_NETWORK // On windows, the network is always enabled
// Windows has some different names for some types..
typedef SSIZE_T ssize_t;
#endif
#define GET_LAST_ERROR() WSAGetLastError()
#define EWOULDBLOCK WSAEWOULDBLOCK
// Windows has some different names for some types..
typedef unsigned long in_addr_t;
typedef INTERFACE_INFO IFREQ;
#endif // WIN32
// UNIX stuff
#if defined(UNIX)
# define SOCKET int
# define INVALID_SOCKET -1
typedef struct ifreq IFREQ;
# if !defined(__MORPHOS__) && !defined(__AMIGA__)
# define ioctlsocket ioctl
# if !defined(BEOS_NET_SERVER)
# define closesocket close
# endif
# define GET_LAST_ERROR() (errno)
# endif
// Need this for FIONREAD on solaris
# define BSD_COMP
// Includes needed for UNIX-like systems
# include <unistd.h>
# include <sys/ioctl.h>
# if defined(__BEOS__) && defined(BEOS_NET_SERVER)
# include <be/net/socket.h>
# include <be/kernel/OS.h> // snooze()
# include <be/net/netdb.h>
typedef unsigned long in_addr_t;
# define INADDR_NONE INADDR_BROADCAST
# else
# include <sys/socket.h>
# include <netinet/in.h>
# include <netinet/tcp.h>
# include <arpa/inet.h>
# include <net/if.h>
# if !defined(SUNOS) && !defined(__MORPHOS__) && !defined(__BEOS__)
# include <ifaddrs.h>
// If for any reason ifaddrs.h does not exist on a system, remove define below
// and an other system will be used to fetch ips from the system
# define HAVE_GETIFADDRS
# else
# define INADDR_NONE 0xffffffff
# endif // SUNOS
# if defined(__BEOS__) && !defined(BEOS_NET_SERVER)
// needed on Zeta
# include <sys/sockio.h>
# endif
# endif // BEOS_NET_SERVER
/* GLibc 2.1 does not support GetIfAddr() */
# if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 1)
# undef HAVE_GETIFADDRS
typedef uint32_t in_addr_t;
# endif /* __GLIBC__ && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 1) */
# include <errno.h>
# include <sys/time.h>
# include <netdb.h>
#endif // UNIX
// OS/2 stuff
#if defined(__OS2__)
# define SOCKET int
# define INVALID_SOCKET -1
typedef struct ifreq IFREQ;
# define ioctlsocket ioctl
# define closesocket close
# define GET_LAST_ERROR() (sock_errno())
// Includes needed for OS/2 systems
# include <types.h>
# include <unistd.h>
# include <sys/ioctl.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <netinet/tcp.h>
# include <arpa/inet.h>
# include <net/if.h>
# include <errno.h>
# include <sys/time.h>
# include <netdb.h>
# include <nerrno.h>
# define INADDR_NONE 0xffffffff
typedef unsigned long in_addr_t;
#endif // OS/2
// MorphOS and Amiga stuff
#if defined(__MORPHOS__) || defined(__AMIGA__)
# include <exec/types.h>
# include <proto/exec.h> // required for Open/CloseLibrary()
# if defined(__MORPHOS__)
# include <sys/filio.h> // FIO* defines
# include <sys/sockio.h> // SIO* defines
# else // __AMIGA__
# include <proto/socket.h>
# endif
// Make the names compatible
# define closesocket(s) CloseSocket(s)
# define GET_LAST_ERROR() Errno()
# define ioctlsocket(s,request,status) IoctlSocket((LONG)s,(ULONG)request,(char*)status)
# define ioctl ioctlsocket
typedef unsigned int in_addr_t;
extern struct Library *SocketBase;
# ifdef __AMIGA__
// for usleep() implementation
extern struct Device *TimerBase;
extern struct MsgPort *TimerPort;
extern struct timerequest *TimerRequest;
# endif
#endif // __MORPHOS__ || __AMIGA__
#endif // NETWORK_CORE_H
|