src/unix.cpp
branchnoai
changeset 10455 22c441f5adf9
parent 10355 ee4b5f7a5bf2
child 10867 5de2923d6e59
--- a/src/unix.cpp	Mon May 05 12:35:38 2008 +0000
+++ b/src/unix.cpp	Wed May 07 21:09:51 2008 +0000
@@ -1,6 +1,6 @@
 /* $Id$ */
 
-/** @file unix.cpp */
+/** @file unix.cpp Implementation of Unix specific file handling. */
 
 #include "stdafx.h"
 #include "openttd.h"
@@ -106,99 +106,6 @@
 	return ent->d_name[0] == '.';
 }
 
-void ShowInfo(const char *str)
-{
-	fprintf(stderr, "%s\n", str);
-}
-
-void ShowOSErrorBox(const char *buf)
-{
-#if defined(__APPLE__)
-	/* this creates an NSAlertPanel with the contents of 'buf'
-	 * this is the native and nicest way to do this on OSX */
-	ShowMacDialog( buf, "See readme for more info\nMost likely you are missing files from the original TTD", "Quit" );
-#else
-	/* all systems, but OSX */
-	fprintf(stderr, "\033[1;31mError: %s\033[0;39m\n", buf);
-#endif
-}
-
-#ifdef WITH_COCOA
-void cocoaSetupAutoreleasePool();
-void cocoaReleaseAutoreleasePool();
-#endif
-
-int CDECL main(int argc, char* argv[])
-{
-	int ret;
-
-#ifdef WITH_COCOA
-	cocoaSetupAutoreleasePool();
-	/* This is passed if we are launched by double-clicking */
-	if (argc >= 2 && strncmp(argv[1], "-psn", 4) == 0) {
-		argv[1] = NULL;
-		argc = 1;
-	}
-#endif
-
-	SetRandomSeed(time(NULL));
-
-	signal(SIGPIPE, SIG_IGN);
-
-	ret = ttd_main(argc, argv);
-
-#ifdef WITH_COCOA
-	cocoaReleaseAutoreleasePool();
-#endif
-
-	return ret;
-}
-
-bool InsertTextBufferClipboard(Textbuf *tb)
-{
-	return false;
-}
-
-
-/* multi os compatible sleep function */
-
-#ifdef __AMIGA__
-/* usleep() implementation */
-#	include <devices/timer.h>
-#	include <dos/dos.h>
-
-	extern struct Device      *TimerBase    = NULL;
-	extern struct MsgPort     *TimerPort    = NULL;
-	extern struct timerequest *TimerRequest = NULL;
-#endif // __AMIGA__
-
-void CSleep(int milliseconds)
-{
-	#if defined(PSP)
-		sceKernelDelayThread(milliseconds * 1000);
-	#elif defined(__BEOS__)
-		snooze(milliseconds * 1000);
-	#elif defined(__AMIGA__)
-	{
-		ULONG signals;
-		ULONG TimerSigBit = 1 << TimerPort->mp_SigBit;
-
-		/* send IORequest */
-		TimerRequest->tr_node.io_Command = TR_ADDREQUEST;
-		TimerRequest->tr_time.tv_secs    = (milliseconds * 1000) / 1000000;
-		TimerRequest->tr_time.tv_micro   = (milliseconds * 1000) % 1000000;
-		SendIO((struct IORequest *)TimerRequest);
-
-		if (!((signals = Wait(TimerSigBit | SIGBREAKF_CTRL_C)) & TimerSigBit) ) {
-			AbortIO((struct IORequest *)TimerRequest);
-		}
-		WaitIO((struct IORequest *)TimerRequest);
-	}
-	#else
-		usleep(milliseconds * 1000);
-	#endif
-}
-
 #ifdef WITH_ICONV
 
 #include <iconv.h>
@@ -301,3 +208,96 @@
 const char *FS2OTTD(const char *name) {return name;}
 const char *OTTD2FS(const char *name) {return name;}
 #endif /* WITH_ICONV */
+
+void ShowInfo(const char *str)
+{
+	fprintf(stderr, "%s\n", str);
+}
+
+void ShowOSErrorBox(const char *buf)
+{
+#if defined(__APPLE__)
+	/* this creates an NSAlertPanel with the contents of 'buf'
+	 * this is the native and nicest way to do this on OSX */
+	ShowMacDialog( buf, "See readme for more info\nMost likely you are missing files from the original TTD", "Quit" );
+#else
+	/* all systems, but OSX */
+	fprintf(stderr, "\033[1;31mError: %s\033[0;39m\n", buf);
+#endif
+}
+
+#ifdef WITH_COCOA
+void cocoaSetupAutoreleasePool();
+void cocoaReleaseAutoreleasePool();
+#endif
+
+int CDECL main(int argc, char* argv[])
+{
+	int ret;
+
+#ifdef WITH_COCOA
+	cocoaSetupAutoreleasePool();
+	/* This is passed if we are launched by double-clicking */
+	if (argc >= 2 && strncmp(argv[1], "-psn", 4) == 0) {
+		argv[1] = NULL;
+		argc = 1;
+	}
+#endif
+
+	SetRandomSeed(time(NULL));
+
+	signal(SIGPIPE, SIG_IGN);
+
+	ret = ttd_main(argc, argv);
+
+#ifdef WITH_COCOA
+	cocoaReleaseAutoreleasePool();
+#endif
+
+	return ret;
+}
+
+bool InsertTextBufferClipboard(Textbuf *tb)
+{
+	return false;
+}
+
+
+/* multi os compatible sleep function */
+
+#ifdef __AMIGA__
+/* usleep() implementation */
+#	include <devices/timer.h>
+#	include <dos/dos.h>
+
+	extern struct Device      *TimerBase    = NULL;
+	extern struct MsgPort     *TimerPort    = NULL;
+	extern struct timerequest *TimerRequest = NULL;
+#endif // __AMIGA__
+
+void CSleep(int milliseconds)
+{
+	#if defined(PSP)
+		sceKernelDelayThread(milliseconds * 1000);
+	#elif defined(__BEOS__)
+		snooze(milliseconds * 1000);
+	#elif defined(__AMIGA__)
+	{
+		ULONG signals;
+		ULONG TimerSigBit = 1 << TimerPort->mp_SigBit;
+
+		/* send IORequest */
+		TimerRequest->tr_node.io_Command = TR_ADDREQUEST;
+		TimerRequest->tr_time.tv_secs    = (milliseconds * 1000) / 1000000;
+		TimerRequest->tr_time.tv_micro   = (milliseconds * 1000) % 1000000;
+		SendIO((struct IORequest *)TimerRequest);
+
+		if (!((signals = Wait(TimerSigBit | SIGBREAKF_CTRL_C)) & TimerSigBit) ) {
+			AbortIO((struct IORequest *)TimerRequest);
+		}
+		WaitIO((struct IORequest *)TimerRequest);
+	}
+	#else
+		usleep(milliseconds * 1000);
+	#endif
+}