diff options
author | darkvater <darkvater@openttd.org> | 2004-09-06 22:53:59 +0000 |
---|---|---|
committer | darkvater <darkvater@openttd.org> | 2004-09-06 22:53:59 +0000 |
commit | 51d928a478f5cc83285d4f87453fa5c2ce69f77b (patch) | |
tree | d590366b0b7a3c49c736a6a6dce48fbaf305ae44 | |
parent | 9a6870fcfdf9df6de6d7d6959e1a06192a47b958 (diff) | |
download | openttd-51d928a478f5cc83285d4f87453fa5c2ce69f77b.tar.xz |
(svn r174) -Network: [ 023268] small network.c changes/cleanups (MorphOS/AmigaOS) and one compiler warning fix (MorphOS) (tokai)
-rw-r--r-- | network.c | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -62,6 +62,7 @@ struct Library *SocketBase = NULL; +#if !defined(__MORPHOS__) // usleep() implementation #include <devices/timer.h> #include <dos/dos.h> @@ -69,6 +70,7 @@ struct Library *SocketBase = NULL; struct Device *TimerBase = NULL; struct MsgPort *TimerPort = NULL; struct timerequest *TimerRequest = NULL; +#endif #endif /* __MORPHOS__ || __AMIGA__ */ @@ -256,8 +258,11 @@ usleep(milliseconds*1000); #ifdef __BEOS__ snooze(milliseconds*1000); #endif -#if defined(__MORPHOS__) || defined(__AMIGAOS__) -{ +#if defined(__MORPHOS__) +usleep(milliseconds*1000); +#endif +#if defined(__AMIGAOS__) && !defined(__MORPHOS__) +{ ULONG signals; ULONG TimerSigBit = 1 << TimerPort->mp_SigBit; @@ -272,7 +277,7 @@ snooze(milliseconds*1000); } WaitIO((struct IORequest *)TimerRequest); } -#endif // __MORPHOS__ || __AMIGAOS__ +#endif // __AMIGAOS__ && !__MORPHOS__ #endif } @@ -1218,7 +1223,11 @@ void NetworkUDPClose(bool client) { void NetworkUDPReceive(bool client) { struct sockaddr_in client_addr; +#ifndef __MORPHOS__ int client_len; +#else + LONG client_len; // for some reason we need a 'LONG' under MorphOS +#endif int nbytes; struct UDPPacket packet; int packet_len; @@ -1400,7 +1409,8 @@ _network_available=true; _network_available=false; } - // for usleep() implementation + #if !defined(__MORPHOS__) + // for usleep() implementation (only required for legacy AmigaOS builds) if ( (TimerPort = CreateMsgPort()) ) { if ( (TimerRequest = (struct timerequest *) CreateIORequest(TimerPort, sizeof(struct timerequest))) ) { if ( OpenDevice("timer.device", UNIT_MICROHZ, (struct IORequest *) TimerRequest, 0) == 0 ) { @@ -1412,6 +1422,8 @@ _network_available=true; } } } + #endif + } #else @@ -1443,9 +1455,11 @@ DEBUG(misc,3) ("[NET][Core] shutdown()"); #if defined(__MORPHOS__) || defined(__AMIGA__) { // free allocated ressources + #if !defined(__MORPHOS__) if (TimerBase) { CloseDevice((struct IORequest *) TimerRequest); } if (TimerRequest) { DeleteIORequest(TimerRequest); } if (TimerPort) { DeleteMsgPort(TimerPort); } + #endif if (SocketBase) { CloseLibrary(SocketBase); |