diff options
author | rubidium <rubidium@openttd.org> | 2007-01-04 19:12:45 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-01-04 19:12:45 +0000 |
commit | 5e276359a43b3115b3cd2b7a5fc344c0c568649b (patch) | |
tree | feb7563ffb9e9e1b2b49988996129e641cd78c09 /src/network/core | |
parent | b7223171160e6f1a8d4f0fd634f6f358c611c886 (diff) | |
download | openttd-5e276359a43b3115b3cd2b7a5fc344c0c568649b.tar.xz |
(svn r7830) -Codechange: let NetworkCoreInitialize return a bool, so we have to set _network_available only once.
Diffstat (limited to 'src/network/core')
-rw-r--r-- | src/network/core/core.c | 15 | ||||
-rw-r--r-- | src/network/core/core.h | 2 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/network/core/core.c b/src/network/core/core.c index 310fc3326..90b248f74 100644 --- a/src/network/core/core.c +++ b/src/network/core/core.c @@ -13,7 +13,7 @@ struct Library *SocketBase = NULL; /** * Initializes the network core (as that is needed for some platforms */ -void NetworkCoreInitialize(void) +bool NetworkCoreInitialize(void) { #if defined(__MORPHOS__) || defined(__AMIGA__) /* @@ -24,8 +24,7 @@ void NetworkCoreInitialize(void) SocketBase = OpenLibrary("bsdsocket.library", 4); if (SocketBase == NULL) { DEBUG(net, 0, "[core] can't open bsdsocket.library version 4, network unavailable"); - _network_available = false; - return; + return false; } #if defined(__AMIGA__) @@ -37,10 +36,9 @@ void NetworkCoreInitialize(void) if (OpenDevice("timer.device", UNIT_MICROHZ, (struct IORequest*)TimerRequest, 0) == 0) { TimerBase = TimerRequest->tr_node.io_Device; if (TimerBase == NULL) { - // free ressources... + /* free ressources... */ DEBUG(net, 0, "[core] can't initialize timer, network unavailable"); - _network_available = false; - return; + return false; } } } @@ -55,11 +53,12 @@ void NetworkCoreInitialize(void) DEBUG(net, 3, "[core] loading windows socket library"); if (WSAStartup(MAKEWORD(2, 0), &wsa) != 0) { DEBUG(net, 0, "[core] WSAStartup failed, network unavailable"); - _network_available = false; - return; + return false; } } #endif /* WIN32 */ + + return true; } /** diff --git a/src/network/core/core.h b/src/network/core/core.h index 80a08eece..c6dc05591 100644 --- a/src/network/core/core.h +++ b/src/network/core/core.h @@ -5,7 +5,7 @@ #ifdef ENABLE_NETWORK -void NetworkCoreInitialize(void); +bool NetworkCoreInitialize(void); void NetworkCoreShutdown(void); #endif /* ENABLE_NETWORK */ |